energy change

This commit is contained in:
sun
2019-07-25 09:21:08 +08:00
parent c934aa111c
commit b8c6a1671c
6 changed files with 17 additions and 12 deletions

View File

@@ -16,7 +16,7 @@ static bool sendTarget(Serial &serial, double x, double y, double z, uint16_t sh
time_t t = time(nullptr);
if (last_time != t) {
last_time = t;
cout << "fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl;
cout << "Armor: fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl;
fps = 0;
}
fps += 1;

View File

@@ -1,8 +1,6 @@
//
// Created by xixiliadorabarry on 1/24/19.
//
#define LOG_LEVEL LOG_NONE
#include "energy/energy.h"
#include "log.h"
@@ -154,7 +152,7 @@ bool Energy::findCenterR(const cv::Mat src) {
// cout << cur_rect.center << endl;
return true;
}
LOGM(STR_CTR(WORD_RED_CODE, "find center R false!"));
if (show_info)cout << "find center R false!" << endl;
// cv::waitKey(0);
return false;
@@ -201,7 +199,7 @@ bool Energy::findFlowStripFan(const cv::Mat src) {
}
// cout << "flow_strip_fans_cnt: " << flow_strip_fans.size() << endl;
if (flow_strip_fans.empty()) {
LOGM(STR_CTR(WORD_RED_CODE, "flow strip fan false!"));
if (show_info)cout << "flow strip fan false!" << endl;
return false;
} else {
return true;
@@ -269,11 +267,11 @@ bool Energy::findFlowStrip(const cv::Mat src) {
}
// cout << "flow strip cnt: " << flow_strips.size() << endl;
if (flow_strips.empty()) {
LOGM(STR_CTR(WORD_RED_CODE, "flow strip false!"));
if (show_info)cout << "flow strip false!" << endl;
// waitKey(0);
return false;
} else if (flow_strips.size() > 1) {
LOGM(STR_CTR(WORD_RED_CODE, "Too many flow strips!"));
if (show_info)cout << "Too many flow strips!" << endl;
// waitKey(0);
return false;
} else {

View File

@@ -1,7 +1,6 @@
//
// Created by xixiliadorabarry on 1/24/19.
//
#define LOG_LEVEL LOG_NONE
#include "energy/energy.h"
#include "log.h"
@@ -70,7 +69,7 @@ bool Energy::findTargetInFlowStripFan() {
}
// cout << "target armor cnt: " << target_armors.size() << endl;
if (target_armors.empty()) {
LOGM(STR_CTR(WORD_RED_CODE, "find target armor false"));
if (show_info)cout << "find target armor false" << endl;
return false;
} else {
return true;

View File

@@ -51,7 +51,7 @@ void Energy::sendTarget(Serial &serial, float x, float y, float z) {
time_t t = time(nullptr);
if (last_time != t) {
last_time = t;
// cout << "fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl;
cout << "Energy: fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl;
fps = 0;
}
fps += 1;
@@ -87,7 +87,7 @@ void Energy::sendTarget(Serial &serial, float x, float y, uint16_t z, uint16_t u
time_t t = time(nullptr);
if (last_time != t) {
last_time = t;
cout << "energy fps:" << fps << ", (" << x << "," << y << "," << z << "," << u << ")" << endl;
cout << "Energy: fps:" << fps << ", (" << x << "," << y << "," << z << "," << u << ")" << endl;
fps = 0;
}
fps += 1;

View File

@@ -18,6 +18,7 @@ extern bool save_labelled_boxes;
extern bool show_process;
extern bool show_energy;
extern bool save_mark;
extern bool show_info;
void process_options(int argc, char *argv[]);

View File

@@ -17,6 +17,7 @@ bool save_labelled_boxes = false;
bool show_process = false;
bool show_energy = false;
bool save_mark = false;
bool show_info = false;
void process_options(int argc, char *argv[]) {
if (argc >= 2) {
@@ -54,6 +55,8 @@ void process_options(int argc, char *argv[]) {
LOGM("Enable show processed image");
show_energy = true;
LOGM("Enable show energy part");
show_info = true;
LOGM("Show information!");
} else if (strcmp(argv[i], "--run-with-camera") == 0) {
run_with_camera = true;
LOGM("Run with camera!");
@@ -75,9 +78,13 @@ void process_options(int argc, char *argv[]) {
} else if (strcmp(argv[i], "--save-mark") == 0) {
save_mark = true;
LOGM("Write down mark");
} else if (strcmp(argv[i], "--show-info") == 0) {
show_info = true;
LOGM("Show information!");
} else {
LOGW("Unknown option: %s. Use --help to see options.", argv[i]);
}
}
}
}