fix bug
This commit is contained in:
@@ -117,10 +117,10 @@ static bool findArmorBoxes(LightBlobs &light_blobs, std::vector<cv::Rect2d> &arm
|
||||
cv::Rect2d rect_left = light_blobs.at(static_cast<unsigned long>(i)).rect.boundingRect();
|
||||
cv::Rect2d rect_right = light_blobs.at(static_cast<unsigned long>(j)).rect.boundingRect();
|
||||
double min_x, min_y, max_x, max_y;
|
||||
min_x = fmin(rect_left.x, rect_right.x);
|
||||
max_x = fmax(rect_left.x + rect_left.width, rect_right.x + rect_right.width);
|
||||
min_y = fmin(rect_left.y, rect_right.y) - 3;
|
||||
max_y = fmax(rect_left.y + rect_left.height, rect_right.y + rect_right.height) + 3;
|
||||
min_x = fmin(rect_left.x, rect_right.x) - 4;
|
||||
max_x = fmax(rect_left.x + rect_left.width, rect_right.x + rect_right.width) + 4;
|
||||
min_y = fmin(rect_left.y, rect_right.y) - 4;
|
||||
max_y = fmax(rect_left.y + rect_left.height, rect_right.y + rect_right.height) + 4;
|
||||
if (min_x < 0 || max_x > 640 || min_y < 0 || max_y > 480) {
|
||||
continue;
|
||||
}
|
||||
|
||||
14
main.cpp
14
main.cpp
@@ -30,14 +30,14 @@ int state = ARMOR_STATE;
|
||||
float curr_yaw = 0, curr_pitch = 0;
|
||||
float mark_yaw = 0, mark_pitch = 0;
|
||||
int mark = 0;
|
||||
bool use_classifier = false;
|
||||
bool use_classifier = true;
|
||||
|
||||
void uartReceive(Uart *uart);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
process_options(argc, argv);
|
||||
Uart uart;
|
||||
thread receive(uartReceive, &uart);
|
||||
// thread receive(uartReceive, &uart);
|
||||
bool flag = true;
|
||||
|
||||
while (flag) {
|
||||
@@ -53,13 +53,13 @@ int main(int argc, char *argv[]) {
|
||||
WrapperHead *video_armor;
|
||||
WrapperHead *video_energy;
|
||||
if (from_camera) {
|
||||
video_armor = new CameraWrapper(0, "armor");
|
||||
video_energy = new CameraWrapper(1, "energy");
|
||||
video_armor = new CameraWrapper(0/*, "armor"*/);
|
||||
// video_energy = new CameraWrapper(1, "energy");
|
||||
} else {
|
||||
video_armor = new VideoWrapper("/home/xinyang/Desktop/DataSets/video/blue_4.mp4");
|
||||
video_energy = new VideoWrapper("/home/xinyang/Desktop/DataSets/video/blue_4.mp4");
|
||||
}
|
||||
if (video_armor->init() && video_energy->init()) {
|
||||
if (video_armor->init()/* && video_energy->init()*/) {
|
||||
cout << "Video source initialization successfully." << endl;
|
||||
} else {
|
||||
delete video_armor;
|
||||
@@ -70,7 +70,7 @@ int main(int argc, char *argv[]) {
|
||||
Mat energy_src, armor_src;
|
||||
for(int i=0; i<10; i++){
|
||||
video_armor->read(armor_src);
|
||||
video_energy->read(armor_src);
|
||||
// video_energy->read(armor_src);
|
||||
}
|
||||
|
||||
ArmorFinder armorFinder(ENEMY_BLUE, uart, PROJECT_DIR"/tools/para/", use_classifier);
|
||||
@@ -79,7 +79,7 @@ int main(int argc, char *argv[]) {
|
||||
energy.setAllyColor(ally_color);
|
||||
energy.setRotation(energy_part_rotation);
|
||||
|
||||
bool ok = video_armor->read(armor_src) && video_energy->read(armor_src);
|
||||
bool ok = video_armor->read(armor_src)/* && video_energy->read(armor_src)*/;
|
||||
|
||||
while (ok) {
|
||||
CNT_TIME(WORD_LIGHT_CYAN, "Total", {
|
||||
|
||||
Reference in New Issue
Block a user