Libraryless. Click here for Pure Java version (3620L/22K).
1 | sclass AOA_CompareImagesToProtos implements Steppable { |
2 | new Map<S, BWImage> images; |
3 | new Map<S, BWImage> protos; |
4 | |
5 | new AllOnAll<S> allOnAll; |
6 | new Map<S, Scored<S>> bestProtoForImage; |
7 | new Map<S, Scored<S>> bestImageForProto; |
8 | |
9 | void addImages(Map<S, BWImage> images) { |
10 | putAll(this.images, images); |
11 | for (S id : keys(images)) allOnAll.newA(id); |
12 | } |
13 | |
14 | void addProtos(Map<S, BWImage> protos) { |
15 | putAll(this.protos, protos); |
16 | for (S id : keys(protos)) allOnAll.newB(id); |
17 | } |
18 | |
19 | public bool step() { |
20 | PairS p = allOnAll.next(); |
21 | if (p == null) false; |
22 | BWImage img1 = images.get(p.a); |
23 | BWImage img2 = protos.get(p.b); |
24 | Scored<S> bestProto = bestProtoForImage.get(p.a); |
25 | float sim = bwImageSimilarityResized(img1, img2, score(bestProto)); |
26 | scoredMapPut(bestProtoForImage, p.a, p.b, sim); |
27 | scoredMapPut(bestImageForProto, p.b, p.a, sim); |
28 | true; |
29 | } |
30 | |
31 | Map<S, Double> scoresForProtos() { |
32 | ret mapValues doubleScore(bestImageForProto); |
33 | } |
34 | } |
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: | #1024988 |
Snippet name: | AOA_CompareImagesToProtos |
Eternal ID of this version: | #1024988/8 |
Text MD5: | 5878cca9b168ee38cbb375085117632c |
Transpilation MD5: | 2a758fbb17634ab7c38fc9a0b829cb2a |
Author: | stefan |
Category: | javax / visual bots |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-31 23:47:40 |
Source code size: | 1024 bytes / 34 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 256 / 684 |
Version history: | 7 change(s) |
Referenced in: | [show references] |