diff --git a/modules/imgproc/include/visp3/imgproc/vpCircleHoughTransform.h b/modules/imgproc/include/visp3/imgproc/vpCircleHoughTransform.h index 7448ea4722..c39f1aa2ba 100644 --- a/modules/imgproc/include/visp3/imgproc/vpCircleHoughTransform.h +++ b/modules/imgproc/include/visp3/imgproc/vpCircleHoughTransform.h @@ -1042,10 +1042,39 @@ class VISP_EXPORT vpCircleHoughTransform } } + /*! + * \brief Set the mask that permits to ignore some pixels when performing the circle detection. + * + * \param[in] mask A boolean image where pixels set to true means that the pixel + * must be considered and set to false means that the pixel must be ignored. + */ inline void setMask(const vpImage &mask) { mp_mask = &mask; } + + /*! + * \brief Set the mask that permits to ignore some pixels when performing the circle detection. + * + * \param[in] mask Either a boolean image where pixels set to true means that the pixel + * must be considered and set to false means that the pixel must be ignored, or nullptr + * to deactivate the mask. + */ + inline void setMask(const vpImage *mask) + { + mp_mask = mask; + } + + /*! + * \brief Permits to either activate or deactivate the memorization + * of the points that voted for the detected circles. + * + * \param[in] record True to activate the feature, false to deactivate it. + */ + inline void setRecordVotingPoints(const bool &record) + { + m_algoParams.m_recordVotingPoints = record; + } //@} /** @name Getters */ @@ -1179,6 +1208,25 @@ class VISP_EXPORT vpCircleHoughTransform { return m_finalCircleVotes; } + + /*! + * Get the points that voted for the detections that are outputed by vpCircleHoughTransform::detect(). + */ + inline std::vector > > getDetectionsVotingPoints() const + { + if (!m_algoParams.m_recordVotingPoints) { + throw(vpException(vpException::fatalError, "Asking voting points when it was not asked to remember them.")); + } + return m_finalCirclesVotingPoints; + } + + /*! + * Returns true if it was asked to record the points that voted for the detections. + */ + inline bool getRecordVotingPoints() const + { + return m_algoParams.getRecordVotingPoints(); + } //@} /*! diff --git a/modules/imgproc/src/vpCircleHoughTransform_common.cpp b/modules/imgproc/src/vpCircleHoughTransform_common.cpp index 20135a0574..e65d0e7982 100644 --- a/modules/imgproc/src/vpCircleHoughTransform_common.cpp +++ b/modules/imgproc/src/vpCircleHoughTransform_common.cpp @@ -268,8 +268,11 @@ vpCircleHoughTransform::detect(const vpImage &I) m_circleCandidates.clear(); m_circleCandidatesVotes.clear(); m_circleCandidatesProbabilities.clear(); + m_circleCandidatesVotingPoints.clear(); m_finalCircles.clear(); m_finalCircleVotes.clear(); + m_finalCirclesProbabilities.clear(); + m_finalCirclesVotingPoints.clear(); // Ensuring that the difference between the max and min radii is big enough to take into account // the pixelization of the image