|
| 1 | +/* Load Menu Detector |
| 2 | + * |
| 3 | + * From: https://github.com/PokemonAutomation/ |
| 4 | + * |
| 5 | + */ |
| 6 | + |
| 7 | +#include "CommonTools/Images/SolidColorTest.h" |
| 8 | +#include "CommonTools/Images/ImageFilter.h" |
| 9 | +#include "CommonFramework/ImageTools/ImageBoxes.h" |
| 10 | +#include "CommonFramework/ImageTypes/ImageRGB32.h" |
| 11 | +#include "CommonFramework/ImageTools/ImageStats.h" |
| 12 | +#include "CommonFramework/ImageTypes/ImageViewRGB32.h" |
| 13 | +#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" |
| 14 | +#include "CommonTools/Images/SolidColorTest.h" |
| 15 | +#include "CommonTools/Images/WaterfillUtilities.h" |
| 16 | +#include "CommonTools/ImageMatch/WaterfillTemplateMatcher.h" |
| 17 | +#include "CommonFramework/VideoPipeline/VideoOverlay.h" |
| 18 | +#include "PokemonFRLG_LoadMenuDetector.h" |
| 19 | + |
| 20 | +namespace PokemonAutomation{ |
| 21 | +namespace NintendoSwitch{ |
| 22 | +namespace PokemonFRLG{ |
| 23 | + |
| 24 | +LoadMenuDetector::LoadMenuDetector(Color color) |
| 25 | + : m_right_box(0.859, 0.023, 0.042, 0.925) |
| 26 | + , m_left_box(0.099, 0.022, 0.046, 0.926) |
| 27 | + , m_save_box(0.773, 0.062, 0.047, 0.072) |
| 28 | +{} |
| 29 | +void LoadMenuDetector::make_overlays(VideoOverlaySet& items) const{ |
| 30 | + items.add(COLOR_BLUE, m_right_box); |
| 31 | + items.add(COLOR_BLUE, m_left_box); |
| 32 | + items.add(COLOR_BLUE, m_save_box); |
| 33 | +} |
| 34 | +bool LoadMenuDetector::detect(const ImageViewRGB32& screen){ |
| 35 | + ImageViewRGB32 right_image = extract_box_reference(screen, m_right_box); |
| 36 | + ImageViewRGB32 left_image = extract_box_reference(screen, m_left_box); |
| 37 | + ImageViewRGB32 save_image = extract_box_reference(screen, m_save_box); |
| 38 | + |
| 39 | + if (is_solid(right_image, { 0.244, 0.282, 0.474 }) //blue |
| 40 | + && is_solid(left_image, { 0.244, 0.282, 0.474 }) //blue |
| 41 | + && is_solid(save_image, { 0.25, 0.38, 0.369 }) //white |
| 42 | + ){ |
| 43 | + return true; |
| 44 | + } |
| 45 | + return false; |
| 46 | +} |
| 47 | + |
| 48 | + |
| 49 | +} |
| 50 | +} |
| 51 | +} |
0 commit comments