Skip to content

Commit 64d8950

Browse files
authored
update color filters for SV::DestionationMarkerDetector (#1118)
1 parent 65a4b4e commit 64d8950

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramComputer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
#include "Integrations/DiscordWebhook.h"
8989
#include "PokemonSV/Programs/TeraRaids/PokemonSV_JoinTracker.h"
9090
#include "PokemonSV/Inference/Boxes/PokemonSV_BoxDetection.h"
91+
#include "PokemonSV/Inference/Map/PokemonSV_DestinationMarkerDetector.h"
9192
#include "CommonFramework/Environment/Environment.h"
9293
#include "Common/Cpp/PrettyPrint.h"
9394
#include "Common/Qt/TimeQt.h"
@@ -173,10 +174,12 @@ TestProgramComputer_Descriptor::TestProgramComputer_Descriptor()
173174
{}
174175
TestProgramComputer::TestProgramComputer()
175176
: STATIC_TEXT("test text")
177+
, IMAGE_PATH(false, "Path to image for testing", LockMode::UNLOCK_WHILE_RUNNING, "default.png", "default.png")
176178
, SCREEN_WATCHER("Capture Box", 0, 0, 1, 1)
177179
, MAC_ADDRESS(LockMode::UNLOCK_WHILE_RUNNING, 6, nullptr)
178180
{
179181
PA_ADD_OPTION(STATIC_TEXT);
182+
PA_ADD_OPTION(IMAGE_PATH);
180183
// PA_ADD_OPTION(SCREEN_WATCHER);
181184
PA_ADD_OPTION(MAC_ADDRESS);
182185
}
@@ -362,7 +365,16 @@ void TestProgramComputer::program(ProgramEnvironment& env, CancellableScope& sco
362365
// cout << random_u32(100, 115) << endl;
363366

364367

368+
#if 0
369+
ImageRGB32 image(IMAGE_PATH);
370+
DestinationMarkerDetector detector(COLOR_CYAN, {0.717, 0.165, 0.03, 0.061}, false);
371+
cout << detector.detect(image) << endl;
372+
#endif
373+
374+
375+
#if 0
365376
stress_test(logger, scope);
377+
#endif
366378

367379

368380

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramComputer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define PokemonAutomation_Computer_TestProgram_H
99

1010
#include "Common/Cpp/Options/StaticTextOption.h"
11+
#include "Common/Cpp/Options/StringOption.h"
1112
#include "Common/Cpp/Options/MacAddressOption.h"
1213
#include "CommonTools/Options/ScreenWatchOption.h"
1314
#include "ComputerPrograms/ComputerProgram.h"
@@ -30,6 +31,7 @@ class TestProgramComputer : public ComputerProgramInstance{
3031

3132
private:
3233
StaticTextOption STATIC_TEXT;
34+
StringOption IMAGE_PATH;
3335
ScreenWatchOption SCREEN_WATCHER;
3436
MacAddressCell MAC_ADDRESS;
3537
};

SerialPrograms/Source/PokemonSV/Inference/Map/PokemonSV_DestinationMarkerDetector.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DestinationMarkerMatcher : public ImageMatch::WaterfillTemplateMatcher{
2323
public:
2424

2525
DestinationMarkerMatcher() : WaterfillTemplateMatcher(
26-
"PokemonSV/Map/DestinationMarkerIcon-Template.png", Color(180,80,0), Color(255, 130, 50), 50
26+
"PokemonSV/Map/DestinationMarkerIcon-Template.png", Color(180,80,0), Color(255, 130, 70), 50
2727
){
2828
m_aspect_ratio_lower = 0.8;
2929
m_aspect_ratio_upper = 1.2;
@@ -42,7 +42,7 @@ class DestinationMarkerYellowMatcher : public ImageMatch::WaterfillTemplateMatch
4242
public:
4343

4444
DestinationMarkerYellowMatcher() : WaterfillTemplateMatcher(
45-
"PokemonSV/Map/DestinationMarkerIcon-Yellow.png", Color(180,80,0), Color(255, 200, 50), 50
45+
"PokemonSV/Map/DestinationMarkerIcon-Yellow.png", Color(180,80,0), Color(255, 200, 70), 50
4646
){
4747
m_aspect_ratio_lower = 0.8;
4848
m_aspect_ratio_upper = 1.2;
@@ -82,7 +82,7 @@ bool DestinationMarkerDetector::detect(const ImageViewRGB32& screen){
8282

8383
std::vector<ImageFloatBox> DestinationMarkerDetector::detect_all(const ImageViewRGB32& screen) const{
8484
const std::vector<std::pair<uint32_t, uint32_t>> filters = {
85-
{combine_rgb(180, 80, 0), combine_rgb(255, 130, 50)},
85+
{combine_rgb(180, 80, 0), combine_rgb(255, 130, 70)},
8686

8787
};
8888

@@ -119,7 +119,7 @@ std::vector<ImageFloatBox> DestinationMarkerDetector::detect_all(const ImageView
119119

120120
std::vector<ImageFloatBox> DestinationMarkerDetector::detect_all_yellow(const ImageViewRGB32& screen) const{
121121
const std::vector<std::pair<uint32_t, uint32_t>> filters = {
122-
{combine_rgb(180, 100, 0), combine_rgb(255, 190, 50)}, // to detect the marker within the minimap, when the radar beam is covering the marker
122+
{combine_rgb(180, 100, 0), combine_rgb(255, 190, 70)}, // to detect the marker within the minimap, when the radar beam is covering the marker
123123
};
124124

125125

0 commit comments

Comments
 (0)