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).

1  
// returns pairs (color name, percentage of image)
2  
static LPair<S, Double> dominant332webColorNamesWithPercentage(RGBImage img) {
3  
  new Map<S, Double> map;
4  
  for (Pair<Int, Double> p : dominant332colorsWithPercentage(img)) {
5  
    S col = webColorNameFrom332(p.a);
6  
    map.put(col, or(map.get(col), 0.0) + p.b);
7  
  }
8  
  ret sortByPairBDesc(mapToPairs(map));
9  
}
10  
11  
static LPair<S, Double> dominant332webColorNamesWithPercentage(BufferedImage img) {
12  
  ret dominant332webColorNamesWithPercentage(RGBImage(img));
13  
}

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: 162 / 240
Version history: 2 change(s)
Referenced in: [show references]