From 7337f1012336f82352e7e004d7f96a9f94ec1d1f Mon Sep 17 00:00:00 2001 From: xinyang <895639507@qq.com> Date: Mon, 5 Aug 2019 09:54:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86=E7=BB=9F=E4=B8=80=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E8=A7=84=E8=8C=83=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- armor/include/armor_finder/armor_finder.h | 4 ++-- armor/src/armor_finder/find/find_light_blobs.cpp | 2 +- main.cpp | 6 +++--- others/include/options.h | 2 +- others/src/additions.cpp | 2 +- others/src/options.cpp | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/armor/include/armor_finder/armor_finder.h b/armor/include/armor_finder/armor_finder.h index 89d16cd..96139be 100644 --- a/armor/include/armor_finder/armor_finder.h +++ b/armor/include/armor_finder/armor_finder.h @@ -51,11 +51,11 @@ extern std::map prior_red; class LightBlob { public: cv::RotatedRect rect; //灯条位置 - double areaRatio; + double area_ratio; double length; //灯条长度 uint8_t blob_color; //灯条颜色 - LightBlob(cv::RotatedRect &r, double ratio, uint8_t color) : rect(r), areaRatio(ratio), blob_color(color) { + LightBlob(cv::RotatedRect &r, double ratio, uint8_t color) : rect(r), area_ratio(ratio), blob_color(color) { length = max(rect.size.height, rect.size.width); }; LightBlob() = default; diff --git a/armor/src/armor_finder/find/find_light_blobs.cpp b/armor/src/armor_finder/find/find_light_blobs.cpp index 71937cc..f983f07 100644 --- a/armor/src/armor_finder/find/find_light_blobs.cpp +++ b/armor/src/armor_finder/find/find_light_blobs.cpp @@ -173,7 +173,7 @@ bool ArmorFinder::findLightBlobs(const cv::Mat &src, LightBlobs &light_blobs) { for (int l = 0; l != light_blobs_light.size(); l++) { for (int d = 0; d != light_blobs_dim.size(); d++) { if (isSameBlob(light_blobs_light[l], light_blobs_dim[d])) { - if (light_blobs_light[l].areaRatio > light_blobs_dim[d].areaRatio) { + if (light_blobs_light[l].area_ratio > light_blobs_dim[d].area_ratio) { dim_to_remove.emplace_back(d); } else { light_to_remove.emplace_back(l); diff --git a/main.cpp b/main.cpp index bac5761..10671d7 100644 --- a/main.cpp +++ b/main.cpp @@ -44,14 +44,14 @@ WrapperHead *video_chassis = nullptr; // 底盘摄像头视频源 Serial serial(115200); // 串口对象 uint8_t last_state = INIT_STATE; // 上次状态,用于初始化 // 自瞄主程序对象 -ArmorFinder armorFinder(mcu_data.enemy_color, serial, PROJECT_DIR"/tools/para/", mcu_data.use_classifier); +ArmorFinder armor_finder(mcu_data.enemy_color, serial, PROJECT_DIR"/tools/para/", mcu_data.use_classifier); // 能量机关主程序对象 Energy energy(serial, mcu_data.enemy_color); int box_distance = 0; int main(int argc, char *argv[]) { - process_options(argc, argv); // 处理命令行参数 + processOptions(argc, argv); // 处理命令行参数 thread receive(uartReceive, &serial); // 开启串口接收线程 int from_camera = 1; // 根据条件选择视频源 @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) { if (show_origin) showOrigin(gimbal_src); // }); CNT_TIME(STR_CTR(WORD_CYAN, "Armor Time"), { - armorFinder.run(gimbal_src); + armor_finder.run(gimbal_src); }); } // cv::waitKey(0); diff --git a/others/include/options.h b/others/include/options.h index 498b02d..4f123bd 100644 --- a/others/include/options.h +++ b/others/include/options.h @@ -24,6 +24,6 @@ extern bool show_energy; extern bool save_mark; extern bool show_info; -void process_options(int argc, char *argv[]); +void processOptions(int argc, char **argv); #endif /* _OPTIONS_H_ */ diff --git a/others/src/additions.cpp b/others/src/additions.cpp index 81af7c2..aff1734 100644 --- a/others/src/additions.cpp +++ b/others/src/additions.cpp @@ -26,7 +26,7 @@ extern WrapperHead *video_chassis; extern Serial serial; extern uint8_t last_state; -extern ArmorFinder armorFinder; +extern ArmorFinder armor_finder; extern Energy energy; void uartReceive(Serial *pSerial) { diff --git a/others/src/options.cpp b/others/src/options.cpp index 8671de9..98412f8 100644 --- a/others/src/options.cpp +++ b/others/src/options.cpp @@ -120,7 +120,7 @@ std::map> options = { }} }; -void process_options(int argc, char *argv[]) { +void processOptions(int argc, char **argv) { if (argc >= 2) { for (int i = 1; i < argc; i++) { auto key = options.find(std::string(argv[i])); // 寻找对应选项。