新版反陀螺。

This commit is contained in:
xinyang committed 2019-08-03 19:00:46 +08:00
1 parent cdd6716214
commit ef32b54761
18 files changed
+148 -73

No files matched your search

@@ -147,7 +147,14 @@ bool ArmorFinder::findArmorBox(const cv::Mat &src, ArmorBox &box) {
armor_box.id = c;
}
}, armor_boxes.size());
sort(armor_boxes.begin(), armor_boxes.end());
sort(armor_boxes.begin(), armor_boxes.end(), [&](const ArmorBox &a, const ArmorBox &b){
if(last_box.rect != cv::Rect2d()){
return getPointLength(a.getCenter()-last_box.getCenter()) <
getPointLength(b.getCenter()-last_box.getCenter());
}else{
return a < b;
}
});
if(armor_boxes[0].id != 0){
box = armor_boxes[0];
}