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

19
LINES

< > BotCompany Repo | #1019596 // bwIntegralImage_sumRect - sum of rectangle brightness over integral image

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

Libraryless. Click here for Pure Java version (11379L/65K).

1  
static int bwIntegralImage_sumRect(BWIntegralImage img, int x1, int y1, int x2, int y2) {
2  
  int bottomLeft  = img.getIIValue(x1-1, y2-1);
3  
  int bottomRight = img.getIIValue(x2-1, y2-1);
4  
  int topLeft     = img.getIIValue(x1-1, y1-1);
5  
  int topRight    = img.getIIValue(x2-1, y1-1);
6  
  ret bottomRight+topLeft-topRight-bottomLeft;
7  
}
8  
9  
meta-for int in int, dbl {
10  
11  
  static int bwIntegralImage_sumRect(IBWIntegralImage img, int x1, int y1, int x2, int y2) {
12  
    int bottomLeft  = img.getIIValue(x1-1, y2-1);
13  
    int bottomRight = img.getIIValue(x2-1, y2-1);
14  
    int topLeft     = img.getIIValue(x1-1, y1-1);
15  
    int topRight    = img.getIIValue(x2-1, y1-1);
16  
    ret bottomRight+topLeft-topRight-bottomLeft;
17  
  }
18  
  
19  
}

Author comment

Began life as a copy of #1019591

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019596
Snippet name: bwIntegralImage_sumRect - sum of rectangle brightness over integral image
Eternal ID of this version: #1019596/6
Text MD5: 13b356e8d2932f0d7f407dff29d42293
Transpilation MD5: dee72c32145ba9668c9da4de4d94717d
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-03 18:35:57
Source code size: 728 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 360 / 501
Version history: 5 change(s)
Referenced in: [show references]