更新CNN参数和图像显示方式。
This commit is contained in:
@@ -154,7 +154,7 @@ bool judge_light_color(std::vector<LightBlob> &light, std::vector<LightBlob> &co
|
||||
bool ArmorFinder::stateSearchingTarget(cv::Mat &src) {
|
||||
cv::Mat split, src_bin;
|
||||
LightBlobs light_blobs, light_blobs_, light_blobs_real;
|
||||
std::vector<cv::Rect2d> armor_boxes, boxes_number[9];
|
||||
std::vector<cv::Rect2d> armor_boxes, boxes_number[10];
|
||||
armor_box = cv::Rect2d(0,0,0,0);
|
||||
|
||||
cv::cvtColor(src, src_gray, CV_BGR2GRAY);
|
||||
|
||||
@@ -27,29 +27,14 @@ void showArmorBoxClass(std::string window_names, const cv::Mat &src, vector<cv::
|
||||
{
|
||||
image2show = src.clone();
|
||||
}
|
||||
if(!boxes[0].empty()){
|
||||
for(auto box : boxes[0]){
|
||||
cv::rectangle(image2show, box, Scalar(255, 0, 0), 1);
|
||||
}
|
||||
}else if(!boxes[1].empty()){
|
||||
for(auto box : boxes[1]){
|
||||
cv::rectangle(image2show, box, Scalar(0, 255, 0), 1);
|
||||
}
|
||||
}else if(!boxes[2].empty()){
|
||||
for(auto box : boxes[2]){
|
||||
cv::rectangle(image2show, box, Scalar(0, 0, 255), 1);
|
||||
}
|
||||
}else if(!boxes[3].empty()){
|
||||
for(auto box : boxes[3]){
|
||||
cv::rectangle(image2show, box, Scalar(0, 255, 255), 1);
|
||||
}
|
||||
}else if(!boxes[4].empty()){
|
||||
for(auto box : boxes[4]){
|
||||
cv::rectangle(image2show, box, Scalar(255, 0, 255), 1);
|
||||
}
|
||||
}else if(!boxes[5].empty()){
|
||||
for(auto box : boxes[5]){
|
||||
cv::rectangle(image2show, box, Scalar(255, 255, 0), 1);
|
||||
for(int i=0; i<10; i++){
|
||||
if(!boxes[i].empty()){
|
||||
for(auto box : boxes[i]){
|
||||
char buff[2] = {0};
|
||||
buff[0] = i + '0';
|
||||
rectangle(image2show, box, Scalar(0, 255, 0), 1);
|
||||
putText(image2show, buff, Point(box.x+2, box.y+2), cv::FONT_HERSHEY_TRIPLEX, 1, Scalar(255,0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
imshow(window_names, image2show);
|
||||
|
||||
Reference in New Issue
Block a user