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

15
LINES

< > BotCompany Repo | #1019830 // colorCount332 - count different 3-3-2 colors in image

JavaX fragment (include)

1  
static int colorCount332(BufferedImage img) {
2  
  int w = img.getWidth(), h = img.getHeight();
3  
  new BitSet bs;
4  
  for y to h: for x to w:
5  
    setBit(bs, ubyteToInt(to332(img.getRGB(x, y))));
6  
  ret bitCount(bs);
7  
}
8  
9  
static int colorCount332(RGBImage img) {
10  
  int w = img.w(), h = img.h();
11  
  new BitSet bs;
12  
  for y to h: for x to w:
13  
    setBit(bs, ubyteToInt(to332(img.getInt(x, y))));
14  
  ret bitCount(bs);
15  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019830
Snippet name: colorCount332 - count different 3-3-2 colors in image
Eternal ID of this version: #1019830/4
Text MD5: e7c4c1c110478f222833d43447b4083a
Author: stefan
Category: javax / image analysis
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-30 21:15:02
Source code size: 416 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 317 / 362
Version history: 3 change(s)
Referenced in: [show references]