Transpiled version (5506L) is out of date.
srecord noeq RawBufferedImageDistance_sameSize(BufferedImage img1, BufferedImage img2) { settable long stoppingValue = Int.MAX_VALUE; int w, h; int x, y; // where we stopped calculating long sum; bool completed() { ret w != 0 && x == w && y == h; } long get() { int w = this.w = img1.getWidth(), h = this.h = img1.getHeight(); assertSameSize(img1, img2); var gp1 = grabbableIntPixels_fastOrSlow(img1); var gp2 = grabbableIntPixels_fastOrSlow(img2); int iPixels1 = gp1.offset, iPixels2 = gp2.offset; int[] pixels1 = gp1.data, pixels2 = gp2.data; long sum = 0; for y to h: { for x to w: { sum += rawRGBDiff( pixels1[iPixels1+x], pixels2[iPixels2+x]); // cancel if difference out of interest range if (sum > stoppingValue) { this.x = x; this.y = y; this.sum = sum; ret sum; } } iPixels1 += gp1.scanlineStride; iPixels2 += gp2.scanlineStride; } this.x = w; this.y = h; ret this.sum = sum; } }
Began life as a copy of #1034891
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034893 | 
| Snippet name: | RawBufferedImageDistance_sameSize - returns long (between 0 and nPixels*255*3) | 
| Eternal ID of this version: | #1034893/7 | 
| Text MD5: | 39b8962830414a8c9592f22fbcd67641 | 
| Author: | stefan | 
| Category: | javax / ocr | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2022-03-13 03:18:57 | 
| Source code size: | 1135 bytes / 42 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 608 / 747 | 
| Version history: | 6 change(s) | 
| Referenced in: | [show references] |