Skip to content

Commit

Permalink
[CORE] Added some method to ease the use of voting points
Browse files Browse the repository at this point in the history
  • Loading branch information
LAGNEAU Romain committed Nov 6, 2024
1 parent 1f6389d commit 53b3080
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
48 changes: 48 additions & 0 deletions modules/imgproc/include/visp3/imgproc/vpCircleHoughTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> &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<bool> *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 */
Expand Down Expand Up @@ -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<std::vector<std::pair<unsigned int, unsigned int> > > 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();
}
//@}

/*!
Expand Down
3 changes: 3 additions & 0 deletions modules/imgproc/src/vpCircleHoughTransform_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,11 @@ vpCircleHoughTransform::detect(const vpImage<unsigned char> &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
Expand Down

0 comments on commit 53b3080

Please sign in to comment.