1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #25824 from j3knk:calib3d/fix_projectpoints

calib3d: fix Rodrigues CV_32F and CV_64F type mismatch in projectPoints #25824

Fixes #25318

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
j3knk
2024-07-15 14:10:08 +02:00
committed by GitHub
parent 81f33103fd
commit e90935e81c
2 changed files with 21 additions and 4 deletions
@@ -67,7 +67,22 @@ class calibration_test(NewOpenCVTests):
self.assertLess(cv.norm(camera_matrix - cameraMatrixTest, cv.NORM_L1), normCamEps)
self.assertLess(cv.norm(dist_coefs - distCoeffsTest, cv.NORM_L1), normDistEps)
def test_projectPoints(self):
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 ], 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((4, 1), dtype=np.float32)
imagePoints, jacobian = cv.projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs)
self.assertTrue(imagePoints is not None)
self.assertTrue(jacobian is not None)
if __name__ == '__main__':
NewOpenCVTests.bootstrap()