Libraryless. Click here for Pure Java version (11532L/67K).
meta-for IntegralImage also as IIntegralImage { static int[] scaledPixelsFromIntegralImage(int w, IntegralImage img) { ret scaledPixelsFromIntegralImage(img, w); } static int[] scaledPixelsFromIntegralImage(IntegralImage img, int w, int h default heightForWidth(img, w)) { int w1 = img.getWidth(), h1 = img.getHeight(); double stepX = doubleRatio(w1, w), stepY = doubleRatio(h1, h); int[] pixels = new[w*h]; int i = 0; double srcY = 0; double area = stepX*stepY; printVars ifdef scaledPixelsFromIntegralImage_debug("scaledPixelsFromIntegralImage", +w, +h, +w1, +h1, +stepX, +stepY, +area); for y to h: { double srcX = 0, nextSrcY = srcY+stepY; for x to w: { double nextSrcX = srcX+stepX; dbl r = doubleRatio(img.rectSum(srcX, srcY, nextSrcX, nextSrcY, 0), area); dbl g = doubleRatio(img.rectSum(srcX, srcY, nextSrcX, nextSrcY, 1), area); dbl b = doubleRatio(img.rectSum(srcX, srcY, nextSrcX, nextSrcY, 2), area); printVars ifdef scaledPixelsFromIntegralImage_debug("scaledPixelsFromIntegralImage", +r, +g, +b); pixels[i++] = rgbIntFromDoubles_fullAlpha(r, g, b); srcX = nextSrcX; } srcY = nextSrcY; } ret pixels; } }
Began life as a copy of #1033676
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034885 |
Snippet name: | scaledPixelsFromIntegralImage - scale (I)IntegralImage down to a pixel array |
Eternal ID of this version: | #1034885/9 |
Text MD5: | 412af4d521461a03755f69efb75b94c2 |
Transpilation MD5: | 342a497d12cad6a8aadce1454c0d8950 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-21 01:49:18 |
Source code size: | 1314 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 141 / 237 |
Version history: | 8 change(s) |
Referenced in: | [show references] |