Ask Your Question
0

How to give input parameters to triangulatePoints in python?

asked 2017-09-10 14:51:44 -0600

Naseeb Gill gravatar image

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?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2017-11-05 12:41:28 -0600

carl777 gravatar image

You don't really need to compute rectification transforms (using stereoRectify) unless you want to align epipolar lines and/or do stereo matching. You can just compose the projection matrices from calibration result as (P0 = K [ I | 0 ], P1 = K [ R | T ] ) where I, K, R, & T are the identity matrix, intrinsic camera, rotation and translation matrices respectively. Now you only need the corresponding point from both images (left and right).

edit flag offensive delete link more

Comments

I use two cameras, the parameters of two cameras are K1,K2, so P1 = K1 * [I | 0], P2 = K2 * [R | T]?

friendCYQ gravatar imagefriendCYQ ( 2020-08-05 04:48:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-10 14:51:44 -0600

Seen: 3,776 times

Last updated: Sep 10 '17