Ask Your Question
0

Difference between undistortPoints() and projectPoints() in OpenCV

asked 2017-02-21 08:35:58 -0500

rueynshard gravatar image

From my understanding, undistortPoints() takes a set of points on a distorted image, and calculates where their coordinates would be on an undistorted version of the same image. projectPoints() maps a set of object coordinates to their corresponding image coordinates.

However, I am unsure if projectPoints() maps the object coordinates to a set of image points on the distorted image (ie. the original image) or one that has been undistorted (straight lines)?

Furthermore, the OpenCV documentation for undistortPoints states that 'the function performs a reverse transformation to projectPoints()'. Could you please explain how this is so?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2017-02-21 18:03:36 -0500

Tetragramm gravatar image

undistortPoints is a special case of the reverse projectPoints function.

So, if you pass undistortPoints with no P parameter, then projectPoints with rvec=tvec=(0,0,0) and the camera matrix will return them to the original location. If you do give undistortPoints a P parameter, then using the identity matrix will return them to the original location. Note that for both of these you must convert the 2d points to 3d before passing to projectPoints.

projectPoints has several other uses. If you have true 3d points, you can place them onto an image (either distorted or undistorted). Pass in the camera rvec and tvec, as well as the camera matrix. To place them onto a distorted image, also pass the camera distortion matrix. To place them on an undistorted image, pass noArray or zeros.

NOTE: I don't think project points checks direction, so if you have points in front of and behind the camera, you will get answers for both on the plane of the image. I think, I'm not in a place to test right now.

The Jacobian is useful for many things, but if you don't need it, don't worry about it. If you do need it, you ought to already know what it is and what it means.

edit flag offensive delete link more

Comments

Thank you! This was really helpful

rueynshard gravatar imagerueynshard ( 2017-02-21 20:30:28 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-02-21 08:35:58 -0500

Seen: 901 times

Last updated: Feb 21 '17