完成加载全部文字图片并识别的逻辑
@@ -49,12 +49,15 @@ bool InfrastConfiger::_load(const std::string& filename)
|
||||
for (json::value& oper_name : comb_info["comb"].as_array())
|
||||
{
|
||||
std::string oper_name_str = oper_name.as_string();
|
||||
m_mfg_opers.emplace(oper_name_str);
|
||||
comb_vec.emplace_back(std::move(oper_name_str));
|
||||
}
|
||||
m_mfg_combs.emplace_back(std::move(comb_vec));
|
||||
}
|
||||
m_mfg_end = root["Manufacturing"]["end"].as_string();
|
||||
for (json::value& oper : root["Manufacturing"]["all"].as_array())
|
||||
{
|
||||
m_mfg_opers.emplace(oper["name"].as_string());
|
||||
}
|
||||
|
||||
// óÒ×Õ¾ TODO¡¡
|
||||
}
|
||||
|
||||
@@ -68,8 +68,13 @@ Assistance::Assistance(AsstCallback callback, void* callback_arg)
|
||||
return;
|
||||
}
|
||||
|
||||
// for debug
|
||||
m_identify_ptr->add_text_image("森蚺", GetResourceDir() + "operators\\森蚺.png");
|
||||
for (const std::string& name : InfrastConfiger::get_instance().m_mfg_opers) {
|
||||
ret = m_identify_ptr->add_text_image(name, GetResourceDir() + "operators\\" + Utf8ToGbk(name) + ".png");
|
||||
if (!ret) {
|
||||
callback_error();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_working_thread = std::thread(working_proc, this);
|
||||
m_msg_thread = std::thread(msg_proc, this);
|
||||
|
||||
@@ -250,10 +250,9 @@ std::vector<TextArea> asst::Identify::feature_matching(const cv::Mat& mat)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cv::Rect draw_rect;
|
||||
constexpr static const int MatchSizeThreshold = 10;
|
||||
if (good_points.size() >= MatchSizeThreshold) {
|
||||
std::cout << Utf8ToGbk(key) << " " << good_points.size() << " / " << query_keypoints.size() << std::endl;
|
||||
constexpr static const double MatchSizeRatioThreshold = 0.075;
|
||||
if (good_points.size() >= query_keypoints.size() * MatchSizeRatioThreshold) {
|
||||
TextArea textarea;
|
||||
textarea.text = key;
|
||||
int left = 0, right = 0, top = 0, bottom = 0;
|
||||
@@ -272,20 +271,21 @@ std::vector<TextArea> asst::Identify::feature_matching(const cv::Mat& mat)
|
||||
}
|
||||
}
|
||||
textarea.rect = { left, top, right - left, bottom - top };
|
||||
draw_rect = { left + 129, top, right - left, bottom - top };
|
||||
//draw_rect = { left + 129, top, right - left, bottom - top };
|
||||
matched_text_area.emplace_back(std::move(textarea));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for debug
|
||||
cv::Mat text_mat = cv::imread(GetResourceDir() + "operators\\森蚺.png");
|
||||
cv::Mat text_mat = cv::imread(GetResourceDir() + "operators\\" + Utf8ToGbk(key) + ".png");
|
||||
|
||||
cv::Mat approach_mat;
|
||||
cv::drawMatches(text_mat, query_keypoints, mat, train_keypoints, approach_matches, approach_mat);
|
||||
// cv::rectangle(approach_mat, draw_rect, cv::Scalar(0, 0, 255), 10);
|
||||
cv::drawMatches(text_mat, query_keypoints, mat, train_keypoints, ransac_matchs, approach_mat);
|
||||
|
||||
cv::Mat good_mat;
|
||||
cv::drawMatches(text_mat, query_keypoints, mat, train_keypoints, good_matchs, good_mat);
|
||||
// cv::rectangle(good_mat, draw_rect, cv::Scalar(0, 0, 255), 10);
|
||||
}
|
||||
return matched_text_area;
|
||||
}
|
||||
|
||||
@@ -697,7 +697,11 @@ bool asst::InfrastStationTask::run()
|
||||
|
||||
// for debug
|
||||
const cv::Mat& debug_image = get_format_image(true);
|
||||
m_identify_ptr->feature_matching(debug_image);
|
||||
auto res = m_identify_ptr->feature_matching(debug_image);
|
||||
|
||||
for (auto textarea : res) {
|
||||
std::cout << Utf8ToGbk(textarea.text) << std::endl;
|
||||
}
|
||||
|
||||
//std::vector<std::vector<std::string>> all_oper_combs; // 所有的干员组合
|
||||
//std::unordered_set<std::string> all_oper_name; // 所有干员名
|
||||
|
||||
@@ -26,7 +26,144 @@
|
||||
}
|
||||
],
|
||||
"end": "月见夜",
|
||||
"end_Doc": "识别到这个词,就认为干员遍历结束,一般用排序里最后的那个干员(?)"
|
||||
"end_Doc": "识别到这个词,就认为干员遍历结束,一般用排序里最后的那个干员(?)",
|
||||
"all": [
|
||||
{
|
||||
"name": "食铁兽"
|
||||
},
|
||||
{
|
||||
"name": "断罪者"
|
||||
},
|
||||
{
|
||||
"name": "白雪"
|
||||
},
|
||||
{
|
||||
"name": "Castle-3"
|
||||
},
|
||||
{
|
||||
"name": "霜叶"
|
||||
},
|
||||
{
|
||||
"name": "红豆"
|
||||
},
|
||||
{
|
||||
"name": "帕拉斯"
|
||||
},
|
||||
{
|
||||
"name": "砾"
|
||||
},
|
||||
{
|
||||
"name": "夜烟"
|
||||
},
|
||||
{
|
||||
"name": "斑点"
|
||||
},
|
||||
{
|
||||
"name": "清流"
|
||||
},
|
||||
{
|
||||
"name": "迷迭香"
|
||||
},
|
||||
{
|
||||
"name": "槐琥"
|
||||
},
|
||||
{
|
||||
"name": "梅尔"
|
||||
},
|
||||
{
|
||||
"name": "赫默"
|
||||
},
|
||||
{
|
||||
"name": "白面鸮"
|
||||
},
|
||||
{
|
||||
"name": "水月"
|
||||
},
|
||||
{
|
||||
"name": "调香师"
|
||||
},
|
||||
{
|
||||
"name": "杰西卡"
|
||||
},
|
||||
{
|
||||
"name": "史都华德"
|
||||
},
|
||||
{
|
||||
"name": "香草"
|
||||
},
|
||||
{
|
||||
"name": "石棉"
|
||||
},
|
||||
{
|
||||
"name": "泡普卡"
|
||||
},
|
||||
{
|
||||
"name": "芬"
|
||||
},
|
||||
{
|
||||
"name": "克洛丝"
|
||||
},
|
||||
{
|
||||
"name": "豆苗"
|
||||
},
|
||||
{
|
||||
"name": "流星"
|
||||
},
|
||||
{
|
||||
"name": "夜刀"
|
||||
},
|
||||
{
|
||||
"name": "温蒂"
|
||||
},
|
||||
{
|
||||
"name": "森蚺"
|
||||
},
|
||||
{
|
||||
"name": "异客"
|
||||
},
|
||||
{
|
||||
"name": "蛇屠箱"
|
||||
},
|
||||
{
|
||||
"name": "黑角"
|
||||
},
|
||||
{
|
||||
"name": "卡缇"
|
||||
},
|
||||
{
|
||||
"name": "米格鲁"
|
||||
},
|
||||
{
|
||||
"name": "火神"
|
||||
},
|
||||
{
|
||||
"name": "贝娜"
|
||||
},
|
||||
{
|
||||
"name": "卡达"
|
||||
},
|
||||
{
|
||||
"name": "稀音"
|
||||
},
|
||||
{
|
||||
"name": "泡泡"
|
||||
},
|
||||
{
|
||||
"name": "刻俄柏"
|
||||
},
|
||||
{
|
||||
"name": "红云"
|
||||
},
|
||||
{
|
||||
"name": "艾雅法拉"
|
||||
},
|
||||
{
|
||||
"name": "炎熔"
|
||||
},
|
||||
{
|
||||
"name": "月见夜"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Trade": {
|
||||
"Doc": "贸易站"
|
||||
|
||||
BIN
resource/operators/Castle-3.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
resource/operators/克洛丝.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resource/operators/刻俄柏.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
resource/operators/卡缇.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
resource/operators/卡达.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
resource/operators/史都华德.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
resource/operators/夜刀.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
resource/operators/夜烟.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resource/operators/帕拉斯.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
resource/operators/异客.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
resource/operators/斑点.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
resource/operators/断罪者.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
resource/operators/月见夜.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
resource/operators/杰西卡.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
resource/operators/梅尔.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
resource/operators/森蚺.psd
Normal file
BIN
resource/operators/槐琥.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
resource/operators/水月.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
resource/operators/泡普卡.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
resource/operators/泡泡.png
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
resource/operators/流星.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
resource/operators/清流.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
resource/operators/温蒂.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
resource/operators/火神.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
resource/operators/炎熔.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
resource/operators/白雪.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
resource/operators/白面鸮.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
resource/operators/石棉.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
resource/operators/砾.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
resource/operators/稀音.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
resource/operators/米格鲁.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resource/operators/红云.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
resource/operators/红豆.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
resource/operators/艾雅法拉.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
resource/operators/芬.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
resource/operators/蛇屠箱.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resource/operators/调香师.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
resource/operators/豆苗.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
resource/operators/贝娜.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
resource/operators/赫默.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resource/operators/迷迭香.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
resource/operators/霜叶.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
resource/operators/食铁兽.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
resource/operators/香草.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
resource/operators/黑角.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |