#pragma once #include class Matcher { private: cv::Mat templ; cv::Mat mask; int32_t posx = -1; int32_t posy = -1; static std::string pathbase; public: static void setPathBase(const std::string& pa); Matcher(const std::string& filename); Matcher(const cv::Mat& templ); ~Matcher(); // instead of searching for a match, just look at this position void setOffset(int32_t x, int32_t y); struct Match { bool doesMatch = false; int x = 0, y = 0; int width = 0; int height = 0; bool operator==(const Match&) const; bool operator!=(const Match&) const; }; Match match(const cv::Mat& img); private: Match matchAll(const cv::Mat& img); Match matchPos(const cv::Mat& img); // when the template has a alpha channel try to create a mask from that void maskFromTemplate(); };