sclass ChessPieceRecognizer { LPair<BWImage, S> images; void load { long time = sysNow(); images = mapPairsA loadBWImage(chessPieceImagesFromAGIBlue()); done2("Loading " + n2(images, "piece image"), time); } Pair<S, Double> recognize(BufferedImage img) { ret recognize(BWImage(img)); } Pair<S, Double> recognize(BWImage img) { new Best<S> best; for (unpair BWImage pieceImg, S piece : images) { best.put(piece, bwImageSimilarityResized_ignoreRatioMismatch(img, pieceImg, best.score())); } ret best.pair(); } }
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: | 180 / 206 |
Referenced in: | [show references] |