mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 18:01:26 +08:00
fix: 修复干员识别偶尔滑动失效提前结束的问题;并少存一点日志图
fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/4628
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "Utils/Ranges.hpp"
|
||||
|
||||
#include <future>
|
||||
|
||||
#include "Config/Miscellaneous/BattleDataConfig.h"
|
||||
#include "Config/TaskData.h"
|
||||
#include "Controller/Controller.h"
|
||||
@@ -9,7 +11,6 @@
|
||||
#include "Utils/Logger.hpp"
|
||||
#include "Vision/Miscellaneous/OperBoxImageAnalyzer.h"
|
||||
#include "Vision/TemplDetOCRer.h"
|
||||
#include <future>
|
||||
|
||||
bool asst::OperBoxRecognitionTask::_run()
|
||||
{
|
||||
@@ -22,8 +23,8 @@ bool asst::OperBoxRecognitionTask::_run()
|
||||
bool asst::OperBoxRecognitionTask::swipe_and_analyze()
|
||||
{
|
||||
LogTraceFunction;
|
||||
std::string current_page_last_oper_name;
|
||||
std::string current_page_first_oper_name;
|
||||
std::string pre_pre_last_oper;
|
||||
std::string pre_last_oper;
|
||||
m_own_opers.clear();
|
||||
|
||||
while (!need_exit()) {
|
||||
@@ -35,18 +36,18 @@ bool asst::OperBoxRecognitionTask::swipe_and_analyze()
|
||||
break;
|
||||
}
|
||||
const auto& opers_result = analyzer.get_result();
|
||||
if (opers_result.back().name == current_page_last_oper_name &&
|
||||
opers_result.front().name == current_page_first_oper_name) {
|
||||
|
||||
const std::string& last_oper = opers_result.back().name;
|
||||
if (last_oper == pre_last_oper && pre_last_oper == pre_pre_last_oper) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
current_page_first_oper_name = opers_result.front().name;
|
||||
current_page_last_oper_name = opers_result.back().name;
|
||||
for (const auto& box_info : opers_result) {
|
||||
m_own_opers.emplace(box_info.name, box_info);
|
||||
}
|
||||
callback_analyze_result(false);
|
||||
pre_pre_last_oper = pre_last_oper;
|
||||
pre_last_oper = last_oper;
|
||||
|
||||
for (const auto& box_info : opers_result) {
|
||||
m_own_opers.emplace(box_info.name, box_info);
|
||||
}
|
||||
callback_analyze_result(false);
|
||||
future.wait();
|
||||
}
|
||||
return !m_own_opers.empty();
|
||||
|
||||
@@ -20,7 +20,9 @@ bool asst::OperBoxImageAnalyzer::analyze()
|
||||
|
||||
bool ret = analyzer_oper_box();
|
||||
|
||||
save_img(utils::path("debug") / utils::path("oper"));
|
||||
if (m_result.size() != 16 && m_result.size() != 14) { // 完整的一页是14或16个,有可能是识别错了
|
||||
save_img(utils::path("debug") / utils::path("oper"));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user