Does triangulatePoints() undistort and rectify given points?

Dear community,
I am trying to recover 3d Pose from 2 corresponding observations of a stereo camera setup. I did a stereo camera calibration initially so I have my P1, P2, R1 and R2 as well as my 2 points at hand.

To obtain 3D Points I first undistort my initial corresponding pixel coordinates with undistortPoints() and triangulate them using triangulatePoints()

However I am confused about how triangulatePoints() preprocesses its arguments because I am getting nonsense result which does not correspond to ground truth at all. So I am starting to debug.

Therefore my question is: Does triangulatePoints do undistortion too or do I have to cakk it myself?

And in which case do I need to pass R1/R2 and/or P1/P2 into undistortPoints()

Thank you in advance for your help!

it can’t. it doesn’t take any arguments required for that operation.

I can’t comment on the other question.

TriangulatePoints() returns “OutputArray points4D”.
But OutputArray doesn’t directly mean XYZ data.
You need to recalculate the OutputArray to reconstruct the 3D data.

@JeremyWright your statement contradicts documentation: OpenCV: Triangulation

Your link mentioned cv::sfm::triangulatePoints.
I mentioned the cv::triangulatePoints.
https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#gad3fc9a0c82b08df034234979960b778c

1 Like

good catch.

so the results need to be converted to 3D, by dividing by the fourth component of each vector.

there is convertPointsFromHomogeneous to do that.

https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#gac42edda3a3a0f717979589fcd6ac0035