fix: 修复视频识别职业识别错误,并添加一个兜底措施

https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/4222
This commit is contained in:
MistEO
2023-04-09 17:25:57 +08:00
parent 112605acd2
commit ca41f51adb
4 changed files with 11 additions and 4 deletions

View File

@@ -6499,7 +6499,7 @@
},
"BattleOperRole": {
"template": "empty.png",
"templThreshold": 0.75
"templThreshold": 0.6
},
"BattleOperRoleCaster": {},
"BattleOperRoleMedic": {},

View File

@@ -705,8 +705,7 @@ bool asst::CombatRecordRecognitionTask::process_changes(ClipInfo& clip, ClipInfo
Log.info("deployed", deployed);
if (deployed.empty()) {
Log.warn("Unknown dployed");
return false;
Log.warn("Unknown dployed, will use pre tails_page's name", pre_clip_ptr->ends_oper_name);
}
auto deployed_iter = deployed.begin();
@@ -714,7 +713,7 @@ bool asst::CombatRecordRecognitionTask::process_changes(ClipInfo& clip, ClipInfo
if (!oper.new_here) {
continue;
}
std::string name = deployed_iter == deployed.end() ? "UnkownDeployed" : *(deployed_iter++);
std::string name = deployed_iter == deployed.end() ? pre_clip_ptr->ends_oper_name : *(deployed_iter++);
static const std::unordered_map<battle::DeployDirection, std::string> DirectionNames = {
{ battle::DeployDirection::Right, "Right" }, { battle::DeployDirection::Down, "Down" },

View File

@@ -124,7 +124,10 @@ bool asst::BattleImageAnalyzer::opers_analyze()
MultiMatchImageAnalyzer flags_analyzer(m_image);
const auto& flag_task_ptr = Task.get("BattleOpersFlag");
flags_analyzer.set_task_info(flag_task_ptr);
#ifndef ASST_DEBUG
flags_analyzer.set_log_tracing(false);
#endif
// if (m_target & Target::OperSeleted) {
// // 更大的范围,能把被点击的升起来的干员也识别出来
// // 但是可能造成误识别
@@ -204,7 +207,9 @@ asst::battle::Role asst::BattleImageAnalyzer::oper_role_analyze(const Rect& roi)
static const std::string TaskName = "BattleOperRole";
static const std::string Ext = ".png";
BestMatchImageAnalyzer role_analyzer(m_image);
#ifndef ASST_DEBUG
role_analyzer.set_log_tracing(false);
#endif // !ASST_DEBUG
role_analyzer.set_task_info(TaskName);
role_analyzer.set_roi(roi);
@@ -212,6 +217,7 @@ asst::battle::Role asst::BattleImageAnalyzer::oper_role_analyze(const Rect& roi)
role_analyzer.append_templ(TaskName + role_name + Ext);
}
if (!role_analyzer.analyze()) {
Log.warn(__FUNCTION__, "unknown role");
return battle::Role::Unknown;
}

View File

@@ -9,7 +9,9 @@
bool asst::BestMatchImageAnalyzer::analyze()
{
#ifndef ASST_DEBUG
MatchImageAnalyzer::set_log_tracing(false);
#endif
set_use_cache(false);
MatchRect best_matched;