Libraryless. Click here for Pure Java version (2207L/14K).
sclass ChessOCR_BoardsFound { sclass ByFEN { double bestScore; Rect bestPosition; Set<Pair<Rect, Double>> boardPositions = synchroSet(); } Map<S, ByFEN> byFEN = synchroMap(); transient L onChange = synchroList(); // L<Runnable|voidfunc(S fen)> transient L onImprovedScore = synchroList(); // L<Runnable|voidfunc(S fen, Rect)> void add(ChessOCR_RecognizedBoard b) { if (b == null || b.fen == null) ret; ByFEN bf = getOrCreate ByFEN(byFEN, b.fen); bool change; if (b.rectInOriginalImage != null) if (bf.boardPositions.add(pair(b.rectInOriginalImage, b.score))) set change; if (b.score > bf.bestScore) { bf.bestScore = b.score; bf.bestPosition = b.rectInOriginalImage; pcallFAll(onImprovedScore, b.fen, bf.bestPosition); set change; } if (change) pcallFAll(onChange, b.fen); } }
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: | #1024884 |
Snippet name: | ChessOCR_BoardsFound |
Eternal ID of this version: | #1024884/10 |
Text MD5: | fda927817f51851b36721f5ebdaad411 |
Transpilation MD5: | 7e8e9d189962f1698d1e0782a16adcf9 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-28 22:58:48 |
Source code size: | 890 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 242 / 672 |
Version history: | 9 change(s) |
Referenced in: | [show references] |