AutoCar  v1.0.0
autocar::vision_mul::armor_detecter Class Reference
Inheritance diagram for autocar::vision_mul::armor_detecter:
Collaboration diagram for autocar::vision_mul::armor_detecter:

Public Member Functions

 armor_detecter (bool debug_on)
 constructor
 
cv::Mat highlight_blue_or_red (const cv::Mat &image, bool detect_blue)
 Highlight the blue or red region of the image. More...
 
std::vector< std::vector< cv::Point > > find_contours (const cv::Mat &binary)
 The wrapper for function cv::findContours. More...
 
std::vector< cv::RotatedRect > to_light_rects (const std::vector< std::vector< cv::Point >> &contours_light, const std::vector< std::vector< cv::Point >> &contours_brightness)
 Finding the true light contour. More...
 
std::vector< cv::RotatedRect > detect_lights (bool detect_blue)
 detect the lights on the armors More...
 
std::vector< cv::RotatedRect > filter_lights (const std::vector< cv::RotatedRect > &lights, float thresh_max_angle, float thresh_min_area)
 Filtering the detected lights. More...
 
std::vector< armor_infopossible_armors (const std::vector< cv::RotatedRect > &lights, float thres_max_angle, float thres_dis_lower, float thres_dis_upper, float thres_len, float thres_height, float thres_gray, bool detect_blue)
 The possible armors. More...
 
void cal_armor_info (std::vector< cv::Point2f > &armor_points, cv::RotatedRect left_light, cv::RotatedRect right_light)
 
std::vector< armor_infofilter_by_features (std::vector< armor_info > &armors)
 Filtering Detected armors by aspect ratio, conv and so on. More...
 
bool detect (const cv::Mat &image, bool detect_blue)
 The entrance function of armor detect. More...
 
void slect_final_armor (std::vector< armor_info > all_armors)
 Slect one armor as the target armor which we will shoot. More...
 
armor_infoget_armor ()
 Get the private armor information. More...
 
void debug_vision ()
 Show the processed image for debug.
 

Member Function Documentation

bool autocar::vision_mul::armor_detecter::detect ( const cv::Mat &  image,
bool  detect_blue 
)
virtual

The entrance function of armor detect.

Parameters
imagergb image
Returns
return ture if find armor, else return false

Implements autocar::vision_mul::detect_factory.

std::vector<cv::RotatedRect> autocar::vision_mul::armor_detecter::detect_lights ( bool  detect_blue)

detect the lights on the armors

Parameters
detect_bluetrue represent blue, false represent red
Returns
std::vector<armor_info> autocar::vision_mul::armor_detecter::filter_by_features ( std::vector< armor_info > &  armors)

Filtering Detected armors by aspect ratio, conv and so on.

Parameters
armorsdetected armors ref
Returns
filtered armors
std::vector<cv::RotatedRect> autocar::vision_mul::armor_detecter::filter_lights ( const std::vector< cv::RotatedRect > &  lights,
float  thresh_max_angle,
float  thresh_min_area 
)

Filtering the detected lights.

Parameters
lightsdetected lights ref
thresh_max_anglethe max area of the lights
thresh_min_areathe min area of the lights
Returns
std::vector<std::vector<cv::Point> > autocar::vision_mul::armor_detecter::find_contours ( const cv::Mat &  binary)

The wrapper for function cv::findContours.

Parameters
binarybinary image
Returns
contour
armor_info* autocar::vision_mul::armor_detecter::get_armor ( )

Get the private armor information.

Returns
cv::Mat autocar::vision_mul::armor_detecter::highlight_blue_or_red ( const cv::Mat &  image,
bool  detect_blue 
)

Highlight the blue or red region of the image.

Parameters
imageinput image ref
detect_bluetrue represent blue, false represent red
Returns
gray image
std::vector<armor_info> autocar::vision_mul::armor_detecter::possible_armors ( const std::vector< cv::RotatedRect > &  lights,
float  thres_max_angle,
float  thres_dis_lower,
float  thres_dis_upper,
float  thres_len,
float  thres_height,
float  thres_gray,
bool  detect_blue 
)

The possible armors.

Parameters
detectedlights beside the armors
thres_max_anglethe max angle of the armor
thres_dis_lower
thres_dis_upper
thres_len
thres_height
thres_gray
detect_blue
Returns
void autocar::vision_mul::armor_detecter::slect_final_armor ( std::vector< armor_info all_armors)

Slect one armor as the target armor which we will shoot.

Parameters
all_armorsall detected armors
Returns
the target armor
std::vector<cv::RotatedRect> autocar::vision_mul::armor_detecter::to_light_rects ( const std::vector< std::vector< cv::Point >> &  contours_light,
const std::vector< std::vector< cv::Point >> &  contours_brightness 
)

Finding the true light contour.

Parameters
contours_lightblue or red region contour
contours_brightnessgray image contour
Returns
light contour

The documentation for this class was generated from the following file: