Object: I'm trying to get the relative position of the two camera's with calibration.
I'm using openCV to achieve this goal.
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
if ret == True:
corners2 = cv2.cornerSubPix(cam1_img,corners,(11,11),(-1,-1), criteria)
# Find the rotation and translation vectors.
ret, rvecs, tvecs = cv2.solvePnP(objp, corners2, mtx, dist)
# Project 3D points to image plane
imgpts, jac = cv2.projectPoints(axisBoxes, rvecs, tvecs, mtx, dist)
img = drawBoxes(cam1_img,corners2,imgpts)
cv2.imwrite(f'result_img.jpg',img)
This is how I get the result of the rvecs, tvecs(rotation and translation vectors) I try to draw the result with this
R, _ = cv2.Rodrigues(rvecs)
offset = tvecs.T
R2, _ = cv2.Rodrigues(rvecs2)
offset2 = tvecs2.T
ax = pr.plot_basis(ax)
ax = pr.plot_basis(ax,R,offset)
ax = pr.plot_basis(ax,R2,offset2)
Some how the front(blue line) is not facing to the origin basis
so I try to rotate the camera position with z-axis with 180 degree of angle.
R->[[ 0.287 -0.958 0.017]
[ 0.365 0.125 0.923]
[-0.886 -0.259 0.385]]
offset->[[ 3.182 12.088 62.537]]
My Rotation and offset vector looks like this.
- why the camera front(blue line) is not facing to the origin basis?