-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoMinimapDetector #500
Merged
Merged
NoMinimapDetector #500
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_NoMinimapDetector.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* No Minimap Detector | ||
* | ||
* From: https://github.com/PokemonAutomation/Arduino-Source | ||
* | ||
*/ | ||
|
||
#include "Kernels/Waterfill/Kernels_Waterfill_Session.h" | ||
#include "CommonFramework/Globals.h" | ||
#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" | ||
#include "CommonFramework/ImageMatch/ImageDiff.h" | ||
#include "CommonFramework/ImageMatch/ExactImageMatcher.h" | ||
#include "CommonFramework/ImageTools/BinaryImage_FilterRgb32.h" | ||
#include "CommonFramework/ImageTools/WaterfillUtilities.h" | ||
#include "CommonFramework/ImageMatch/WaterfillTemplateMatcher.h" | ||
#include "PokemonSV_NoMinimapDetector.h" | ||
|
||
//#include <iostream> | ||
//using std::cout; | ||
//using std::endl; | ||
|
||
namespace PokemonAutomation{ | ||
namespace NintendoSwitch{ | ||
namespace PokemonSV{ | ||
|
||
|
||
|
||
NoMinimapDetector::NoMinimapDetector(Logger& logger, Color color) | ||
: m_color(color) | ||
, m_ball(0.890, 0.800, 0.030, 0.060) | ||
, m_overworld(color) | ||
{} | ||
void NoMinimapDetector::make_overlays(VideoOverlaySet& items) const{ | ||
items.add(m_color, m_ball); | ||
} | ||
bool NoMinimapDetector::detect(const ImageViewRGB32& screen) const{ | ||
return !m_overworld.detect(screen); | ||
} | ||
|
||
|
||
|
||
|
||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_NoMinimapDetector.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* No Minimap Detector | ||
* | ||
* From: https://github.com/PokemonAutomation/Arduino-Source | ||
* | ||
*/ | ||
|
||
#ifndef PokemonAutomation_PokemonSV_NoMinimapDetector_H | ||
#define PokemonAutomation_PokemonSV_NoMinimapDetector_H | ||
|
||
#include "Common/Cpp/Color.h" | ||
#include "CommonFramework/ImageTools/ImageBoxes.h" | ||
#include "CommonFramework/VideoPipeline/VideoFeed.h" | ||
#include "CommonFramework/InferenceInfra/VisualInferenceCallback.h" | ||
#include "CommonFramework/Inference/VisualDetector.h" | ||
#include "PokemonSV_OverworldDetector.h" | ||
|
||
|
||
namespace PokemonAutomation{ | ||
namespace NintendoSwitch{ | ||
namespace PokemonSV{ | ||
|
||
// Detect that the minimap is not visible | ||
class NoMinimapDetector : public StaticScreenDetector{ | ||
public: | ||
NoMinimapDetector(Logger& logger, Color color = COLOR_RED); | ||
|
||
virtual void make_overlays(VideoOverlaySet& items) const override; | ||
virtual bool detect(const ImageViewRGB32& screen) const override; | ||
|
||
|
||
protected: | ||
const Color m_color; | ||
const ImageFloatBox m_ball; | ||
const OverworldDetector m_overworld; | ||
}; | ||
|
||
class NoMinimapWatcher : public DetectorToFinder<NoMinimapDetector>{ | ||
public: | ||
NoMinimapWatcher( | ||
Logger& logger, | ||
Color color = COLOR_RED, | ||
std::chrono::milliseconds hold_duration = std::chrono::milliseconds(5000) | ||
) | ||
: DetectorToFinder("GradientArrowWatcher", hold_duration, logger, color) | ||
{} | ||
|
||
}; | ||
|
||
|
||
} | ||
} | ||
} | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need
m_color
andm_ball
separately just for the overlay? Can't we makem_overworld
do the overlay directly?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted NoMinimapDetector's overlay to look slightly different than the Overworld detector's overlay. Overworld detector has 3 boxes in its overlay, while NoMinimapDetector's overlay is only the smallest inner box. This way, users can tell when we're looking or the Overworld, and when we're looking for no overworld.
I don't feel strongly about this though. If you prefer to use the Overworld's overlay, I can change it.