diff --git a/MeoAssistance.sln b/MeoAssistance.sln index 0202d1d622..5716eac94c 100644 --- a/MeoAssistance.sln +++ b/MeoAssistance.sln @@ -17,30 +17,51 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeoAsstGui", "src\MeoAsstGu {362D1E30-F5AE-4279-9985-65C27B3BA300} = {362D1E30-F5AE-4279-9985-65C27B3BA300} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TransparentImageCvt", "tools\TransparentImageCvt\TransparentImageCvt.vcxproj", "{093A3174-A27E-4D23-B64E-16F9448AD5AC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release|x64 = Release|x64 + Release|x86 = Release|x86 RelWithDebInfo|x64 = RelWithDebInfo|x64 + RelWithDebInfo|x86 = RelWithDebInfo|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {362D1E30-F5AE-4279-9985-65C27B3BA300}.Release|x64.ActiveCfg = Release|x64 {362D1E30-F5AE-4279-9985-65C27B3BA300}.Release|x64.Build.0 = Release|x64 + {362D1E30-F5AE-4279-9985-65C27B3BA300}.Release|x86.ActiveCfg = Release|x64 {362D1E30-F5AE-4279-9985-65C27B3BA300}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 {362D1E30-F5AE-4279-9985-65C27B3BA300}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {362D1E30-F5AE-4279-9985-65C27B3BA300}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64 {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.Release|x64.ActiveCfg = Release|x64 {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.Release|x64.Build.0 = Release|x64 + {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.Release|x86.ActiveCfg = Release|x64 {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64 {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x64.ActiveCfg = Release|Any CPU {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x64.Build.0 = Release|Any CPU + {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x86.ActiveCfg = Release|Any CPU + {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.Release|x86.Build.0 = Release|Any CPU {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|Any CPU {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|Any CPU + {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|Any CPU + {FFDC8F49-8EAF-45BE-B0A8-7EF0DB9875A2}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|Any CPU + {093A3174-A27E-4D23-B64E-16F9448AD5AC}.Release|x64.ActiveCfg = Release|x64 + {093A3174-A27E-4D23-B64E-16F9448AD5AC}.Release|x64.Build.0 = Release|x64 + {093A3174-A27E-4D23-B64E-16F9448AD5AC}.Release|x86.ActiveCfg = Release|Win32 + {093A3174-A27E-4D23-B64E-16F9448AD5AC}.Release|x86.Build.0 = Release|Win32 + {093A3174-A27E-4D23-B64E-16F9448AD5AC}.RelWithDebInfo|x64.ActiveCfg = Debug|x64 + {093A3174-A27E-4D23-B64E-16F9448AD5AC}.RelWithDebInfo|x64.Build.0 = Debug|x64 + {093A3174-A27E-4D23-B64E-16F9448AD5AC}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 + {093A3174-A27E-4D23-B64E-16F9448AD5AC}.RelWithDebInfo|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {63B4F1A2-291C-4C85-91E1-A1F6DAE30D64} = {6C4B8D52-51D1-45F8-AAEC-808035443FD6} + {093A3174-A27E-4D23-B64E-16F9448AD5AC} = {6C4B8D52-51D1-45F8-AAEC-808035443FD6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4F2C0E4B-4FE9-47C6-A878-6BD2FAD8B9B2} diff --git a/resource/infrast.json b/resource/infrast.json index 789d9150d0..9ed2d59cf3 100644 --- a/resource/infrast.json +++ b/resource/infrast.json @@ -96,7 +96,7 @@ }, { "name": [ "特立独行", "麻烦制造者" ], - "intro": "", + "intro": "进驻制造站时,生产力+25%,仓库容量上限-12,心情每小时消耗+0.25", "template": "Bskill_man_spd&limit&cost3.png" }, { diff --git a/resource/tasks.json b/resource/tasks.json index e055ad1adc..b8af5d03e0 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -855,13 +855,15 @@ }, "InfrastSkills": { "template": "empty.png", + "templThreshold": 0.9, "histThreshold": 120, - "histThreshold_Doc": "该任务里的这个阈值,是特化了拿来做亮度平均值的,懒得重新写个字段了", + "histThreshold_Doc": "该任务里的Hist阈值,是特化了拿来做灰度图平均值的,懒得重新写个字段了", "resultMove": [ - -6, - -40, - 78, - 36 - ] + -8, + -42, + 82, + 40 + ], + "maskRange": [ 1, 255 ] } } \ No newline at end of file diff --git a/resource/template/Bskill_man_cost_all.png b/resource/template/Bskill_man_cost_all.png index fa9175a732..8457a900ef 100644 Binary files a/resource/template/Bskill_man_cost_all.png and b/resource/template/Bskill_man_cost_all.png differ diff --git a/resource/template/Bskill_man_exp&cost.png b/resource/template/Bskill_man_exp&cost.png index 1ebf5f79d9..e7385bb713 100644 Binary files a/resource/template/Bskill_man_exp&cost.png and b/resource/template/Bskill_man_exp&cost.png differ diff --git a/resource/template/Bskill_man_exp&limit1.png b/resource/template/Bskill_man_exp&limit1.png index b8c4c3df8e..297d8aaf9f 100644 Binary files a/resource/template/Bskill_man_exp&limit1.png and b/resource/template/Bskill_man_exp&limit1.png differ diff --git a/resource/template/Bskill_man_exp&limit2.png b/resource/template/Bskill_man_exp&limit2.png index de6d5a5991..06005729a9 100644 Binary files a/resource/template/Bskill_man_exp&limit2.png and b/resource/template/Bskill_man_exp&limit2.png differ diff --git a/resource/template/Bskill_man_exp1.png b/resource/template/Bskill_man_exp1.png index 3f2f260c9a..a5924f3089 100644 Binary files a/resource/template/Bskill_man_exp1.png and b/resource/template/Bskill_man_exp1.png differ diff --git a/resource/template/Bskill_man_exp2.png b/resource/template/Bskill_man_exp2.png index 15893dfb8b..b2186a3403 100644 Binary files a/resource/template/Bskill_man_exp2.png and b/resource/template/Bskill_man_exp2.png differ diff --git a/resource/template/Bskill_man_exp3.png b/resource/template/Bskill_man_exp3.png index 505038d6de..6eb900abdb 100644 Binary files a/resource/template/Bskill_man_exp3.png and b/resource/template/Bskill_man_exp3.png differ diff --git a/resource/template/Bskill_man_gold1.png b/resource/template/Bskill_man_gold1.png index 0c1fb9b0ee..746235f031 100644 Binary files a/resource/template/Bskill_man_gold1.png and b/resource/template/Bskill_man_gold1.png differ diff --git a/resource/template/Bskill_man_gold2.png b/resource/template/Bskill_man_gold2.png index 695cbe28b4..781f1663df 100644 Binary files a/resource/template/Bskill_man_gold2.png and b/resource/template/Bskill_man_gold2.png differ diff --git a/resource/template/Bskill_man_limit&cost1.png b/resource/template/Bskill_man_limit&cost1.png index 324560530a..3b80f0b3f3 100644 Binary files a/resource/template/Bskill_man_limit&cost1.png and b/resource/template/Bskill_man_limit&cost1.png differ diff --git a/resource/template/Bskill_man_limit&cost2.png b/resource/template/Bskill_man_limit&cost2.png index a46ba64273..3115371a81 100644 Binary files a/resource/template/Bskill_man_limit&cost2.png and b/resource/template/Bskill_man_limit&cost2.png differ diff --git a/resource/template/Bskill_man_limit&cost3.png b/resource/template/Bskill_man_limit&cost3.png index d21535f22e..f74148acd0 100644 Binary files a/resource/template/Bskill_man_limit&cost3.png and b/resource/template/Bskill_man_limit&cost3.png differ diff --git a/resource/template/Bskill_man_originium1.png b/resource/template/Bskill_man_originium1.png index 055da7df6f..fc79c80cbd 100644 Binary files a/resource/template/Bskill_man_originium1.png and b/resource/template/Bskill_man_originium1.png differ diff --git a/resource/template/Bskill_man_originium2.png b/resource/template/Bskill_man_originium2.png index 8d034fafb1..0031a3a51c 100644 Binary files a/resource/template/Bskill_man_originium2.png and b/resource/template/Bskill_man_originium2.png differ diff --git a/resource/template/Bskill_man_skill_spd.png b/resource/template/Bskill_man_skill_spd.png index 0a38a8190b..9414b7e3ad 100644 Binary files a/resource/template/Bskill_man_skill_spd.png and b/resource/template/Bskill_man_skill_spd.png differ diff --git a/resource/template/Bskill_man_spd&limit&cost1.png b/resource/template/Bskill_man_spd&limit&cost1.png index b4f642e03f..2621612c2d 100644 Binary files a/resource/template/Bskill_man_spd&limit&cost1.png and b/resource/template/Bskill_man_spd&limit&cost1.png differ diff --git a/resource/template/Bskill_man_spd&limit&cost2.png b/resource/template/Bskill_man_spd&limit&cost2.png index 83a4280731..c6baae1414 100644 Binary files a/resource/template/Bskill_man_spd&limit&cost2.png and b/resource/template/Bskill_man_spd&limit&cost2.png differ diff --git a/resource/template/Bskill_man_spd&limit&cost3.png b/resource/template/Bskill_man_spd&limit&cost3.png index 16c9c41a5a..825ea017bb 100644 Binary files a/resource/template/Bskill_man_spd&limit&cost3.png and b/resource/template/Bskill_man_spd&limit&cost3.png differ diff --git a/resource/template/Bskill_man_spd&limit&cost4.png b/resource/template/Bskill_man_spd&limit&cost4.png index 100d74295e..de56f5dea7 100644 Binary files a/resource/template/Bskill_man_spd&limit&cost4.png and b/resource/template/Bskill_man_spd&limit&cost4.png differ diff --git a/resource/template/Bskill_man_spd&limit1.png b/resource/template/Bskill_man_spd&limit1.png index 082a7666bb..932539291b 100644 Binary files a/resource/template/Bskill_man_spd&limit1.png and b/resource/template/Bskill_man_spd&limit1.png differ diff --git a/resource/template/Bskill_man_spd&limit3.png b/resource/template/Bskill_man_spd&limit3.png index 5ffd3ee609..fa10c0a52f 100644 Binary files a/resource/template/Bskill_man_spd&limit3.png and b/resource/template/Bskill_man_spd&limit3.png differ diff --git a/resource/template/Bskill_man_spd&power1.png b/resource/template/Bskill_man_spd&power1.png index 77a78ba3bd..c3df756155 100644 Binary files a/resource/template/Bskill_man_spd&power1.png and b/resource/template/Bskill_man_spd&power1.png differ diff --git a/resource/template/Bskill_man_spd&power2.png b/resource/template/Bskill_man_spd&power2.png index 2017c4e115..6654104888 100644 Binary files a/resource/template/Bskill_man_spd&power2.png and b/resource/template/Bskill_man_spd&power2.png differ diff --git a/resource/template/Bskill_man_spd&power3.png b/resource/template/Bskill_man_spd&power3.png index 04f5bf8e71..5cec4ea338 100644 Binary files a/resource/template/Bskill_man_spd&power3.png and b/resource/template/Bskill_man_spd&power3.png differ diff --git a/resource/template/Bskill_man_spd&trade.png b/resource/template/Bskill_man_spd&trade.png index 40d004c52e..0f911e07c0 100644 Binary files a/resource/template/Bskill_man_spd&trade.png and b/resource/template/Bskill_man_spd&trade.png differ diff --git a/resource/template/Bskill_man_spd1.png b/resource/template/Bskill_man_spd1.png index 506ab2b1c5..32c79112e2 100644 Binary files a/resource/template/Bskill_man_spd1.png and b/resource/template/Bskill_man_spd1.png differ diff --git a/resource/template/Bskill_man_spd2.png b/resource/template/Bskill_man_spd2.png index 81c8a0e368..2a939527ec 100644 Binary files a/resource/template/Bskill_man_spd2.png and b/resource/template/Bskill_man_spd2.png differ diff --git a/resource/template/Bskill_man_spd3.png b/resource/template/Bskill_man_spd3.png index 6b0f20bd71..0c073daec4 100644 Binary files a/resource/template/Bskill_man_spd3.png and b/resource/template/Bskill_man_spd3.png differ diff --git a/resource/template/Bskill_man_spd_add1.png b/resource/template/Bskill_man_spd_add1.png index 6d23739b25..e4cd28bc2c 100644 Binary files a/resource/template/Bskill_man_spd_add1.png and b/resource/template/Bskill_man_spd_add1.png differ diff --git a/resource/template/Bskill_man_spd_add2.png b/resource/template/Bskill_man_spd_add2.png index 2f2ecb6d21..69d995b927 100644 Binary files a/resource/template/Bskill_man_spd_add2.png and b/resource/template/Bskill_man_spd_add2.png differ diff --git a/resource/template/Bskill_man_spd_bd1.png b/resource/template/Bskill_man_spd_bd1.png index 5ac1e4a73a..5b7604ee94 100644 Binary files a/resource/template/Bskill_man_spd_bd1.png and b/resource/template/Bskill_man_spd_bd1.png differ diff --git a/resource/template/Bskill_man_spd_bd2.png b/resource/template/Bskill_man_spd_bd2.png index e5d4181124..3e28100a37 100644 Binary files a/resource/template/Bskill_man_spd_bd2.png and b/resource/template/Bskill_man_spd_bd2.png differ diff --git a/resource/template/Bskill_man_spd_bd_n1.png b/resource/template/Bskill_man_spd_bd_n1.png index 32ae2c3434..d62e4ef8cc 100644 Binary files a/resource/template/Bskill_man_spd_bd_n1.png and b/resource/template/Bskill_man_spd_bd_n1.png differ diff --git a/resource/template/Bskill_man_spd_variable11.png b/resource/template/Bskill_man_spd_variable11.png index ff81e6154f..7951d70ad9 100644 Binary files a/resource/template/Bskill_man_spd_variable11.png and b/resource/template/Bskill_man_spd_variable11.png differ diff --git a/resource/template/Bskill_man_spd_variable21.png b/resource/template/Bskill_man_spd_variable21.png index 5e493a5658..523c18a14a 100644 Binary files a/resource/template/Bskill_man_spd_variable21.png and b/resource/template/Bskill_man_spd_variable21.png differ diff --git a/resource/template/Bskill_man_spd_variable31.png b/resource/template/Bskill_man_spd_variable31.png index bc3df8fa96..6675f87401 100644 Binary files a/resource/template/Bskill_man_spd_variable31.png and b/resource/template/Bskill_man_spd_variable31.png differ diff --git a/src/MeoAssistance/InfrastConfiger.cpp b/src/MeoAssistance/InfrastConfiger.cpp index e6d8acfc9f..5a7c6741de 100644 --- a/src/MeoAssistance/InfrastConfiger.cpp +++ b/src/MeoAssistance/InfrastConfiger.cpp @@ -5,7 +5,9 @@ bool asst::InfrastConfiger::parse(const json::value& json) { for (const json::value& facility : json.at("facility").as_array()) { - for (const json::value& skill_json : json.at(facility.as_string()).as_array()) { + std::string facility_name = facility.as_string(); + std::vector facility_skills; + for (const json::value& skill_json : json.at(facility_name).at("skills").as_array()) { InfrastSkill skill; skill.templ_name = skill_json.at("template").as_string(); m_templ_required.emplace(skill.templ_name); @@ -19,8 +21,9 @@ bool asst::InfrastConfiger::parse(const json::value& json) } skill.intro = skill_json.get("intro", std::string()); - m_skills.emplace(std::move(id), std::move(skill)); + facility_skills.emplace_back(std::move(skill)); } + m_skills.emplace(std::move(facility_name), std::move(facility_skills)); } return false; } \ No newline at end of file diff --git a/src/MeoAssistance/InfrastConfiger.h b/src/MeoAssistance/InfrastConfiger.h index 77d1836c62..401e433264 100644 --- a/src/MeoAssistance/InfrastConfiger.h +++ b/src/MeoAssistance/InfrastConfiger.h @@ -20,14 +20,14 @@ namespace asst { const std::unordered_set& get_templ_required() const noexcept { return m_templ_required; } - const std::unordered_map& get_skills() const noexcept { - return m_skills; + const std::vector& get_skills(const std::string& facility_name) const { + return m_skills.at(facility_name); } protected: virtual bool parse(const json::value& json) override; - std::unordered_map m_skills; + std::unordered_map> m_skills; std::unordered_set m_templ_required; }; } diff --git a/src/MeoAssistance/InfrastSkillsImageAnalyzer.cpp b/src/MeoAssistance/InfrastSkillsImageAnalyzer.cpp index 931d67436d..142b7a3799 100644 --- a/src/MeoAssistance/InfrastSkillsImageAnalyzer.cpp +++ b/src/MeoAssistance/InfrastSkillsImageAnalyzer.cpp @@ -3,6 +3,8 @@ #include "Resource.h" #include "InfrastSmileyImageAnalyzer.h" #include "AsstUtils.hpp" +#include "MatchImageAnalyzer.h" +#include "Logger.hpp" bool asst::InfrastSkillsImageAnalyzer::analyze() { @@ -22,6 +24,8 @@ bool asst::InfrastSkillsImageAnalyzer::analyze() skills_split(); + skill_analyze(); + return true; } @@ -99,7 +103,7 @@ bool asst::InfrastSkillsImageAnalyzer::skills_split() skill_rect_in_org.y += roi.y; #ifdef LOG_TRACE - cv::rectangle(m_image_draw, utils::make_rect(skill_rect_in_org), cv::Scalar(0, 255, 0), 2); + cv::rectangle(m_image_draw, utils::make_rect(skill_rect_in_org), cv::Scalar(0, 0, 255), 2); #endif skills_vec.emplace_back(skill_rect_in_org); } @@ -111,5 +115,38 @@ bool asst::InfrastSkillsImageAnalyzer::skills_split() bool asst::InfrastSkillsImageAnalyzer::skill_analyze() { - return false; + const auto task_ptr = std::dynamic_pointer_cast( + resource.task().task_ptr("InfrastSkills")); + + MatchImageAnalyzer skill_analyzer(m_image); + skill_analyzer.set_mask_range(task_ptr->mask_range); + skill_analyzer.set_threshold(task_ptr->templ_threshold); + + for (const auto& skills_rect_vec : m_skills_splited) { + for (const Rect& skill_rect : skills_rect_vec) { + skill_analyzer.set_roi(skill_rect); + + InfrastSkill most_confident_skills; + double max_socre = 0; + for (const InfrastSkill& skill : resource.infrast().get_skills("Mfg")) { + skill_analyzer.set_templ_name(skill.templ_name); + + if (!skill_analyzer.analyze()) { + continue; + } + auto cur_score = skill_analyzer.get_result().score; + if (max_socre < cur_score) { + max_socre = cur_score; + most_confident_skills = skill; + } + } +#ifdef LOG_TRACE + std::string skill_id = most_confident_skills.id; + //cv::putText(m_image_draw, skill_id, cv::Point(skill_rect.x, skill_rect.y), 1, 1, cv::Scalar(0, 0, 255)); + cv::Mat skill_mat = m_image(utils::make_rect(skill_rect)); + log.trace(max_socre, skill_id, most_confident_skills.names.front(), most_confident_skills.intro); +#endif + } + } + return true; } \ No newline at end of file diff --git a/src/MeoAssistance/MatchImageAnalyzer.cpp b/src/MeoAssistance/MatchImageAnalyzer.cpp index 1174a2fa5b..1f619a78dd 100644 --- a/src/MeoAssistance/MatchImageAnalyzer.cpp +++ b/src/MeoAssistance/MatchImageAnalyzer.cpp @@ -57,14 +57,15 @@ bool asst::MatchImageAnalyzer::match_templ(const cv::Mat& templ) { cv::Mat matched; + cv::Mat image_roi = m_image(utils::make_rect(m_roi)); if (m_mask_range.first == m_mask_range.second) { - cv::matchTemplate(m_image, templ, matched, cv::TM_CCOEFF_NORMED); + cv::matchTemplate(image_roi, templ, matched, cv::TM_CCOEFF_NORMED); } else { cv::Mat mask; cv::cvtColor(templ, mask, cv::COLOR_BGR2GRAY); cv::threshold(mask, mask, m_mask_range.first, m_mask_range.second, cv::THRESH_BINARY); - cv::matchTemplate(m_image, templ, matched, cv::TM_CCOEFF_NORMED, mask); + cv::matchTemplate(image_roi, templ, matched, cv::TM_CCOEFF_NORMED, mask); } double min_val = 0.0, max_val = 0.0; cv::Point min_loc, max_loc; diff --git a/src/MeoAssistance/MeoAssistance.vcxproj b/src/MeoAssistance/MeoAssistance.vcxproj index 33b9ae105b..69175e4042 100644 --- a/src/MeoAssistance/MeoAssistance.vcxproj +++ b/src/MeoAssistance/MeoAssistance.vcxproj @@ -124,12 +124,12 @@ false $(SolutionDir)include;$(SolutionDir)3rdparty\include;$(SolutionDir)3rdparty\include\meojson;$(SolutionDir)\3rdparty\include\opencv;$(SolutionDir)\3rdparty\include\opencv2;$(SolutionDir)3drPart\include\OcrLiteNcnn;;$(IncludePath) - $(TargetDir);$(Solution)\3rdparty\lib;$(LibraryPath) + $(TargetDir);$(SolutionDir)\3rdparty\lib;$(LibraryPath) true $(SolutionDir)include;$(SolutionDir)3rdparty\include;$(SolutionDir)3rdparty\include\meojson;$(SolutionDir)3rdparty\include\opencv;$(SolutionDir)3rdparty\include\opencv2;$(SolutionDir)3drPart\include\OcrLiteNcnn;$(IncludePath) - $(TargetDir);$(Solution)\3rdparty\lib;$(LibraryPath) + $(TargetDir);$(SolutionDir)\3rdparty\lib;$(LibraryPath) @@ -152,7 +152,8 @@ true libmeojson.lib;OcrLiteOnnx.lib;opencv_world453.lib;penguin-stats-recognize.lib;%(AdditionalDependencies) RequireAdministrator - $(SolutionDir)3rdparty\lib\ + + @@ -196,7 +197,8 @@ xcopy /e /y /i /c $(SolutionDir)3rdparty\resource $(TargetDir)resource true libmeojson.lib;OcrLiteOnnx.lib;opencv_world453.lib;penguin-stats-recognize.lib;%(AdditionalDependencies) RequireAdministrator - $(SolutionDir)3rdparty\lib\ + + diff --git a/src/MeoAssistance/Resource.cpp b/src/MeoAssistance/Resource.cpp index cb671d705d..468be726a5 100644 --- a/src/MeoAssistance/Resource.cpp +++ b/src/MeoAssistance/Resource.cpp @@ -38,6 +38,11 @@ bool asst::Resource::load(const std::string& dir) m_last_error = m_item_cfg_unique_ins.get_last_error(); return false; } + if (!m_infrast_cfg_unique_ins.load(dir + InfrastCfgFilename)) { + m_last_error = m_infrast_cfg_unique_ins.get_last_error(); + return false; + } + if (!m_user_cfg_unique_ins.load(dir + UserCfgFilename)) { m_last_error = m_user_cfg_unique_ins.get_last_error(); return false; diff --git a/tools/TransparentImageCvt/TransparentImageCvt.vcxproj b/tools/TransparentImageCvt/TransparentImageCvt.vcxproj new file mode 100644 index 0000000000..0ccc03a86d --- /dev/null +++ b/tools/TransparentImageCvt/TransparentImageCvt.vcxproj @@ -0,0 +1,155 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {093a3174-a27e-4d23-b64e-16f9448ad5ac} + TransparentImageCvt + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + $(SolutionDir)3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath) + $(SolutionDir)3rdparty\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) + + + false + $(SolutionDir)3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath) + $(SolutionDir)3rdparty\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp17 + + + Console + true + opencv_world453.lib;%(AdditionalDependencies) + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp17 + + + Console + true + true + true + opencv_world453.lib;%(AdditionalDependencies) + + + + + + + + + \ No newline at end of file diff --git a/tools/TransparentImageCvt/TransparentImageCvt.vcxproj.filters b/tools/TransparentImageCvt/TransparentImageCvt.vcxproj.filters new file mode 100644 index 0000000000..65fa6d5ae5 --- /dev/null +++ b/tools/TransparentImageCvt/TransparentImageCvt.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 源文件 + + + \ No newline at end of file diff --git a/tools/TransparentImageCvt/main.cpp b/tools/TransparentImageCvt/main.cpp new file mode 100644 index 0000000000..2aaf75ed48 --- /dev/null +++ b/tools/TransparentImageCvt/main.cpp @@ -0,0 +1,35 @@ +/****** +* 转换透明图片,若Alpha通道不为255,则直接设置为黑色 +******/ + +#include + +#include + +int main() +{ + std::string input_dir = R"(D:\Code\MeoAssistance\resource\infrast)"; + std::string output_dir = R"(D:\Code\MeoAssistance\resource\infrast\cvt\)"; + + for (auto&& entry : std::filesystem::directory_iterator(input_dir)) { + if (entry.path().extension() != ".png") { + continue; + } + cv::Mat image = cv::imread(entry.path().u8string(), -1); + cv::Mat cvt; + + cv::cvtColor(image, cvt, cv::COLOR_BGRA2BGR); + for (int c = 0; c != image.cols; ++c) { + for (int r = 0; r != image.rows; ++r) { + auto p = image.at(c, r); + if (p[3] != 255) { + cvt.at(c, r) = cv::Vec3b(0, 0, 0); + } + } + } + std::string out_file = output_dir + entry.path().filename().u8string(); + cv::imwrite(out_file, cvt); + } + + return 0; +} \ No newline at end of file