// include #1005686 // PIF Classes v2 sclass CorrelateClips { S src1 = "#1005715", src2 = "#1005721"; int maxTotal = 10; Concepts in1, in2; Map<Pair<Clip, Clip>, MultiSet<Pt>> correlations = new HashMap; L<Clip> clips1, clips2; *() {} *(S *src1, S *src2) {} void load() { in1 = new Concepts(src1).load(); in2 = new Concepts(src2).load(); in1.deleteAll(Found); in2.deleteAll(Found); print("Loaded from:"); printIndent(joinLines(snippetsWithTitles(ll(src1, src2)))); print("Total concepts: " + in1.countConcepts() + ", " + in2.countConcepts()); clips1 = goodClips(in1); clips2 = goodClips(in2); print("Good clips: " + l(clips1) + ", " + l(clips2)); } void processScreenshot(Screenshot t) { ImageFinder finder = new ImageFinder(t, concatLists(clips1, clips2)); finder.maxTotal = maxTotal; finder.run(); L<Found> found1 = findBackRefs(clips1, Found); L<Found> found2 = findBackRefs(clips2, Found); deleteAll(Found); print("#found = " + l(found1) + " / " + l(found2)); printFound(found1); print(); printFound(found2); print(); for (Found a : found1) for (Found b : found2) correlate(correlations, a, b); for (Pair<Clip, Clip> key : correlations.keySet()) { print(key.a.id + " / " + key.b.id + " => " + struct(correlations.get(key))); } } void correlate(Map<Pair<Clip, Clip>, MultiSet<Pt>> correlations, Found a, Found b) { Pair key = new Pair(a.clip!, b.clip!); Pt p = new Pt(b.fi.r.x-a.fi.r.x, b.fi.r.y-a.fi.r.y); MultiSet<Pt> ms = correlations.get(key); if (ms == null) correlations.put(key, ms = new MultiSet); ms.add(p); } void printFound(L<Found> l) { for (Found f : l) print(f.fi.r + " " + f.clip->id); } L<Clip> goodClips(Concepts in) { ret [Clip c in in.list(Clip) | !swic(c.description, "bad")]; } }
Began life as a copy of #1005722
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005723 |
Snippet name: | class CorrelateClips |
Eternal ID of this version: | #1005723/1 |
Text MD5: | 74741ca49653541c2ea8d201476815bc |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-04 20:27:59 |
Source code size: | 2004 bytes / 68 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 468 / 685 |
Referenced in: | [show references] |