Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1034855 // bwRawImageDiff_sameSize - returns long (between 0 and 255*nPixels)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (10781L/62K).

static long bwRawImageDiff_sameSize(MakesBWImage a, MakesBWImage b) {
  ret bwRawImageDiff_sameSize(a.getBWImage(), b.getBWImage());
}

static long bwRawImageDiff_sameSize(MakesBWImage a, BWImage b) {
  ret bwRawImageDiff_sameSize(a.getBWImage(), b);
}

static long bwRawImageDiff_sameSize(BWImage a, MakesBWImage b) {
  ret bwRawImageDiff_sameSize(a, b.getBWImage());
}

static long bwRawImageDiff_sameSize(BWImage a, BWImage b) {
  assertSameSize(a, b);
  int w = a.w(), h = a.h();
  byte[] pixels1 = a.pixels, pixels2 = b.pixels;
  int n = pixels1.length;
  
  long diff = 0;
  for i to n:
    diff += Math.abs(ubyteToInt(pixels1[i])-ubyteToInt(pixels2[i]));
  ret diff;
}

Author comment

Began life as a copy of #1006195

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034855
Snippet name: bwRawImageDiff_sameSize - returns long (between 0 and 255*nPixels)
Eternal ID of this version: #1034855/6
Text MD5: 087e426cb45020ea0ec84981c697520b
Transpilation MD5: 89af8251a2e8318dd8273d36d3554031
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-11 07:36:11
Source code size: 697 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 134 / 227
Version history: 5 change(s)
Referenced in: [show references]