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

16
LINES

< > BotCompany Repo | #1031291 // storeIntegralImageProgressively [dev.]

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

Transpiled version (6222L) is out of date.

1  
// Limitation: img must be square with w/h a power of 2
2  
svoid storeIntegralImageProgressively(IntegralImage img, IVF2<Pt, Int> store) {
3  
  assertSquare(img);
4  
  int w = img.getWidth();
5  
  assertPowerOfTwo(w);
6  
  
7  
  int size = w;
8  
  new Set<Pt> seen;
9  
  while ping (size > 0) {
10  
    for (int y = 0; y < w; y += size)
11  
      for (int x = 0; x < w; x += size)
12  
        if (seen.add(pt(x, y))) // TODO: can't you calculate this?!
13  
          store.get(pt(x, y), img.get(x, y));
14  
    size >>= 1;
15  
  }
16  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031291
Snippet name: storeIntegralImageProgressively [dev.]
Eternal ID of this version: #1031291/6
Text MD5: 4b2bda488ecc10eaf5b209ab7de1036f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-03 05:37:39
Source code size: 499 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 140 / 222
Version history: 5 change(s)
Referenced in: [show references]