部分统一命名规范。
This commit is contained in:
@@ -51,11 +51,11 @@ extern std::map<string, int> prior_red;
|
|||||||
class LightBlob {
|
class LightBlob {
|
||||||
public:
|
public:
|
||||||
cv::RotatedRect rect; //灯条位置
|
cv::RotatedRect rect; //灯条位置
|
||||||
double areaRatio;
|
double area_ratio;
|
||||||
double length; //灯条长度
|
double length; //灯条长度
|
||||||
uint8_t blob_color; //灯条颜色
|
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);
|
length = max(rect.size.height, rect.size.width);
|
||||||
};
|
};
|
||||||
LightBlob() = default;
|
LightBlob() = default;
|
||||||
|
|||||||
@@ -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 l = 0; l != light_blobs_light.size(); l++) {
|
||||||
for (int d = 0; d != light_blobs_dim.size(); d++) {
|
for (int d = 0; d != light_blobs_dim.size(); d++) {
|
||||||
if (isSameBlob(light_blobs_light[l], light_blobs_dim[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);
|
dim_to_remove.emplace_back(d);
|
||||||
} else {
|
} else {
|
||||||
light_to_remove.emplace_back(l);
|
light_to_remove.emplace_back(l);
|
||||||
|
|||||||
6
main.cpp
6
main.cpp
@@ -44,14 +44,14 @@ WrapperHead *video_chassis = nullptr; // 底盘摄像头视频源
|
|||||||
Serial serial(115200); // 串口对象
|
Serial serial(115200); // 串口对象
|
||||||
uint8_t last_state = INIT_STATE; // 上次状态,用于初始化
|
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);
|
Energy energy(serial, mcu_data.enemy_color);
|
||||||
|
|
||||||
int box_distance = 0;
|
int box_distance = 0;
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
process_options(argc, argv); // 处理命令行参数
|
processOptions(argc, argv); // 处理命令行参数
|
||||||
thread receive(uartReceive, &serial); // 开启串口接收线程
|
thread receive(uartReceive, &serial); // 开启串口接收线程
|
||||||
|
|
||||||
int from_camera = 1; // 根据条件选择视频源
|
int from_camera = 1; // 根据条件选择视频源
|
||||||
@@ -175,7 +175,7 @@ int main(int argc, char *argv[]) {
|
|||||||
if (show_origin) showOrigin(gimbal_src);
|
if (show_origin) showOrigin(gimbal_src);
|
||||||
// });
|
// });
|
||||||
CNT_TIME(STR_CTR(WORD_CYAN, "Armor Time"), {
|
CNT_TIME(STR_CTR(WORD_CYAN, "Armor Time"), {
|
||||||
armorFinder.run(gimbal_src);
|
armor_finder.run(gimbal_src);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// cv::waitKey(0);
|
// cv::waitKey(0);
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ extern bool show_energy;
|
|||||||
extern bool save_mark;
|
extern bool save_mark;
|
||||||
extern bool show_info;
|
extern bool show_info;
|
||||||
|
|
||||||
void process_options(int argc, char *argv[]);
|
void processOptions(int argc, char **argv);
|
||||||
|
|
||||||
#endif /* _OPTIONS_H_ */
|
#endif /* _OPTIONS_H_ */
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ extern WrapperHead *video_chassis;
|
|||||||
extern Serial serial;
|
extern Serial serial;
|
||||||
extern uint8_t last_state;
|
extern uint8_t last_state;
|
||||||
|
|
||||||
extern ArmorFinder armorFinder;
|
extern ArmorFinder armor_finder;
|
||||||
extern Energy energy;
|
extern Energy energy;
|
||||||
|
|
||||||
void uartReceive(Serial *pSerial) {
|
void uartReceive(Serial *pSerial) {
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ std::map<std::string, std::pair<std::string, void(*)(void)>> options = {
|
|||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
|
|
||||||
void process_options(int argc, char *argv[]) {
|
void processOptions(int argc, char **argv) {
|
||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
auto key = options.find(std::string(argv[i])); // 寻找对应选项。
|
auto key = options.find(std::string(argv[i])); // 寻找对应选项。
|
||||||
|
|||||||
Reference in New Issue
Block a user