0

I have two images of the same object that were taken from different positions and an uncalibrated camera. I want to treat these images pair as stereo pairs. Then I can estimate a fundamental matrix, without any knowledge of the scene. I want to know the rotation angle between camera two relative to the first one.

  1. pts1 and pts2 are the array of matching key points that are obtained from one of the known Feature Descriptor methods. RANSAC is used to exclude outliers.

F, mask = cv2.findFundamentalMat(pts1,pts2,v2.FM_RANSAC, 3,0.99 )

  1. p1fNew and p2fNew - inliers of key points With the stereoRectifyUncalibrated method, I can obtain two matrices to rectify images into the same plane. retBool, H1, H2 = cv2.stereoRectifyUncalibrated(p1fNew,p2fNew, F, image_size)

By multiplying these matrices I can estimate transformation of one image plane to another: T = np.linalg.inv(np.mat(H1)) * np.mat(H2)

How do I decompose this T matrix and extract from it rotation information and vector direction from the first image center to another?

Asylbek
  • 21
  • 3
  • You could try a version of the overloaded `cv::recoverPose` and use e.g. `cv.recoverPose( E, points1, points2, cameraMatrix[, R[, t[, mask]]]`. Instead of the calibrated Essential Matrix E you insert your estimated Fundamental Matrix and check the result of R and t. Using the Fundamental Matrix lets you only determine the translation t up to scale. For a precise solution you need to calibrate the camera. – Grillteller Nov 16 '21 at 11:42
  • Thanks Grillteller. However, I dont have information about the scene, so Essential mat can not be estimated. That is why I am trying to retreat Fundamental matrix to rectify uncalibrated cameras with cv2.stereoRectifyUncalibrated(p1fNew,p2fNew, F, imsize). As I understood I can retreat two homography matrices, and translate perspective to orthogonal projections (which is my goal). however, I want to estimate relative angle between those cameras. – Yulia Grinblat Nov 17 '21 at 08:26
  • I think it is theoretically possible (Hartley, Zisserman pp. 253) but I never found code nor implementations for it. I went with just a rough estimate for the camera matrices (fx, fy = 1.25*max(img_width, img_height), ppx, ppy = center of the image and then used `recoverPose()`. Maybe this would work for your case. – Grillteller Nov 18 '21 at 13:53

0 Answers0