mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
fix.修复一些浮点数溢出导致的异常
This commit is contained in:
@@ -108,7 +108,7 @@ bool asst::MatchImageAnalyzer::match_templ(const cv::Mat templ)
|
||||
Log.trace("match_templ |", m_templ_name, "score:", max_val, "rect:", rect.to_string(), "roi:", m_roi.to_string());
|
||||
}
|
||||
|
||||
if (max_val >= m_templ_thres) {
|
||||
if (m_templ_thres <= max_val && max_val < 2.0) {
|
||||
m_result = { max_val, rect };
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ bool asst::MultiMatchImageAnalyzer::multi_match_templ(const cv::Mat templ)
|
||||
for (int i = 0; i != matched.rows; ++i) {
|
||||
for (int j = 0; j != matched.cols; ++j) {
|
||||
auto value = matched.at<float>(i, j);
|
||||
if (value >= m_templ_thres) {
|
||||
if (m_templ_thres <= value && value < 2.0) {
|
||||
Rect rect(j + m_roi.x, i + m_roi.y, templ.cols, templ.rows);
|
||||
bool need_push = true;
|
||||
// 如果有两个点离得太近,只取里面得分高的那个
|
||||
|
||||
@@ -97,6 +97,9 @@ std::vector<asst::TextRect> asst::OcrPack::recognize(const cv::Mat image, const
|
||||
}
|
||||
std::string text(*(m_strs_buffer + i));
|
||||
float score = *(m_scores_buffer + i);
|
||||
if (score > 2.0) {
|
||||
score = 0;
|
||||
}
|
||||
|
||||
TextRect tr{ score, rect, text };
|
||||
#ifdef ASST_DEBUG
|
||||
|
||||
Reference in New Issue
Block a user