sclass ImageBuckets { float similarityThreshold = 0.99f; new LL<RGBImage> buckets; new Map<Int> duplicates; int images, totalDuplicates; void addImage(RGBImage pat) { new Best<Int> best; for i over buckets: { Pair<RGBImage, Float> p = rgbMostSimilarImage(pat, buckets.get(i), 0); best.put(i, p.b); if (p.b == 1) { // it's a duplicate ++images; ++totalDuplicates; duplicates.put(i, toInt(duplicates.get(i))+1); ret; } } ++images; if (best.score() < similarityThreshold) buckets.add(ll(pat)); // new bucket else buckets.get(best!).add(pat); } }
Began life as a copy of #1020130
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020188 |
Snippet name: | ImageBuckets |
Eternal ID of this version: | #1020188/6 |
Text MD5: | bab2477a2eee619addbfcf453111c455 |
Author: | stefan |
Category: | javax / image recognition |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-09 21:55:18 |
Source code size: | 673 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 379 / 878 |
Version history: | 5 change(s) |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |