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

13
LINES

< > BotCompany Repo | #1020686 // colorCount332_max - count different 3-3-2 colors in image with max value

JavaX fragment (include)

static int colorCount332_max(int max, BufferedImage img) {
  if (max == 0) ret 0;
  int w = img.getWidth(), h = img.getHeight(), n = 0;
  new BitSet bs;
  for y to h: for x to w: {
    int idx = ubyteToInt(to332(img.getRGB(x, y)));
    if (!bs.get(idx)) {
      if (++n >= max) ret n;
      setBit(bs, idx);
    }
  }
  ret n;
}

Author comment

Began life as a copy of #1019830

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1020686
Snippet name: colorCount332_max - count different 3-3-2 colors in image with max value
Eternal ID of this version: #1020686/2
Text MD5: 687acb41660c49f0c8883d8f38ea971d
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:58:19
Source code size: 340 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 272 / 319
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1023026 - dominant332color