diff --git a/resource/tasks.json b/resource/tasks.json index 5a7fbe1505..93ca6bd26e 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -6505,7 +6505,7 @@ "roi": [ 62, 89, - 45, + 43, 23 ], "maskRange": [ diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index 98cb3fd72e..9ab6a6249f 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -368,7 +368,7 @@ void asst::Controller::clear_info() noexcept m_width = 0; m_height = 0; m_control_scale = 1.0; - m_scale_size = decltype(m_scale_size)(); + m_scale_size = { WindowWidthDefault, WindowHeightDefault }; } int asst::Controller::push_cmd(const std::string& cmd) @@ -395,7 +395,7 @@ bool asst::Controller::screencap() //if (true) { // std::unique_lock image_lock(m_image_mutex); - // m_cache_image = cv::imread("err.png"); + // m_cache_image = cv::imread("err/1.png"); // return true; //} diff --git a/src/MeoAssistant/Controller.h b/src/MeoAssistant/Controller.h index b446379ec9..47e2d117bb 100644 --- a/src/MeoAssistant/Controller.h +++ b/src/MeoAssistant/Controller.h @@ -127,7 +127,7 @@ namespace asst } m_adb; std::string m_uuid; - std::pair m_scale_size; + std::pair m_scale_size = { WindowWidthDefault, WindowHeightDefault }; double m_control_scale = 1.0; int m_width = 0; int m_height = 0; diff --git a/src/MeoAssistant/StageDropsImageAnalyzer.cpp b/src/MeoAssistant/StageDropsImageAnalyzer.cpp index 473e7a767a..5e20ae6172 100644 --- a/src/MeoAssistant/StageDropsImageAnalyzer.cpp +++ b/src/MeoAssistant/StageDropsImageAnalyzer.cpp @@ -233,7 +233,7 @@ bool asst::StageDropsImageAnalyzer::analyze_baseline() cv::inRange(gray, task_ptr->mask_range.first, task_ptr->mask_range.second, bin); cv::Rect bounding_rect = cv::boundingRect(bin); - cv::Mat bounding = bin(bounding_rect); + cv::Mat bounding = gray(bounding_rect); int x_offset = task_ptr->roi.x + bounding_rect.x; int y_offset = task_ptr->roi.y + bounding_rect.y; @@ -246,8 +246,12 @@ bool asst::StageDropsImageAnalyzer::analyze_baseline() int spacing = 0; // split + int threshold = task_ptr->mask_range.first; + uchar pre_value = 0; for (int i = 0; i < bounding.cols; ++i) { - bool is_white = bounding.at(0, i); + uchar value = bounding.at(0, i); + bool is_white = value > threshold && pre_value - value < threshold; + pre_value = value; if (in && !is_white) { in = false;