diff --git a/src/components/projection.cpp b/src/components/projection.cpp index 93bdd066a73b36b7729b59b596ff7ec9a633e334..21988dceefd35af79144234043139f1caf1f4a14 100644 --- a/src/components/projection.cpp +++ b/src/components/projection.cpp @@ -172,6 +172,8 @@ void Projection::buildFrame(cv::Mat_<float> &depth, cv::Mat_<cv::Point2i> &frame /* fill with value of the 1st non null neighbour + Fixe only the holes formed by the deprojection round up coordinates (because deproject goes from 3D floats values to 2D uint), + not the big deprojection (like a hand moving above the sand). */ void Projection::holeFilling(cv::Mat_<cv::Vec3b> &dst, cv::Mat_<cv::Point2i> &frameMap){ @@ -183,8 +185,8 @@ void Projection::holeFilling(cv::Mat_<cv::Vec3b> &dst, cv::Mat_<cv::Point2i> &fr cv::Vec3b color; bool found = false; - for(int d_y = -1; d_y <= 1 && !found; d_y++){ - for(int d_x = -1; d_x <= 1 && !found; d_x++){ + for(int d_y = -1; d_y <= 1; d_y++){ + for(int d_x = -1; d_x <= 1; d_x++){ if(!(d_x == 0 && d_y == 0)){ @@ -193,9 +195,12 @@ void Projection::holeFilling(cv::Mat_<cv::Vec3b> &dst, cv::Mat_<cv::Point2i> &fr if( ((0 <= x && x < dst.cols) && (0 <= y && y < dst.rows)) && (frameMap.at<cv::Point2i>(y,x) != cv::Point2i(-1,-1)) ){ color = dst.at<cv::Vec3b>(y,x); found = true; + break; } } } + if(found) + break; } if(found){