-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add MenuOption to change the menu options/settings.
- Loading branch information
Showing
8 changed files
with
653 additions
and
0 deletions.
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
53 changes: 53 additions & 0 deletions
53
SerialPrograms/Source/PokemonSV/Inference/PokemonSV_MenuOptionReader.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,53 @@ | ||
/* Menu Option Reader | ||
* | ||
* From: https://github.com/PokemonAutomation/Arduino-Source | ||
* | ||
*/ | ||
|
||
#include <algorithm> | ||
#include "Common/Cpp/Containers/FixedLimitVector.tpp" | ||
#include "Common/Cpp/Concurrency/AsyncDispatcher.h" | ||
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" | ||
#include "CommonFramework/Exceptions/OperationFailedException.h" | ||
#include "CommonFramework/VideoPipeline/VideoFeed.h" | ||
#include "CommonFramework/Tools/ConsoleHandle.h" | ||
#include "PokemonSV_MenuOptionReader.h" | ||
|
||
#include "Common/Cpp/PrettyPrint.h" | ||
#include <iostream> | ||
using std::cout; | ||
using std::endl; | ||
|
||
namespace PokemonAutomation{ | ||
namespace NintendoSwitch{ | ||
namespace PokemonSV{ | ||
|
||
|
||
|
||
MenuOptionReader& MenuOptionReader::instance(){ | ||
static MenuOptionReader reader; | ||
return reader; | ||
} | ||
|
||
MenuOptionReader::MenuOptionReader() | ||
: SmallDictionaryMatcher("PokemonSV/MenuOptionsOCR.json") | ||
{} | ||
|
||
OCR::StringMatchResult MenuOptionReader::read_substring( | ||
Logger& logger, | ||
Language language, | ||
const ImageViewRGB32& image, | ||
const std::vector<OCR::TextColorRange>& text_color_ranges, | ||
double min_text_ratio, double max_text_ratio | ||
) const{ | ||
return match_substring_from_image_multifiltered( | ||
&logger, language, image, text_color_ranges, | ||
MAX_LOG10P, MAX_LOG10P_SPREAD, min_text_ratio, max_text_ratio | ||
); | ||
} | ||
|
||
|
||
|
||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
SerialPrograms/Source/PokemonSV/Inference/PokemonSV_MenuOptionReader.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,49 @@ | ||
/* Menu Option Reader | ||
* | ||
* From: https://github.com/PokemonAutomation/Arduino-Source | ||
* | ||
*/ | ||
|
||
#ifndef PokemonAutomation_PokemonSV_MenuOptionReader_H | ||
#define PokemonAutomation_PokemonSV_MenuOptionReader_H | ||
|
||
#include <map> | ||
#include <array> | ||
#include "Common/Cpp/Containers/FixedLimitVector.h" | ||
#include "CommonFramework/Language.h" | ||
#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" | ||
#include "CommonFramework/OCR/OCR_SmallDictionaryMatcher.h" | ||
#include "PokemonSV/Inference/Dialogs/PokemonSV_GradientArrowDetector.h" | ||
#include "PokemonSV/Programs/AutoStory/PokemonSV_MenuOptionDatabase.h" | ||
|
||
namespace PokemonAutomation{ | ||
class AsyncDispatcher; | ||
class ConsoleHandle; | ||
class BotBaseContext; | ||
namespace NintendoSwitch{ | ||
namespace PokemonSV{ | ||
|
||
class MenuOptionReader : public OCR::SmallDictionaryMatcher{ | ||
static constexpr double MAX_LOG10P = -1.30; | ||
static constexpr double MAX_LOG10P_SPREAD = 0.50; | ||
|
||
public: | ||
MenuOptionReader(); | ||
|
||
static MenuOptionReader& instance(); | ||
|
||
OCR::StringMatchResult read_substring( | ||
Logger& logger, | ||
Language language, | ||
const ImageViewRGB32& image, | ||
const std::vector<OCR::TextColorRange>& text_color_ranges, | ||
double min_text_ratio = 0.01, double max_text_ratio = 0.50 | ||
) const; | ||
}; | ||
|
||
|
||
|
||
} | ||
} | ||
} | ||
#endif |
Oops, something went wrong.