Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

yes it does generate some NaN or INF, due to the perspective-divide

            {   // try to achieve the same as reprojectImageTo3D, without generating NaN's
                uchar d = disp.at<uchar>(r,c);
                cv::Scalar t =  Q * cv::Scalar(c,r,d,1);
                if ( abs(t[3]) < 0.0001 )
                    continue;
                pt.x = t[0] / t[3];
                pt.y = t[1] / t[3];
                pt.z = t[2] / t[3];
                break;
            }

yes it does generate some NaN or INF, due to the perspective-divide

            {   // try to achieve the same as reprojectImageTo3D, without generating NaN's
                uchar d = disp.at<uchar>(r,c);
                cv::Scalar t =  Q * cv::Scalar(c,r,d,1);
                if ( abs(t[3]) < 0.0001 )
                    continue;
                pt.x = t[0] / t[3];
                pt.y = t[1] / t[3];
                pt.z = t[2] / t[3];
                break;
            }

or use :

patchNaNs(mat, 0); // available in python, too, unfortunately undocumented

to get rid of them