Search code examples
opencv3dstereo-3d

OpenCV-Stereo: How to check the validity of a 3D point (x,y,z)?


In OpenCV stereo, how do you check whether a given 3D point (x,y,z) can be projected onto a left/right image plane? I have calibrated camera parameters obtained by stereoRectify.

More specifically, I'd like to use projectPoints with "valid" 3D points. I'd like to remove invalid points from the original set of 3D points.

Thanks!


edited@2016-05-06

Regarding the "validity": I found that projectPoints returned very strange values when I gave some 3D points that were definitely outer area of the image. For example points on a big cone surface defined in 3D were not correctly converted to points on the image as I expected.


Solution

  • My solution was avoiding using projectPoints. Since the projectPoints function involves projection from 3D to 2D with considering camera parameters, it is a bit complicated. Rather than using projectPoints, I projected 3D points onto rectified images only with the projection matrices obtained by stereoRectify.