static Pair chessOCR_demoTwoStageRecognizer(BufferedImage img) { replace PS with ParameterizedSegmenter. ImageSurface is = showImage(img); PS seg1 = parameterizedSegmenterFromAGIBlue("find chess board #4 #1"); Iterator seg2 = chessOCR_varySegmenterGain(seg1); Iterator seg3 = nestedIterator(seg2, func(PS seg) -> Iterator { chessOCR_adaptSegmenterToMainImageColors(img, seg, maxColors := 4) }); ChessOCR_TwoStageRecognizer rec = new(chessOCR_pieceRecognizer(), img, seg3); rec.verbose(true); new Var last; while ping (rec.step()) if (setVar_trueIfChanged(last, rec.bestBoardLocation())) overlaySelectionsOnImageSurface(is, ll(last!)); print(rec.best); ret rec!; }