问题
i used projectPoints()
function of OpenCV to do projection from world coordinates to pixel coordinates, the output image points are vector point2f, how can I extract the x,y coordinates from imagePoints?
seconde question, some of the imagePoints are negative like below: I just project 2 points and these are the results
[[[-37.95361728 316.5438248 ]]
[[204.89090594 316.5144533 ]]]
if I show these coordinates without the negative sign on the image it is correct
first why i get a negative sign and how can i solve these issues?
i appreciate any help, thanks
this is my code :
import cv2
import numpy as np
objectPoints = np.array([[ -0.8565132125748637 , 0.18200966481269648 , 0.9606457931958912 ],[-0.2565132125748638 , 0.18200966481269648 , 0.9606457931958912]] , np.float)
tvec = np.matrix([[-0.00016514 ],[ 0.00523247 ], [-0.00371881]])
rvec = np.matrix([[0.99987256 , -0.00294761 , -0.01569025],[0.00261951 , 0.99977833 , -0.02089080],[0.01574835 , 0.02084704 , 0.99965864]])
cameraMatrix = np.matrix([[ 381.58892822265625 , 0 , 313.5216979980469 ],[ 0, 381.1356201171875 , 250.1746826171875],[ 0 , 0 , 1 ]])
distCoeffs = np.array([0, 0, 0, 0, 0], np.float)
imagePoints, jacobian = cv2.projectPoints( objectPoints, rvec, tvec, cameraMatrix, distCoeffs )
print(imagePoints)
来源:https://stackoverflow.com/questions/65248761/output-of-projectpoints-function