This forum is disabled, please visit https://forum.opencv.org

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;
}
```

2 | No.2 Revision |

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

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.