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

10
LINES

< > BotCompany Repo | #1024803 // chessOCR_adaptSegmenterToMainImageColors

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

Libraryless. Click here for Pure Java version (5218L/33K).

static ItIt<ParameterizedSegmenter> chessOCR_adaptSegmenterToMainImageColors(BufferedImage img, ParameterizedSegmenter baseSegmenter, O... _) {
  optPar int maxColors = 10; // try 10 top colors
  MultiSet<S> histogram = histogram332(img);
  ret takeFirstI(maxColors, mapI(histogram.highestFirst(),
    color -> {
      ParameterizedSegmenter seg = shallowNonTransientClone(baseSegmenter);
      seg.distanceFromColor(color332toRGB(color));
      ret seg;
    }));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1024803
Snippet name: chessOCR_adaptSegmenterToMainImageColors
Eternal ID of this version: #1024803/7
Text MD5: 6127154ec2f3a7ddbe5202b4f2f414e8
Transpilation MD5: f10b93e1ec776f5b7bc587f73710c3a8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-26 13:09:51
Source code size: 474 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 282 / 388
Version history: 6 change(s)
Referenced in: [show references]