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

21
LINES

< > BotCompany Repo | #1024819 // chessOCR_demoTwoStageRecognizer

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

Uses 108K of libraries. Click here for Pure Java version (15241L/108K).

static Pair<Rect, S> chessOCR_demoTwoStageRecognizer(BufferedImage img) {
  replace PS with ParameterizedSegmenter.
  
  ImageSurface is = showImage(img);

  PS seg1 = parameterizedSegmenterFromAGIBlue("find chess board #4 #1");
  Iterator<PS> seg2 = chessOCR_varySegmenterGain(seg1);
  Iterator<PS> seg3 = nestedIterator(seg2, func(PS seg) -> Iterator<PS> {
    chessOCR_adaptSegmenterToMainImageColors(img, seg, maxColors := 4)
  });
  
  ChessOCR_TwoStageRecognizer rec = new(chessOCR_pieceRecognizer(), img, seg3);
  rec.verbose(true);

  new Var<Rect> last;
  while ping (rec.step())
    if (setVar_trueIfChanged(last, rec.bestBoardLocation()))
      overlaySelectionsOnImageSurface(is, ll(last!));
  print(rec.best);
  ret rec!;
}

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: #1024819
Snippet name: chessOCR_demoTwoStageRecognizer
Eternal ID of this version: #1024819/2
Text MD5: f04e54e4c0816e82ee96d1e55fea11db
Transpilation MD5: e8da95c3e623946dc0d547b2200e2d89
Author: stefan
Category: javax / chess ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-26 13:35:45
Source code size: 756 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 188 / 263
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)