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

13
LINES

< > BotCompany Repo | #1027257 // dominant332webColorNamesWithPercentage

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

Libraryless. Click here for Pure Java version (5740L/39K).

// returns pairs (color name, percentage of image)
static LPair<S, Double> dominant332webColorNamesWithPercentage(RGBImage img) {
  new Map<S, Double> map;
  for (Pair<Int, Double> p : dominant332colorsWithPercentage(img)) {
    S col = webColorNameFrom332(p.a);
    map.put(col, or(map.get(col), 0.0) + p.b);
  }
  ret sortByPairBDesc(mapToPairs(map));
}

static LPair<S, Double> dominant332webColorNamesWithPercentage(BufferedImage img) {
  ret dominant332webColorNamesWithPercentage(RGBImage(img));
}

Author comment

Began life as a copy of #1027256

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027257
Snippet name: dominant332webColorNamesWithPercentage
Eternal ID of this version: #1027257/3
Text MD5: cf6a6370108b7fa8a24578fa4151abaf
Transpilation MD5: bd503b4f05ade8d8bcf79b7ef963e746
Author: stefan
Category: javax / image analysis
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-26 21:05:34
Source code size: 515 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 101 / 154
Version history: 2 change(s)
Referenced in: [show references]