diff --git a/source/MaaFramework/Task/Recognizer.cpp b/source/MaaFramework/Task/Recognizer.cpp index dff972986..96a171deb 100644 --- a/source/MaaFramework/Task/Recognizer.cpp +++ b/source/MaaFramework/Task/Recognizer.cpp @@ -87,7 +87,8 @@ std::optional Recognizer::template_match(const cv::Mat& imag return std::nullopt; } - Matcher matcher(inst_, image); + Matcher matcher; + matcher.set_image(image); matcher.set_name(name); matcher.set_param(param); matcher.set_cache(cache); @@ -126,7 +127,8 @@ std::optional Recognizer::ocr(const cv::Mat& image, const MA return std::nullopt; } - OCRer ocrer(inst_, image); + OCRer ocrer; + ocrer.set_image(image); ocrer.set_name(name); ocrer.set_param(param); ocrer.set_cache(cache); @@ -163,7 +165,8 @@ std::optional Recognizer::classify(const cv::Mat& image, return std::nullopt; } - Classifier classifier(inst_, image); + Classifier classifier; + classifier.set_image(image); classifier.set_name(name); classifier.set_param(param); @@ -193,7 +196,8 @@ std::optional Recognizer::detect(const cv::Mat& image, const return std::nullopt; } - Detector detector(inst_, image); + Detector detector; + detector.set_image(image); detector.set_name(name); detector.set_param(param); diff --git a/source/MaaFramework/Vision/CustomRecognizer.cpp b/source/MaaFramework/Vision/CustomRecognizer.cpp index cf5f2d27a..f785d23aa 100644 --- a/source/MaaFramework/Vision/CustomRecognizer.cpp +++ b/source/MaaFramework/Vision/CustomRecognizer.cpp @@ -10,7 +10,7 @@ MAA_VISION_NS_BEGIN CustomRecognizer::CustomRecognizer(MaaCustomRecognizerHandle handle, InstanceInternalAPI* inst) - : VisionBase(nullptr), recognizer_(handle), inst_(inst) + : VisionBase(), recognizer_(handle), inst_(inst) {} CustomRecognizer::ResultsVec CustomRecognizer::analyze() const diff --git a/source/MaaFramework/Vision/CustomRecognizer.h b/source/MaaFramework/Vision/CustomRecognizer.h index 1c5868d4a..492ecd031 100644 --- a/source/MaaFramework/Vision/CustomRecognizer.h +++ b/source/MaaFramework/Vision/CustomRecognizer.h @@ -4,6 +4,7 @@ #include +#include "Instance/InstanceInternalAPI.hpp" #include "MaaFramework/MaaCustomRecognizer.h" #include "VisionBase.h" #include "VisionTypes.h" diff --git a/source/MaaFramework/Vision/VisionBase.cpp b/source/MaaFramework/Vision/VisionBase.cpp index 3c2c8c67c..7fd0babea 100644 --- a/source/MaaFramework/Vision/VisionBase.cpp +++ b/source/MaaFramework/Vision/VisionBase.cpp @@ -11,13 +11,6 @@ MAA_VISION_NS_BEGIN -VisionBase::VisionBase(InstanceInternalAPI* inst) : inst_(inst) {} - -VisionBase::VisionBase(InstanceInternalAPI* inst, const cv::Mat& image) : inst_(inst) -{ - set_image(image); -} - void VisionBase::set_image(const cv::Mat& image) { image_ = image; diff --git a/source/MaaFramework/Vision/VisionBase.h b/source/MaaFramework/Vision/VisionBase.h index f07d22a37..695545ed6 100644 --- a/source/MaaFramework/Vision/VisionBase.h +++ b/source/MaaFramework/Vision/VisionBase.h @@ -1,7 +1,6 @@ #pragma once #include "Conf/Conf.h" -#include "Instance/InstanceInternalAPI.hpp" #include "Utils/NoWarningCVMat.hpp" MAA_VISION_NS_BEGIN @@ -9,9 +8,6 @@ MAA_VISION_NS_BEGIN class VisionBase { public: - VisionBase(InstanceInternalAPI* inst); - VisionBase(InstanceInternalAPI* inst, const cv::Mat& image); - void set_image(const cv::Mat& image); void set_cache(const cv::Rect& cache); void set_name(std::string name); @@ -20,8 +16,6 @@ class VisionBase cv::Mat image_with_roi(const cv::Rect& roi) const; protected: - MAA_RES_NS::ResourceMgr* resource() const { return inst_ ? inst_->inter_resource() : nullptr; } - cv::Mat draw_roi(const cv::Rect& roi) const; void save_image(const cv::Mat& image) const; @@ -30,8 +24,6 @@ class VisionBase cv::Rect cache_ {}; std::string name_; - InstanceInternalAPI* inst_ = nullptr; - bool debug_draw_ = false; bool save_draw_ = false;