diff --git a/modules/core/include/visp3/core/vpImageMorphology.h b/modules/core/include/visp3/core/vpImageMorphology.h index dab0ee754b..b73848a3c9 100644 --- a/modules/core/include/visp3/core/vpImageMorphology.h +++ b/modules/core/include/visp3/core/vpImageMorphology.h @@ -137,6 +137,39 @@ class VISP_EXPORT vpImageMorphology #endif private: + template + class vpPixelOperation + { + public: + vpPixelOperation() { } + + virtual T operator()(const T &, const T &) = 0; + }; + + template + class vpPixelOperationMax : public vpPixelOperation + { + public: + vpPixelOperationMax() { } + + virtual T operator()(const T &a, const T &b) VP_OVERRIDE + { + return std::max(a, b); + } + }; + + template + class vpPixelOperationMin : public vpPixelOperation + { + public: + vpPixelOperationMin() { } + + T operator()(const T &a, const T &b) VP_OVERRIDE + { + return std::min(a, b); + } + }; + /** * \brief Modify the image by applying the \b operation on each of its elements on a 3x3 * grid. @@ -149,7 +182,7 @@ class VISP_EXPORT vpImageMorphology * and vertical neighbors, or a 8-connexity, if we want to also take into account the diagonal neighbors. */ template - static void imageOperation(vpImage &I, const T &null_value, const T &(*operation)(const T &, const T &), const vpConnexityType &connexity = CONNEXITY_4); + static void imageOperation(vpImage &I, const T &null_value, vpPixelOperation *operation, const vpConnexityType &connexity = CONNEXITY_4); /** * \brief Modify the image by applying the \b operation on each of its elements on a \b size x \b size @@ -161,7 +194,7 @@ class VISP_EXPORT vpImageMorphology * \param[in] size Size of the kernel of the operation. */ template - static void imageOperation(vpImage &I, const T &(*operation)(const T &, const T &), const int &size = 3); + static void imageOperation(vpImage &I, vpPixelOperation *operation, const int &size = 3); }; @@ -323,7 +356,7 @@ void vpImageMorphology::dilatation(vpImage &I, Type value, Type value_out, } template -void vpImageMorphology::imageOperation(vpImage &I, const T &null_value, const T &(*operation)(const T &, const T &), const vpConnexityType &connexity) +void vpImageMorphology::imageOperation(vpImage &I, const T &null_value, vpPixelOperation *operation, const vpConnexityType &connexity) { const int width_in = I.getWidth(); const int height_in = I.getHeight(); @@ -343,7 +376,7 @@ void vpImageMorphology::imageOperation(vpImage &I, const T &null_value, const for (int j = 0; j < width_in; ++j) { T value = null_value; for (int k = 0; k < nbOffset; ++k) { - value = operation(value, J[i + 1 + offset_y[k]][j + 1 + offset_x[k]]); + value = (*operation)(value, J[i + 1 + offset_y[k]][j + 1 + offset_x[k]]); } I[i][j] = value; @@ -359,7 +392,7 @@ void vpImageMorphology::imageOperation(vpImage &I, const T &null_value, const for (int j = 0; j < width_in; ++j) { T value = null_value; for (int k = 0; k < nbOffset; ++k) { - value = operation(value, J[i + 1 + offset_y[k]][j + 1 + offset_x[k]]); + value = (*operation)(value, J[i + 1 + offset_y[k]][j + 1 + offset_x[k]]); } I[i][j] = value; @@ -394,8 +427,8 @@ void vpImageMorphology::imageOperation(vpImage &I, const T &null_value, const template void vpImageMorphology::erosion(vpImage &I, const vpConnexityType &connexity) { - const T &(*operation)(const T & a, const T & b) = std::min; - vpImageMorphology::imageOperation(I, std::numeric_limits::max(), operation, connexity); + vpPixelOperationMin operation; + vpImageMorphology::imageOperation(I, std::numeric_limits::max(), &operation, connexity); } /*! @@ -424,12 +457,12 @@ void vpImageMorphology::erosion(vpImage &I, const vpConnexityType &connexity) template void vpImageMorphology::dilatation(vpImage &I, const vpConnexityType &connexity) { - const T &(*operation)(const T & a, const T & b) = std::max; - vpImageMorphology::imageOperation(I, std::numeric_limits::min(), operation, connexity); + vpPixelOperationMax operation; + vpImageMorphology::imageOperation(I, std::numeric_limits::min(), &operation, connexity); } template -void vpImageMorphology::imageOperation(vpImage &I, const T &(*operation)(const T &, const T &), const int &size) +void vpImageMorphology::imageOperation(vpImage &I, vpPixelOperation *operation, const int &size) { if ((size % 2) != 1) { throw(vpException(vpException::badValue, "Dilatation/erosion kernel must be odd.")); @@ -461,7 +494,7 @@ void vpImageMorphology::imageOperation(vpImage &I, const T &(*operation)(cons } for (int r_iterator = r_iterator_start; r_iterator < r_iterator_stop; ++r_iterator) { for (int c_iterator = c_iterator_start; c_iterator < c_iterator_stop; ++c_iterator) { - value = operation(value, J[r + r_iterator][c + c_iterator]); + value = (*operation)(value, J[r + r_iterator][c + c_iterator]); } } I[r][c] = value; @@ -498,8 +531,8 @@ void vpImageMorphology::imageOperation(vpImage &I, const T &(*operation)(cons template void vpImageMorphology::erosion(vpImage &I, const int &size) { - const T &(*operation)(const T & a, const T & b) = std::min; - vpImageMorphology::imageOperation(I, operation, size); + vpPixelOperationMin operation; + vpImageMorphology::imageOperation(I, &operation, size); } /** @@ -530,8 +563,8 @@ void vpImageMorphology::erosion(vpImage &I, const int &size) template void vpImageMorphology::dilatation(vpImage &I, const int &size) { - const T &(*operation)(const T & a, const T & b) = std::max; - vpImageMorphology::imageOperation(I, operation, size); + vpPixelOperationMax operation; + vpImageMorphology::imageOperation(I, &operation, size); } END_VISP_NAMESPACE #endif diff --git a/modules/core/include/visp3/core/vpMath.h b/modules/core/include/visp3/core/vpMath.h index c4561b5c0b..adb42b7c0f 100644 --- a/modules/core/include/visp3/core/vpMath.h +++ b/modules/core/include/visp3/core/vpMath.h @@ -356,9 +356,11 @@ class VISP_EXPORT vpMath } static std::vector > computeRegularPointsOnSphere(unsigned int maxPoints); + + typedef vpHomogeneousMatrix(*LongLattToHomogeneous)(double lonDeg, double latDeg, double radius); static std::vector getLocalTangentPlaneTransformations(const std::vector > &lonlatVec, double radius, - vpHomogeneousMatrix(*toECEF)(double lonDeg, double latDeg, double radius)); + LongLattToHomogeneous func); static vpHomogeneousMatrix lookAt(const vpColVector &from, const vpColVector &to, vpColVector tmp); diff --git a/modules/core/include/visp3/core/vpMatrix.h b/modules/core/include/visp3/core/vpMatrix.h index bf35979321..f14e76d531 100644 --- a/modules/core/include/visp3/core/vpMatrix.h +++ b/modules/core/include/visp3/core/vpMatrix.h @@ -581,6 +581,8 @@ class VISP_EXPORT vpMatrix : public vpArray2D int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, int rank_in) const; int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, int rank_in, vpMatrix &imA, vpMatrix &imAt, vpMatrix &kerAt) const; #endif + + vpMatrix dampedInverse(const double &ratioOfMaxSvd = 1e-4) const; //@} //------------------------------------------------- diff --git a/modules/core/src/camera/vpXmlParserCamera.cpp b/modules/core/src/camera/vpXmlParserCamera.cpp index b8d0b8751b..094e4cb742 100644 --- a/modules/core/src/camera/vpXmlParserCamera.cpp +++ b/modules/core/src/camera/vpXmlParserCamera.cpp @@ -308,9 +308,10 @@ class vpXmlParserCamera::Impl // if same name && same projection model && same image size camera already exists, we return SEQUENCE_OK // otherwise it is a new camera that need to be updated and we return SEQUENCE_OK bool same_name = (cam_name.empty() || (cam_name == camera_name_tmp)); - bool same_img_size = (abs(static_cast(im_width) - static_cast(image_width_tmp)) < allowedPixelDiffOnImageSize || im_width == 0) && - (abs(static_cast(im_height) - static_cast(image_height_tmp)) < allowedPixelDiffOnImageSize || im_height == 0) && - (test_subsampling_width) && (test_subsampling_height); + bool imWidthOk = (abs(static_cast(im_width) - static_cast(image_width_tmp)) < allowedPixelDiffOnImageSize) || (im_width == 0); + bool imHeightOk = (abs(static_cast(im_height) - static_cast(image_height_tmp)) < allowedPixelDiffOnImageSize) || (im_height == 0); + bool imSizeOk = imWidthOk && imHeightOk; + bool same_img_size = imSizeOk && test_subsampling_width && test_subsampling_height; if (same_name && same_img_size && same_proj_model) { back = SEQUENCE_OK; // Camera exists camera = cam_tmp; @@ -761,10 +762,13 @@ class vpXmlParserCamera::Impl } } } - if (!((cam_name == camera_name_tmp) && (im_width == image_width_tmp || im_width == 0) && - (im_height == image_height_tmp || im_height == 0) && - (subsampl_width == subsampling_width_tmp || subsampl_width == 0) && - (subsampl_height == subsampling_height_tmp || subsampl_height == 0))) { + bool imHeightOK = (im_height == image_height_tmp) || (im_height == 0); + bool imWidthOK = (im_width == image_width_tmp) || (im_width == 0); + bool imSizeEqual = imHeightOK && imWidthOK; + bool subsampleHeightOK = (subsampl_height == subsampling_height_tmp) || (subsampl_height == 0); + bool subsampleWidthOK = (subsampl_width == subsampling_width_tmp) || (subsampl_width == 0); + bool subsampleOK = subsampleHeightOK && subsampleWidthOK; + if (!((cam_name == camera_name_tmp) && imSizeEqual && subsampleOK)) { back = SEQUENCE_ERROR; } return back; diff --git a/modules/core/src/display/vpDisplay_impl.h b/modules/core/src/display/vpDisplay_impl.h index 65f91861f2..6c254a5dcc 100644 --- a/modules/core/src/display/vpDisplay_impl.h +++ b/modules/core/src/display/vpDisplay_impl.h @@ -571,8 +571,9 @@ template void vp_display_display_roi(const vpImage &I, const double roiwidth = floor(roi.getWidth()); double iheight = static_cast(I.getHeight()); double iwidth = static_cast(I.getWidth()); - - if (top < 0 || top > iheight || left < 0 || left > iwidth || top + roiheight > iheight || left + roiwidth > iwidth) { + bool vertNOK = (top < 0) || (top > iheight) || ((top + roiheight) > iheight); + bool horNOK = (left < 0) || (left > iwidth) || ((left + roiwidth) > iwidth); + if (vertNOK || horNOK) { throw(vpException(vpException::dimensionError, "Region of interest outside of the image")); } diff --git a/modules/core/src/image/vpImageCircle.cpp b/modules/core/src/image/vpImageCircle.cpp index 9ea2714dad..1e3ce0d3c7 100644 --- a/modules/core/src/image/vpImageCircle.cpp +++ b/modules/core/src/image/vpImageCircle.cpp @@ -577,11 +577,14 @@ void computeIntersTopRightBottom(const float &u_c, const float &v_c, const float float theta_u_max_bottom = crossing_theta_u_max.first; float u_umin_bottom = crossing_theta_u_min.second; float u_umax_bottom = crossing_theta_u_max.second; + bool crossOnceTopHor = (u_umin_top <= umax_roi) && (u_umax_top > umax_roi); + bool dontCrossVert = (v_vmin <= vmin_roi) && (v_vmax >= vmax_roi); + bool crossOnceBotHor = (u_umin_bottom <= umax_roi) && (u_umax_bottom > umax_roi); if ((u_umax_top <= umax_roi) && (u_umax_bottom <= umax_roi) && (v_vmin >= vmin_roi) && (v_vmax <= vmax_roi)) { // case intersection top + right + bottom twice delta_theta = (2.f * M_PI_FLOAT) - ((theta_u_min_top - theta_u_max_top) + (theta_v_min - theta_v_max) + (theta_u_max_bottom - theta_u_min_bottom)); } - else if ((u_umin_top <= umax_roi) && (u_umax_top > umax_roi) && (v_vmin <= vmin_roi) && (u_umin_bottom <= umax_roi) && (u_umax_bottom > umax_roi) && (v_vmax >= vmax_roi)) { + else if (crossOnceTopHor && crossOnceBotHor && dontCrossVert) { // case intersection top and bottom delta_theta = (theta_u_max_top - theta_u_max_bottom); } diff --git a/modules/core/src/math/matrix/vpMatrix_pseudo_inverse.cpp b/modules/core/src/math/matrix/vpMatrix_pseudo_inverse.cpp index 4edbd3ed75..d6eee1f0f2 100644 --- a/modules/core/src/math/matrix/vpMatrix_pseudo_inverse.cpp +++ b/modules/core/src/math/matrix/vpMatrix_pseudo_inverse.cpp @@ -1010,4 +1010,29 @@ int vpMatrix::pseudoInverse(vpMatrix &Ap, vpColVector &sv, int rank_in, vpMatrix #endif } +/*! + * Permits to compute an approximated inverse of a matrix that is ill-conditionned. + * If the matrix is well-conditionned, the damped inverse is close to the Moore-Penrose pseudo-inverse. + * + * The corresponding equation is the following, assuming that \f$ \textbf{A} \f$ + * is the matrix we want to compute the damped inverse: + * + * \f$ \textbf{A} \approx ( \lambda \textbf{I} + \textbf{A}^T \textbf{A})^{-1} \textbf{A}^T \f$ + * + * \param[in] ratioOfMaxSvd The ratio of the maximum singular value of \f$ M \f$ we want to set \f$ \lambda \f$. + * @return vpMatrix The damped inverse. + */ +vpMatrix vpMatrix::dampedInverse(const double &ratioOfMaxSvd) const +{ + vpColVector w; + vpMatrix V, Mcpy(*this); + Mcpy.svd(w, V); + double maxSingularValue = w.getMaxValue(); + vpMatrix I; + I.eye(this->colNum); + double lambda = ratioOfMaxSvd * maxSingularValue; + vpMatrix dampedInv = (lambda * I + this->transpose() * *this).inverseByLU()* this->transpose(); + return dampedInv; +} + END_VISP_NAMESPACE diff --git a/modules/core/src/math/misc/vpMath.cpp b/modules/core/src/math/misc/vpMath.cpp index a9a3480042..83be4b418c 100644 --- a/modules/core/src/math/misc/vpMath.cpp +++ b/modules/core/src/math/misc/vpMath.cpp @@ -640,7 +640,7 @@ std::vector > vpMath::computeRegularPointsOnSphere(uns \sa enu2ecef(), ned2ecef() */ std::vector vpMath::getLocalTangentPlaneTransformations(const std::vector > &lonlatVec, double radius, - vpHomogeneousMatrix(*toECEF)(double lonDeg_, double latDeg_, double radius_)) + LongLattToHomogeneous toECEF) { std::vector ecef_M_local_vec; ecef_M_local_vec.reserve(lonlatVec.size()); diff --git a/modules/core/src/math/transformation/vpHomogeneousMatrix.cpp b/modules/core/src/math/transformation/vpHomogeneousMatrix.cpp index f246f9f416..20cfcc6edf 100644 --- a/modules/core/src/math/transformation/vpHomogeneousMatrix.cpp +++ b/modules/core/src/math/transformation/vpHomogeneousMatrix.cpp @@ -995,8 +995,9 @@ bool vpHomogeneousMatrix::isAnHomogeneousMatrix(double threshold) const const unsigned int index_2 = 2; const unsigned int index_3 = 3; const double epsilon = std::numeric_limits::epsilon(); - return R.isARotationMatrix(threshold) && vpMath::nul((*this)[index_3][index_0], epsilon) && vpMath::nul((*this)[index_3][index_1], epsilon) && - vpMath::nul((*this)[index_3][index_2], epsilon) && vpMath::equal((*this)[index_3][index_3], 1.0, epsilon); + bool isLastRowOK = vpMath::nul((*this)[index_3][index_0], epsilon) && vpMath::nul((*this)[index_3][index_1], epsilon) && + vpMath::nul((*this)[index_3][index_2], epsilon); + return R.isARotationMatrix(threshold) && isLastRowOK && vpMath::equal((*this)[index_3][index_3], 1.0, epsilon); } /*! diff --git a/modules/vision/include/visp3/vision/vpPose.h b/modules/vision/include/visp3/vision/vpPose.h index 8af6989702..752c6f8ce1 100644 --- a/modules/vision/include/visp3/vision/vpPose.h +++ b/modules/vision/include/visp3/vision/vpPose.h @@ -117,7 +117,7 @@ class VISP_EXPORT vpPose public: // Typedef a function that checks if a pose is valid. - typedef bool (*funcCheckValidityPose)(const vpHomogeneousMatrix &); + typedef bool (*FuncCheckValidityPose)(const vpHomogeneousMatrix &); /*! * Default constructor. @@ -183,7 +183,7 @@ class VISP_EXPORT vpPose * has the smallest residual. * - vpPose::RANSAC: Robust Ransac aproach (doesn't need an initialization) */ - bool computePose(vpPoseMethodType method, vpHomogeneousMatrix &cMo, funcCheckValidityPose func = nullptr); + bool computePose(vpPoseMethodType method, vpHomogeneousMatrix &cMo, FuncCheckValidityPose func = nullptr); /*! * @brief Method that first computes the pose \b cMo using the linear approaches of Dementhon and Lagrange @@ -326,7 +326,7 @@ class VISP_EXPORT vpPose * The number of threads used can then be set with setNbParallelRansacThreads(). * Filter flag can be used with setRansacFilterFlag(). */ - bool poseRansac(vpHomogeneousMatrix &cMo, funcCheckValidityPose func = nullptr); + bool poseRansac(vpHomogeneousMatrix &cMo, FuncCheckValidityPose func = nullptr); /*! * Compute the pose using virtual visual servoing approach and @@ -646,7 +646,7 @@ class VISP_EXPORT vpPose const unsigned int &numberOfInlierToReachAConsensus, const double &threshold, unsigned int &ninliers, std::vector &listInliers, vpHomogeneousMatrix &cMo, const int &maxNbTrials = 10000, bool useParallelRansac = true, unsigned int nthreads = 0, - funcCheckValidityPose func = nullptr); + FuncCheckValidityPose func = nullptr); #ifdef VISP_HAVE_HOMOGRAPHY /*! @@ -833,7 +833,7 @@ class VISP_EXPORT vpPose */ vpRansacFunctor(const vpHomogeneousMatrix &cMo_, unsigned int ransacNbInlierConsensus_, const int ransacMaxTrials_, double ransacThreshold_, unsigned int initial_seed_, bool checkDegeneratePoints_, - const std::vector &listOfUniquePoints_, funcCheckValidityPose func_) + const std::vector &listOfUniquePoints_, FuncCheckValidityPose func_) : m_best_consensus(), m_checkDegeneratePoints(checkDegeneratePoints_), m_cMo(cMo_), m_foundSolution(false), m_func(func_), m_listOfUniquePoints(listOfUniquePoints_), m_nbInliers(0), m_ransacMaxTrials(ransacMaxTrials_), m_ransacNbInlierConsensus(ransacNbInlierConsensus_), m_ransacThreshold(ransacThreshold_), @@ -870,7 +870,7 @@ class VISP_EXPORT vpPose bool m_checkDegeneratePoints; //!< Flag to check for degenerate points vpHomogeneousMatrix m_cMo; //!< Estimated pose bool m_foundSolution; //!< Solution found - funcCheckValidityPose m_func; //!< Pointer to ransac function + FuncCheckValidityPose m_func; //!< Pointer to ransac function std::vector m_listOfUniquePoints; //!< List of unique points unsigned int m_nbInliers; //!< Number of inliers int m_ransacMaxTrials; //!< Ransac max trial number diff --git a/modules/vision/src/pose-estimation/private/vpLevenbergMarquartd.cpp b/modules/vision/src/pose-estimation/private/vpLevenbergMarquartd.cpp index 6597e80974..fc9257adde 100644 --- a/modules/vision/src/pose-estimation/private/vpLevenbergMarquartd.cpp +++ b/modules/vision/src/pose-estimation/private/vpLevenbergMarquartd.cpp @@ -643,7 +643,7 @@ int qrsolv(int n, double *r, int ldr, int *ipvt, double *diag, double *qtb, doub return 0; } -bool lmderMostInnerLoop(void (*ptr_fcn)(int m, int n, double *xc, double *fvecc, double *jac, int ldfjac, int iflag), int m, int n, +bool lmderMostInnerLoop(ComputeFunctionAndJacobian ptr_fcn, int m, int n, double *x, double *fvec, double *fjac, int ldfjac, double ftol, double xtol, unsigned int maxfev, double *diag, int nprint, int *info, unsigned int *nfev, int *ipvt, double *qtf, double *wa1, double *wa2, double *wa3, double *wa4, const double &gnorm, int &iter, double &delta, double &par, double &pnorm, @@ -874,7 +874,7 @@ bool lmderMostInnerLoop(void (*ptr_fcn)(int m, int n, double *xc, double *fvecc, return false; } -int lmder(void (*ptr_fcn)(int m, int n, double *xc, double *fvecc, double *jac, int ldfjac, int iflag), int m, int n, +int lmder(ComputeFunctionAndJacobian ptr_fcn, int m, int n, double *x, double *fvec, double *fjac, int ldfjac, double ftol, double xtol, double gtol, unsigned int maxfev, double *diag, int mode, const double factor, int nprint, int *info, unsigned int *nfev, int *njev, int *ipvt, double *qtf, double *wa1, double *wa2, double *wa3, double *wa4) @@ -1183,7 +1183,7 @@ int lmder(void (*ptr_fcn)(int m, int n, double *xc, double *fvecc, double *jac, return 0; } -int lmder1(void (*ptr_fcn)(int m, int n, double *xc, double *fvecc, double *jac, int ldfjac, int iflag), int m, int n, +int lmder1(ComputeFunctionAndJacobian ptr_fcn, int m, int n, double *x, double *fvec, double *fjac, int ldfjac, double tol, int *info, int *ipvt, int lwa, double *wa) { const double factor = 100.0; diff --git a/modules/vision/src/pose-estimation/private/vpLevenbergMarquartd.h b/modules/vision/src/pose-estimation/private/vpLevenbergMarquartd.h index b4a4008373..1a693cd13c 100644 --- a/modules/vision/src/pose-estimation/private/vpLevenbergMarquartd.h +++ b/modules/vision/src/pose-estimation/private/vpLevenbergMarquartd.h @@ -267,6 +267,11 @@ double VISP_EXPORT pythag(double a, double b); int VISP_EXPORT qrfac(int m, int n, double *a, int lda, int *pivot, int *ipvt, int lipvt, double *rdiag, double *acnorm, double *wa); +/** + * \brief Function pointer towards a method that evaluates a function and its Jacobian. + */ +typedef void (*ComputeFunctionAndJacobian)(int m, int n, double *xc, double *fvecc, double *jac, int ldfjac, int iflag); + /* * PROCEDURE : lmder * @@ -372,7 +377,7 @@ int VISP_EXPORT qrfac(int m, int n, double *a, int lda, int *pivot, int *ipvt, i * En cas de succes, la valeur zero est retournee. * Sinon la valeur -1 est retournee. */ -int VISP_EXPORT lmder(void (*ptr_fcn)(int m, int n, double *xc, double *fvecc, double *jac, int ldfjac, int iflag), +int VISP_EXPORT lmder(ComputeFunctionAndJacobian ptr_fcn, int m, int n, double *x, double *fvec, double *fjac, int ldfjac, double ftol, double xtol, double gtol, unsigned int maxfev, double *diag, int mode, const double factor, int nprint, int *info, unsigned int *nfev, int *njev, int *ipvt, double *qtf, double *wa1, double *wa2, @@ -457,7 +462,7 @@ int VISP_EXPORT lmder(void (*ptr_fcn)(int m, int n, double *xc, double *fvecc, d * En cas de succes, la valeur zero est retournee. * Sinon, la valeur -1. */ -int VISP_EXPORT lmder1(void (*ptr_fcn)(int m, int n, double *xc, double *fvecc, double *jac, int ldfjac, int iflag), +int VISP_EXPORT lmder1(ComputeFunctionAndJacobian ptr_fcn, int m, int n, double *x, double *fvec, double *fjac, int ldfjac, double tol, int *info, int *ipvt, int lwa, double *wa); diff --git a/modules/vision/src/pose-estimation/vpPose.cpp b/modules/vision/src/pose-estimation/vpPose.cpp index 6bee3a938f..781d992239 100644 --- a/modules/vision/src/pose-estimation/vpPose.cpp +++ b/modules/vision/src/pose-estimation/vpPose.cpp @@ -381,7 +381,7 @@ void vpPose::callLagrangePose(vpHomogeneousMatrix &cMo) } } -bool vpPose::computePose(vpPoseMethodType method, vpHomogeneousMatrix &cMo, funcCheckValidityPose func) +bool vpPose::computePose(vpPoseMethodType method, vpHomogeneousMatrix &cMo, FuncCheckValidityPose func) { const int minNbPtDementhon = 4; const int minNbPtRansac = 4; diff --git a/modules/vision/src/pose-estimation/vpPoseRansac.cpp b/modules/vision/src/pose-estimation/vpPoseRansac.cpp index a3641e850a..7a529288cf 100644 --- a/modules/vision/src/pose-estimation/vpPoseRansac.cpp +++ b/modules/vision/src/pose-estimation/vpPoseRansac.cpp @@ -323,7 +323,7 @@ bool vpPose::vpRansacFunctor::poseRansacImpl() return foundSolution; } -bool vpPose::poseRansac(vpHomogeneousMatrix &cMo, bool (*func)(const vpHomogeneousMatrix &)) +bool vpPose::poseRansac(vpHomogeneousMatrix &cMo, FuncCheckValidityPose func) { // Check only for adding / removing problem // Do not take into account problem with element modification here @@ -572,7 +572,7 @@ void vpPose::findMatch(std::vector &p2D, std::vector &p3D, const unsigned int &numberOfInlierToReachAConsensus, const double &threshold, unsigned int &ninliers, std::vector &listInliers, vpHomogeneousMatrix &cMo, const int &maxNbTrials, bool useParallelRansac, unsigned int nthreads, - bool (*func)(const vpHomogeneousMatrix &)) + FuncCheckValidityPose func) { vpPose pose;