Skip to content

Commit c88bd3e

Browse files
author
Gin
committed
tighter area threshold
1 parent 31d5428 commit c88bd3e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_DirectionArrowDetector.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,14 @@ bool DirectionArrowDetector::detect(const ImageViewRGB32& screen){
9292
double screen_rel_size = (screen.height() / 1080.0);
9393
double screen_rel_size_2 = screen_rel_size * screen_rel_size;
9494

95-
double min_area_1080p = 200.0;
96-
size_t min_area = size_t(screen_rel_size_2 * min_area_1080p);
97-
if (points.size() < min_area){
95+
// For 1080P screenshots, the arrow takes about 300 pixels
96+
double min_area_1080p = 250.0, max_area_1080p = 350.0;
97+
const size_t min_area = size_t(screen_rel_size_2 * min_area_1080p);
98+
const size_t max_area = size_t(screen_rel_size_2 * max_area_1080p);
99+
100+
if (points.size() < min_area || points.size() > max_area){
98101
#ifdef DEBUG_DIRECTION_ARROW
99-
cout << "Not enough cyan pixels found: " << points.size() << " (minimum: " << min_area << ")" << endl;
102+
cout << "Not cyan pixel count out of range: " << points.size() << " (" << min_area << "," << max_area << ")" << endl;
100103
#endif
101104
return false;
102105
}

0 commit comments

Comments
 (0)