1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge pull request #16405 from ganesh-k13:bugfix/solvepnp-crash

Added type check for solvePnPGeneric | Issue: #16049

* Added type check

* Added checks before type fix

* Tests for 16049

* calib3d: update solvePnP regression check (16049)
This commit is contained in:
Ganesh Kathiresan
2020-01-23 17:53:03 +05:30
committed by Alexander Alekhin
parent f4147c99c8
commit 504cd8a9f5
2 changed files with 24 additions and 1 deletions
+4 -1
View File
@@ -1009,7 +1009,10 @@ int solvePnPGeneric( InputArray _opoints, InputArray _ipoints,
if (reprojectionError.needed())
{
int type = reprojectionError.type();
int type = (reprojectionError.fixedType() || !reprojectionError.empty())
? reprojectionError.type()
: (max(_ipoints.depth(), _opoints.depth()) == CV_64F ? CV_64F : CV_32F);
reprojectionError.create(solutions, 1, type);
CV_CheckType(reprojectionError.type(), type == CV_32FC1 || type == CV_64FC1,
"Type of reprojectionError must be CV_32FC1 or CV_64FC1!");