mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 02:55:38 +08:00
perf: 优化mat拷贝行为
This commit is contained in:
@@ -24,7 +24,7 @@ asst::AbstractImageAnalyzer::AbstractImageAnalyzer(const cv::Mat& image, const R
|
||||
#endif
|
||||
{}
|
||||
|
||||
void asst::AbstractImageAnalyzer::set_image(const cv::Mat image)
|
||||
void asst::AbstractImageAnalyzer::set_image(const cv::Mat& image)
|
||||
{
|
||||
m_image = image;
|
||||
#ifdef ASST_DEBUG
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace asst
|
||||
AbstractImageAnalyzer(AbstractImageAnalyzer&&) = delete;
|
||||
virtual ~AbstractImageAnalyzer() = default;
|
||||
|
||||
virtual void set_image(const cv::Mat image);
|
||||
virtual void set_image(const cv::Mat& image);
|
||||
virtual void set_roi(const Rect& roi) noexcept;
|
||||
|
||||
virtual bool analyze() = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ asst::OcrWithFlagTemplImageAnalyzer::OcrWithFlagTemplImageAnalyzer(const cv::Mat
|
||||
: OcrWithPreprocessImageAnalyzer(image, roi), m_multi_match_image_analyzer(image, roi)
|
||||
{}
|
||||
|
||||
void asst::OcrWithFlagTemplImageAnalyzer::set_image(const cv::Mat image)
|
||||
void asst::OcrWithFlagTemplImageAnalyzer::set_image(const cv::Mat& image)
|
||||
{
|
||||
OcrWithPreprocessImageAnalyzer::set_image(image);
|
||||
m_multi_match_image_analyzer.set_image(image);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace asst
|
||||
OcrWithFlagTemplImageAnalyzer(const cv::Mat& image, const Rect& roi);
|
||||
virtual ~OcrWithFlagTemplImageAnalyzer() override = default;
|
||||
|
||||
virtual void set_image(const cv::Mat image) override;
|
||||
virtual void set_image(const cv::Mat& image) override;
|
||||
virtual void set_roi(const Rect& roi) noexcept override;
|
||||
|
||||
virtual bool analyze() override;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace asst
|
||||
public:
|
||||
using AbstractImageAnalyzer::AbstractImageAnalyzer;
|
||||
virtual ~InfrastClueVacancyImageAnalyzer() override = default;
|
||||
InfrastClueVacancyImageAnalyzer(const cv::Mat image, const Rect& roi) = delete;
|
||||
InfrastClueVacancyImageAnalyzer(const cv::Mat& image, const Rect& roi) = delete;
|
||||
|
||||
virtual bool analyze() override;
|
||||
static constexpr int MaxNumOfClue = 7;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace asst
|
||||
public:
|
||||
using AbstractImageAnalyzer::AbstractImageAnalyzer;
|
||||
virtual ~InfrastFacilityImageAnalyzer() override = default;
|
||||
InfrastFacilityImageAnalyzer(const cv::Mat image, const Rect& roi) = delete;
|
||||
InfrastFacilityImageAnalyzer(const cv::Mat& image, const Rect& roi) = delete;
|
||||
|
||||
virtual bool analyze() override;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace asst
|
||||
|
||||
using AbstractImageAnalyzer::AbstractImageAnalyzer;
|
||||
virtual ~InfrastOperImageAnalyzer() override = default;
|
||||
InfrastOperImageAnalyzer(const cv::Mat image, const Rect& roi) = delete;
|
||||
InfrastOperImageAnalyzer(const cv::Mat& image, const Rect& roi) = delete;
|
||||
|
||||
virtual bool analyze() override;
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ bool asst::ProcessTaskImageAnalyzer::analyze()
|
||||
return false;
|
||||
}
|
||||
|
||||
void asst::ProcessTaskImageAnalyzer::set_image(const cv::Mat image)
|
||||
void asst::ProcessTaskImageAnalyzer::set_image(const cv::Mat& image)
|
||||
{
|
||||
AbstractImageAnalyzer::set_image(image);
|
||||
reset();
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace asst
|
||||
{
|
||||
public:
|
||||
using AbstractImageAnalyzer::AbstractImageAnalyzer;
|
||||
ProcessTaskImageAnalyzer(const cv::Mat image, const Rect& roi) = delete;
|
||||
ProcessTaskImageAnalyzer(const cv::Mat& image, const Rect& roi) = delete;
|
||||
ProcessTaskImageAnalyzer(const cv::Mat& image, std::vector<std::string> tasks_name);
|
||||
virtual ~ProcessTaskImageAnalyzer() override;
|
||||
|
||||
virtual bool analyze() override;
|
||||
void set_image(const cv::Mat image);
|
||||
virtual void set_image(const cv::Mat& image) override;
|
||||
|
||||
void set_tasks(std::vector<std::string> tasks_name);
|
||||
void set_status(std::shared_ptr<RuntimeStatus> status) noexcept;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace asst
|
||||
{
|
||||
public:
|
||||
using AbstractImageAnalyzer::AbstractImageAnalyzer;
|
||||
RecruitImageAnalyzer(const cv::Mat image, const Rect& roi) = delete;
|
||||
RecruitImageAnalyzer(const cv::Mat& image, const Rect& roi) = delete;
|
||||
virtual ~RecruitImageAnalyzer() override = default;
|
||||
|
||||
virtual bool analyze() override;
|
||||
|
||||
@@ -56,7 +56,7 @@ int asst::CreditShoppingTask::credit_ocr()
|
||||
|
||||
bool asst::CreditShoppingTask::credit_shopping(bool white_list_enabled, bool credit_ocr_enabled)
|
||||
{
|
||||
const cv::Mat image = m_ctrler->get_image();
|
||||
const cv::Mat& image = m_ctrler->get_image();
|
||||
|
||||
CreditShopImageAnalyzer shop_analyzer(image);
|
||||
if (white_list_enabled) {
|
||||
|
||||
Reference in New Issue
Block a user