Libraryless. Click here for Pure Java version (11576L/68K).
// forgets sub-pixels // nearest neighbor, basically // TODO: fix? sclass TruncatedIBWIntegralImage > Meta is IBWIntegralImage { IBWIntegralImage img; int w, h; *(IBWIntegralImage *img) { w = img.getWidth(); h = img.getHeight(); } public int getWidth() { ret w; } public int getHeight() { ret h; } // normal range [0; pixelCount*256) public double getIIValue(dbl x, dbl y) { int xFloor = ifloor(x), yFloor = ifloor(y); // get value at top left corner of pixel double val = img.getIIValue(xFloor, yFloor); // at integer coordinate? done if (xFloor == x && yFloor == y) ret val; double xFrac = x-xFloor, yFrac = y-yFloor; // at non-integer coordinate, perform subpixel calculation double area = xFrac*yFrac; double pixelColor = img.getPixelBrightness(xFloor+1, yFloor+1); ret val+area*pixelColor; } }
Began life as a copy of #1033566
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033569 |
| Snippet name: | TruncatedIBWIntegralImage [forget sub-pixels] |
| Eternal ID of this version: | #1033569/11 |
| Text MD5: | 1e9a0ed0fa951c9cbc45f0ea582a525f |
| Transpilation MD5: | b71a7af2293b9166b66321c519350fb1 |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-05 02:03:01 |
| Source code size: | 942 bytes / 35 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 467 / 622 |
| Version history: | 10 change(s) |
| Referenced in: | [show references] |