From 2f9072efdcf0d72023be31f174bd1bf9abd03757 Mon Sep 17 00:00:00 2001 From: Nathan Godwin Date: Mon, 21 Sep 2020 21:56:28 -0500 Subject: [PATCH] Fixed assertions on ippe solver --- modules/calib3d/src/ippe.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/calib3d/src/ippe.cpp b/modules/calib3d/src/ippe.cpp index 3f1e6a7add..ec6089596c 100644 --- a/modules/calib3d/src/ippe.cpp +++ b/modules/calib3d/src/ippe.cpp @@ -77,18 +77,18 @@ void PoseSolver::solveGeneric(InputArray _objectPoints, InputArray _normalizedIn OutputArray _Ma, OutputArray _Mb) { //argument checking: - size_t n = static_cast(_objectPoints.rows() * _objectPoints.cols()); //number of points + size_t n = static_cast(_normalizedInputPoints.rows()) * static_cast(_normalizedInputPoints.cols()); //number of points int objType = _objectPoints.type(); int type_input = _normalizedInputPoints.type(); CV_CheckType(objType, objType == CV_32FC3 || objType == CV_64FC3, "Type of _objectPoints must be CV_32FC3 or CV_64FC3" ); CV_CheckType(type_input, type_input == CV_32FC2 || type_input == CV_64FC2, - "Type of _normalizedInputPoints must be CV_32FC3 or CV_64FC3" ); + "Type of _normalizedInputPoints must be CV_32FC2 or CV_64FC2" ); CV_Assert(_objectPoints.rows() == 1 || _objectPoints.cols() == 1); CV_Assert(_objectPoints.rows() >= 4 || _objectPoints.cols() >= 4); CV_Assert(_normalizedInputPoints.rows() == 1 || _normalizedInputPoints.cols() == 1); - CV_Assert(static_cast(_objectPoints.rows() * _objectPoints.cols()) == n); + CV_Assert(static_cast(_objectPoints.rows()) * static_cast(_objectPoints.cols()) == n); Mat normalizedInputPoints; if (type_input == CV_32FC2) @@ -101,7 +101,7 @@ void PoseSolver::solveGeneric(InputArray _objectPoints, InputArray _normalizedIn } Mat objectInputPoints; - if (type_input == CV_32FC3) + if (objType == CV_32FC3) { _objectPoints.getMat().convertTo(objectInputPoints, CV_64F); }