Files
MaaAssistantArknights/src/MaaCore/Vision/Config/MatcherConfig.h
MistEO 42762bfbb7 feat: 支持多模板匹配,任一达到阈值即视为命中
MultiMatcher 暂不支持,仅使用第一个模板
2023-10-01 13:54:56 +08:00

46 lines
1.2 KiB
C++

#pragma once
#include "Common/AsstTypes.h"
#include "Utils/NoWarningCVMat.h"
#include <variant>
namespace asst
{
class MatcherConfig
{
public:
struct Params
{
std::vector<std::variant<std::string, cv::Mat>> templs;
std::vector<double> templ_thres;
std::pair<int, int> mask_range;
bool mask_with_src = false;
bool mask_with_close = false;
};
public:
MatcherConfig() = default;
virtual ~MatcherConfig() = default;
void set_params(Params params);
void set_task_info(const std::shared_ptr<TaskInfo>& task_ptr);
void set_task_info(const std::string& task_name);
void set_templ(std::variant<std::string, cv::Mat> templ);
// void set_templ(std::vector<std::variant<std::string, cv::Mat>> templs);
void set_threshold(double templ_thres) noexcept;
void set_threshold(std::vector<double> templ_thres) noexcept;
void set_mask_range(int lower, int upper, bool mask_with_src = false, bool mask_with_close = false);
protected:
virtual void _set_roi(const Rect& roi) = 0;
void _set_task_info(MatchTaskInfo task_info);
protected:
Params m_params;
};
}