Merge remote-tracking branch 'origin/master'

This commit is contained in:
xinyang
2019-08-06 14:14:13 +08:00
20 changed files with 41326 additions and 17923 deletions

View File

@@ -92,8 +92,9 @@ void ArmorFinder::run(cv::Mat &src) {
stateStandBy();
}
end:
antiTop();
// antiTop();
if(target_box.rect != cv::Rect2d())
sendBoxPosition(0);
if (show_armor_box) { // 根据条件显示当前目标装甲板
showArmorBox("box", src, target_box);
cv::waitKey(1);

View File

@@ -27,10 +27,10 @@ static bool isValidLightBlob(const std::vector<cv::Point> &contour, const cv::Ro
// 此函数可以有性能优化.
static uint8_t get_blob_color(const cv::Mat &src, const cv::RotatedRect &blobPos) {
auto region = blobPos.boundingRect();
region.x -= fmax(2, region.width * 0.1);
region.y -= fmax(2, region.height * 0.05);
region.width += 2 * fmax(2, region.width * 0.1);
region.height += 2 * fmax(2, region.height * 0.05);
region.x -= fmax(3, region.width * 0.1);
region.y -= fmax(3, region.height * 0.05);
region.width += 2 * fmax(3, region.width * 0.1);
region.height += 2 * fmax(3, region.height * 0.05);
region &= cv::Rect(0, 0, src.cols, src.rows);
cv::Mat roi = src(region);
int red_cnt = 0, blue_cnt = 0;