Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to give input parameters to triangulatePoints in python?

I want to find out 3D coordinates using stereo cameras. For that, I reached up to rectification of images but get stuck at cv2.triangulatePoints. I find out P1 and P2 using cv2.stereoRectify. Now I have to put four parameters in triangulatePoints functions which are projMatr1 (P1), projMatr2 (P2), projPoints1 and projPoints2. Now my first doubt is if P1 and P2 remain same for every pair of images as we are giving input Camera matrices, rotation and translation matrices in stereoRectify? According to me, P1 and P2 should be same as none of input matrices are changing. Now I want to know how to get projPoints1 and projPoints2 to get 3D coordinates. For example, if I know the pixel values of any point A in rectified left image as (Xl,Yl) and same Point A in right image as (Xr,Yr) can I put projPoints1 = (Xl,Yl) and projPoints2 = (Xr,Yr) in triangulatePoints? If not then how to get these projPoints?