|
@@ -74,27 +74,31 @@ void DetectManager::run() {
|
|
|
DLOG(INFO) << "cost time is " << cost.count() * 1000 << " ms";
|
|
|
|
|
|
// 标记识别点云
|
|
|
- for (auto &obj: objs) {
|
|
|
- auto seg_points = detector->getPointsFromObj(obj);
|
|
|
- int device_index = (int(obj.rect.x / 640) * 0x01) | (int(obj.rect.y / 480) << 1);
|
|
|
+ for (auto iter = objs.begin(); iter != objs.end(); iter++) {
|
|
|
+ auto seg_points = detector->getPointsFromObj(*iter);
|
|
|
+ int device_index = (int(iter->rect.x / 640) * 0x01) | (int(iter->rect.y / 480) << 1);
|
|
|
// 校验识别矩形框是否越界
|
|
|
- int device_index_check = (int((obj.rect.x + obj.rect.width) / 640) * 0x01) | (int((obj.rect.y + obj.rect.height) / 480) << 1);
|
|
|
+ int device_index_check = (int((iter->rect.x + iter->rect.width) / 640) * 0x01) | (int((iter->rect.y + iter->rect.height) / 480) << 1);
|
|
|
if (device_index != device_index_check) {
|
|
|
// TODO:存图
|
|
|
+ LOG(INFO) << "device_index_check " << device_index_check << " != device_index " << device_index;
|
|
|
+ LOG(INFO) << "obj.rect.x: " << iter->rect.x << ", iter->rect.y: " << iter->rect.x << ", obj.rect.width: " << iter->rect.width << ", obj.rect.height: " << iter->rect.height;
|
|
|
+ objs.erase(iter);
|
|
|
+ iter--;
|
|
|
continue;
|
|
|
}
|
|
|
- detect_result.wheel[device_index].confidence = obj.prob;
|
|
|
+ detect_result.wheel[device_index].confidence = iter->prob;
|
|
|
|
|
|
- if (obj.prob > 0.9) {
|
|
|
+ if (iter->prob > 0.9) {
|
|
|
detect_result.wheel[device_index].detectOk = true;
|
|
|
- float d = MAX(obj.rect.height, obj.rect.width) / 2;
|
|
|
+ float d = MAX(iter->rect.height, iter->rect.width) / 2;
|
|
|
pcl::PointXYZ point;
|
|
|
int x_alpha = (device_index & 0x1);
|
|
|
int y_alpha = ((device_index & 0x2) >> 1);
|
|
|
for (auto &pt: seg_points) { // use 7.5~9ms
|
|
|
pt.x -= x_alpha * t_device_mat[device_index].irMat.cols;
|
|
|
pt.y -= y_alpha * t_device_mat[device_index].irMat.rows;
|
|
|
- t_device_mat[device_index].pointMat.at<cv::Vec4f>(pt)[3] = obj.prob;
|
|
|
+ t_device_mat[device_index].pointMat.at<cv::Vec4f>(pt)[3] = iter->prob;
|
|
|
point.x = t_device_mat[device_index].pointMat.at<cv::Vec4f>(pt)[0];
|
|
|
point.y = t_device_mat[device_index].pointMat.at<cv::Vec4f>(pt)[1];
|
|
|
point.z = t_device_mat[device_index].pointMat.at<cv::Vec4f>(pt)[2];
|