修复未识别完错误

This commit is contained in:
罗家欣
2023-04-19 16:22:48 +08:00
parent 83883a3ac9
commit 05ddb26e8d
5 changed files with 25 additions and 11 deletions

View File

@@ -9616,16 +9616,16 @@
110
],
"next": [
"OperatorRarityTab"
"OperatorRoleTabSelect"
]
},
"OperatorRoleTabSelect": {
"action": "ClickSelf",
"roi": [
1210,
30,
68,
23
1200,
20,
80,
50
],
"next": [
"OperatorRoleTab"
@@ -9634,9 +9634,9 @@
"OperatorRoleTab": {
"action": "DoNothing",
"roi": [
1197,
14,
82,
1195,
15,
80,
50
]
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -3,7 +3,6 @@
#include "Utils/Logger.hpp"
#include "Utils/Ranges.hpp"
#include <meojson/json.hpp>
#include <regex>
bool asst::BattleDataConfig::parse(const json::value& json)
{

View File

@@ -26,6 +26,8 @@ bool asst::OperImageAnalyzer::analyze()
bool asst::OperImageAnalyzer::analyzer_opers()
{
std::vector<asst::TextRect> oper_names_result;
oper_names_result.clear();
const auto& ocr_replace = Task.get<OcrTaskInfo>("CharsNameOcrReplace");
OcrWithFlagTemplImageAnalyzer oper_name_analyzer(m_image);
@@ -34,7 +36,20 @@ bool asst::OperImageAnalyzer::analyzer_opers()
oper_name_analyzer.set_replace(ocr_replace->replace_map, ocr_replace->replace_full);
oper_name_analyzer.analyze();
auto oper_names_result = oper_name_analyzer.get_result();
oper_names_result = oper_name_analyzer.get_result();
// 按位置排个序-先直接copy代码过来后面可能重构
// +---+
// |1 3|
// |2 4|
// +---+
ranges::sort(oper_names_result, [](const TextRect& lhs, const TextRect& rhs) -> bool {
if (std::abs(lhs.rect.x - rhs.rect.x) < 5) { // x差距较小则理解为是同一排的按y排序
return lhs.rect.y < rhs.rect.y;
}
else {
return lhs.rect.x < rhs.rect.x;
}
});
if (oper_names_result.empty()) {
return false;
@@ -43,7 +58,7 @@ bool asst::OperImageAnalyzer::analyzer_opers()
for (auto& opername : oper_names_result) {
OperBoxInfo oper_info;
oper_info.name = std::move(opername.text);
current_page_opers.push_back(oper_info);
current_page_opers.emplace_back(oper_info);
#ifdef ASST_DEBUG
m_image_draw_oper = m_image;
cv::rectangle(m_image_draw_oper, make_rect<cv::Rect>(opername.rect), cv::Scalar(0, 255, 0), 2);