Libraryless. Click here for Pure Java version (5873L/37K/126K).
1 | !752 |
2 | |
3 | concepts. |
4 | |
5 | !include #1005686 // PIF Classes v2 |
6 | |
7 | sS src1 = "#1005715", src2 = "#1005721"; |
8 | static int maxTotal = 10; |
9 | |
10 | static Map<Pair<Clip, Clip>, MultiSet<Pt>> correlations = new HashMap; |
11 | |
12 | p { |
13 | Concepts in1 = new Concepts(src1).load(); |
14 | Concepts in2 = new Concepts(src2).load(); |
15 | in1.deleteAll(Found); |
16 | in2.deleteAll(Found); |
17 | |
18 | print("Loaded from:"); |
19 | printIndent(joinLines(snippetsWithTitles(ll(src1, src2)))); |
20 | print("Total concepts: " + in1.countConcepts() + ", " + in2.countConcepts()); |
21 | L<Clip> clips1 = goodClips(in1), clips2 = goodClips(in2); |
22 | print("Good clips: " + l(clips1) + ", " + l(clips2)); |
23 | |
24 | while licensed { |
25 | TransientScreenshot t = new TransientScreenshot(shootScreen2()); |
26 | ImageFinder finder = new ImageFinder(t, concatLists(clips1, clips2)); |
27 | finder.maxTotal = maxTotal; |
28 | finder.run(); |
29 | |
30 | L<Found> found1 = findBackRefs(clips1, Found); |
31 | L<Found> found2 = findBackRefs(clips2, Found); |
32 | deleteAll(Found); |
33 | print("#found = " + l(found1) + " / " + l(found2)); |
34 | |
35 | printFound(found1); |
36 | print(); |
37 | printFound(found2); |
38 | print(); |
39 | |
40 | for (Found a : found1) |
41 | for (Found b : found2) |
42 | correlate(correlations, a, b); |
43 | |
44 | for (Pair<Clip, Clip> key : correlations.keySet()) { |
45 | print(key.a.id + " / " + key.b.id + " => " + struct(correlations.get(key))); |
46 | } |
47 | |
48 | sleepSeconds(5); |
49 | } |
50 | } |
51 | |
52 | svoid correlate(Map<Pair<Clip, Clip>, MultiSet<Pt>> correlations, Found a, Found b) { |
53 | Pair key = new Pair(a.clip!, b.clip!); |
54 | Pt p = new Pt(b.fi.r.x-a.fi.r.x, b.fi.r.y-a.fi.r.y); |
55 | MultiSet<Pt> ms = correlations.get(key); |
56 | if (ms == null) |
57 | correlations.put(key, ms = new MultiSet); |
58 | ms.add(p); |
59 | } |
60 | |
61 | svoid printFound(L<Found> l) { |
62 | for (Found f : l) |
63 | print(f.fi.r + " " + f.clip->id); |
64 | } |
65 | |
66 | static L<Clip> goodClips(Concepts in) { |
67 | ret [Clip c in in.list(Clip) | !swic(c.description, "bad")]; |
68 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005722 |
Snippet name: | Correlate clips from two programs [WORKS] |
Eternal ID of this version: | #1005722/1 |
Text MD5: | e12e41730218372efec534f672a2e9f0 |
Transpilation MD5: | 74cd272f7bb3fb51dd1675ac55706f21 |
Author: | stefan |
Category: | javax / gui / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-04 19:01:14 |
Source code size: | 1953 bytes / 68 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 483 / 597 |
Referenced in: | [show references] |