sclass MultiLevelRecognizer3 // how big do we think the prototype is in the whole image // (percentage by height) L<Double> assumedPrototypeHeightPercentages = ll(70.0, 70.0/sqrt(2), 35.0, 35.0/sqrt(2), 17.0); // widths to scale camera image to transient L<Int> widths = ll(32, 64, 128); BWIntegralImage integralInputImage; new Map<Int, BWIntegralImage> prototypeImages; // key = height new Map<Int, IBWIntegralImage> integralImages; // key = width new Map<Int, ByPrototype> byPrototypeMap; class ByPrototype { } // constructors, addPrototype functions *() {} *(File imgFile) { integralInputImage = loadBWIntegralImage(imgFile); } void addPrototype(BufferedImage img) { prototypeImages.add(bwIntegralImage(img)); } void addPrototype(File imgFile) { addPrototype(loadImage2(imgFile)); } void addPrototypes(Iterable l) { fOr (O o : l) call(this, 'addPrototype, img); } void search(assumedPrototypeHeightPercentage, IVF1<Rect> onGuess) { img16 = scaleImageToWidth(inputImage, 16); int assumedPrototypeHeight16 = calculate(percentage, img16); prototype16 = resizeImageToHeight(prototype, assumedPrototypeHeight16); img32 = scaleImageToWidth(inputImage, 32); etc. double minSimilarity = 0.5; L<Scored<Rect>> found16 = bwRawImageSearch(img16, prototype16, minSimilarity); sortScoredDesc_inPlace(found16); candidates16 = getVars(takeFirst(5, found16)); for (Rect candidate16 : candidates16) { candidate32 = scaleRect(candidate16, 2); } } }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027268 |
Snippet name: | MultiLevelRecognizer3 [dev.] |
Eternal ID of this version: | #1027268/1 |
Text MD5: | e69a39658af93369ba44dab8cfac1972 |
Author: | stefan |
Category: | javax / image recognition |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-28 15:08:22 |
Source code size: | 1622 bytes / 51 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 177 / 199 |
Referenced in: | -