1 | sclass ChessPieceRecognizer { |
2 | LPair<BWImage, S> images; |
3 | |
4 | void load { |
5 | long time = sysNow(); |
6 | images = mapPairsA loadBWImage(chessPieceImagesFromAGIBlue()); |
7 | done2("Loading " + n2(images, "piece image"), time); |
8 | } |
9 | |
10 | Pair<S, Double> recognize(BufferedImage img) { |
11 | ret recognize(BWImage(img)); |
12 | } |
13 | |
14 | Pair<S, Double> recognize(BWImage img) { |
15 | new Best<S> best; |
16 | for (unpair BWImage pieceImg, S piece : images) { |
17 | best.put(piece, bwImageSimilarityResized_ignoreRatioMismatch(img, pieceImg, best.score())); |
18 | } |
19 | ret best.pair(); |
20 | } |
21 | } |
Began life as a copy of #1024689
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: | #1024744 |
Snippet name: | ChessPieceRecognizer (old) |
Eternal ID of this version: | #1024744/1 |
Text MD5: | e7e0ac99fbb1cee40705d7d30c46c40b |
Author: | stefan |
Category: | javax / image recognition |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-24 15:56:47 |
Source code size: | 590 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 182 / 208 |
Referenced in: | [show references] |