|
11 | 11 | #include "CommonTools/ImageMatch/ExactImageMatcher.h" |
12 | 12 | #include "NintendoSwitch2_BinarySliderDetector.h" |
13 | 13 |
|
| 14 | +//#include <iostream> |
| 15 | +//using std::cout; |
| 16 | +//using std::endl; |
| 17 | + |
14 | 18 | namespace PokemonAutomation{ |
15 | 19 | namespace NintendoSwitch{ |
16 | 20 |
|
@@ -57,23 +61,23 @@ std::vector<std::pair<bool, ImagePixelBox>> BinarySliderDetector::detect(const I |
57 | 61 | best_off_rmsd = std::min(best_off_rmsd, LIGHT_OFF_NOCURSOR.rmsd(cropped)); |
58 | 62 | best_off_rmsd = std::min(best_off_rmsd, DARK_OFF_CURSOR.rmsd(cropped)); |
59 | 63 | best_off_rmsd = std::min(best_off_rmsd, DARK_OFF_NOCURSOR.rmsd(cropped)); |
60 | | - if (best_off_rmsd < 40){ |
61 | | - ret.emplace_back(false, object); |
62 | | - continue; |
63 | | - } |
64 | 64 |
|
65 | 65 | double best_on_rmsd = 9999; |
66 | 66 | best_on_rmsd = std::min(best_on_rmsd, LIGHT_ON_CURSOR.rmsd(cropped)); |
67 | 67 | best_on_rmsd = std::min(best_on_rmsd, LIGHT_ON_NOCURSOR.rmsd(cropped)); |
68 | 68 | best_on_rmsd = std::min(best_on_rmsd, DARK_ON_CURSOR.rmsd(cropped)); |
69 | 69 | best_on_rmsd = std::min(best_on_rmsd, DARK_ON_NOCURSOR.rmsd(cropped)); |
70 | | - if (best_on_rmsd < 40){ |
71 | | - ret.emplace_back(true, object); |
72 | | - continue; |
73 | | - } |
74 | 70 |
|
75 | 71 | // cout << "best_off_rmsd = " << best_off_rmsd << endl; |
76 | 72 | // cout << "best_on_rmsd = " << best_on_rmsd << endl; |
| 73 | + |
| 74 | + bool on = best_on_rmsd < best_off_rmsd; |
| 75 | + double best = on ? best_on_rmsd : best_off_rmsd; |
| 76 | + |
| 77 | + if (best < 60){ |
| 78 | + ret.emplace_back(on, object); |
| 79 | + } |
| 80 | + |
77 | 81 | } |
78 | 82 |
|
79 | 83 | return ret; |
|
0 commit comments