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

15
LINES

< > BotCompany Repo | #1009128 // iiSumRect - sum of rectangle brightness over integral image

JavaX fragment (include)

1  
sbool iiSumRect_debug;
2  
3  
static double iiSumRect(double[][] ii, Rect r) {
4  
  if (r.y2() == 0 || r.x2() == 0) ret 0;
5  
  double bottomLeft = r.x == 0 ? 0 : ii[r.y2()-1][r.x-1];
6  
  double bottomRight = ii[r.y2()-1][r.x2()-1];
7  
  double topLeft = r.x == 0 || r.y == 0 ? 0 : ii[r.y-1][r.x-1];
8  
  double topRight = r.y == 0 ? 0 : ii[r.y-1][r.x2()-1];
9  
  double result = bottomRight+topLeft-topRight-bottomLeft;
10  
  if (iiSumRect_debug)
11  
    printVars(+topLeft, +topRight, +bottomLeft, +bottomRight, +result);
12  
  //ret bottomRight-topLeft-(topRight-topLeft)-(bottomLeft-topLeft);
13  
  //ret bottomRight+topLeft-(topRight+bottomLeft);
14  
  ret result;
15  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009128
Snippet name: iiSumRect - sum of rectangle brightness over integral image
Eternal ID of this version: #1009128/13
Text MD5: 2614d6b4f061e8905d9b071a020848f0
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-06 01:08:52
Source code size: 642 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 615 / 638
Version history: 12 change(s)
Referenced in: [show references]