diff --git a/src/api/processor/points_processor.cc b/src/api/processor/points_processor.cc index 563beb8..9b2fc76 100644 --- a/src/api/processor/points_processor.cc +++ b/src/api/processor/points_processor.cc @@ -46,37 +46,36 @@ bool PointsProcessor::OnProcess( const ObjMat *input = Object::Cast(in); ObjMat *output = Object::Cast(out); - cv::Mat disparity = input->value; - output->value.create(disparity.size(), CV_MAKETYPE(CV_32FC3, 3)); - cv::Mat _3dImage = output->value; + cv::Mat disparity = input->value; + output->value.create(disparity.size(), CV_MAKETYPE(CV_32FC3, 3)); + cv::Mat _3dImage = output->value; - const float bigZ = 10000.f; - cv::Matx44d Q; - Q_.convertTo(Q, CV_64F); + const float bigZ = 10000.f; + cv::Matx44d Q; + Q_.convertTo(Q, CV_64F); - int x, cols = disparity.cols; - CV_Assert(cols >= 0); + int x, cols = disparity.cols; + CV_Assert(cols >= 0); - double minDisparity = FLT_MAX; + double minDisparity = FLT_MAX; - cv::minMaxIdx(disparity, &minDisparity, 0, 0, 0); + cv::minMaxIdx(disparity, &minDisparity, 0, 0, 0); - for (int y = 0; y < disparity.rows; y++) { - float *sptr = disparity.ptr(y); - cv::Vec3f *dptr = _3dImage.ptr(y); + for (int y = 0; y < disparity.rows; y++) { + float *sptr = disparity.ptr(y); + cv::Vec3f *dptr = _3dImage.ptr(y); - for( x = 0; x < cols; x++) - { - double d = sptr[x]; - cv::Vec4d homg_pt = Q*cv::Vec4d(x, y, d, 1.0); - dptr[x] = cv::Vec3d(homg_pt.val); - dptr[x] /= homg_pt[3]; + for (x = 0; x < cols; x++) { + double d = sptr[x]; + cv::Vec4d homg_pt = Q * cv::Vec4d(x, y, d, 1.0); + dptr[x] = cv::Vec3d(homg_pt.val); + dptr[x] /= homg_pt[3]; - if( fabs(d-minDisparity) <= FLT_EPSILON ) { - dptr[x][2] = bigZ; - } - } - } + if (fabs(d - minDisparity) <= FLT_EPSILON) { + dptr[x][2] = bigZ; + } + } + } return true; }