-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Closed
Labels
Description
System Information
Python version: 3.8.18
OpenCV python version: 4.9.0
Operating System / Platform: Windows-10-10.0.19045-SP0
Detailed description
I tried to run this code, and I set all input parameter type as float32, but it still have following report
Traceback (most recent call last):
File "C:\Users\uqbduan\Desktop\OpenCV-Testing\main.py", line 40, in <module>
imagePoints, _ = cv2.projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs)
cv2.error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\calib3d\src\calibration.cpp:270: error: (-205:Formats of input arguments do not match) All the matrices must have the same data type in function 'cvRodrigues2'
Steps to reproduce
import cv2
import numpy as np
objectPoints = np.array([[181.24588 , 87.80361 , 11.421074],
[ 87.17948 , 184.75563 , 37.223446],
[ 22.558456, 45.495266, 246.05797 ]], dtype=np.float32)
rvec = np.array([[ 0.9357548 , -0.28316498, 0.21019171],
[ 0.30293274, 0.9505806 , -0.06803132],
[-0.18054008, 0.12733458, 0.9752903 ]], dtype=np.float32)
tvec = np.array([[ 69.32692 , 17.602057, 135.77672 ],
[ 33.281876, 180.08907 , 129.4395 ],
[240.9262 , 49.95762 , 61.70667 ]], dtype=np.float32)
cameraMatrix = np.array([[214.0047 , 26.98735 , 253.37799 ],
[189.8172 , 10.038101, 18.862494],
[114.07123 , 200.87277 , 194.56332 ]], dtype=np.float32)
distCoeffs = distCoeffs = np.zeros((3, 1), dtype=np.float32)
imagePoints, _ = cv2.projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs)
print(homogeneous_points)
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable