python alternative to K and R (camera parameters used in C++) while warping?

asked 2017-03-13 01:56:07 -0600

deathracer99 gravatar image

I was working on opencv stitching_detailed.cpp file where I came across cameraParams ( which basically stores different camera parameters). In the script, once these parameters are estimated, they are used to warp the input images for which the function call looks like this:

warper->warp(img, K, cameras[img_idx].R, INTER_LINEAR, BORDER_REFLECT, img_warped);

where img: input image K : intrinsic parameters R : Rotation matrix

Now I store these parameters (K,R) in a file and later want to use them to make some calls in python. Python opencv provides function called cv2.warpPerspective which takes a transformation matrix , M as input.

From my understanding of the code, M is basically same as K mentioned above but there is no input for R in python. So my question how do I perform warp as done in stitching c++ code in python if I know the parameters involved?

edit retag flag offensive close merge delete