Skip to content

Commit

Permalink
Merge pull request #1244 from rolalaro/vpCHTimprovements
Browse files Browse the repository at this point in the history
Circle Hough Transform improvements
  • Loading branch information
fspindle authored Oct 4, 2023
2 parents dc67bbc + e5cce9c commit c607ae9
Show file tree
Hide file tree
Showing 11 changed files with 3,134 additions and 97 deletions.
9 changes: 3 additions & 6 deletions doc/tutorial/imgproc/tutorial-imgproc-cht.dox
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ parameter.

\image html img-tutorial-cht-radius-votes.png

\section imgproc_cht_requirements Requirements

With the current implementation, the `vpCircleHoughTransform` requires ViSP to be compiled with OpenCV.
If you do not know how to do it, please refer to the installation guidelines of \ref soft_vision_opencv.

\section imgproc_cht_howto How to use the tutorial

It is possible to configure the `vpCircleHoughTransform` class using a JSON file.
Expand Down Expand Up @@ -74,7 +69,7 @@ If the detections seem a bit off, you might need to change the parameters in `co

To run the software on an actual image using command line arguments instead, please run:
```
$ ./tutorial-circle-hough --input /path/to/my/image --gaussian-kernel 5 --gaussian-sigma 1 --canny-thresh -1. --dilatation-repet 1 --center-thresh 200 --radius-bin 2 --radius-thresh 2 --radius-limits 80 90 --merging-thresh 15 2 --circle-perfectness 0.9
$ ./tutorial-circle-hough --input /path/to/my/image --gaussian-kernel 5 --gaussian-sigma 1 --canny-thresh 100. 200. --dilatation-repet 1 --center-thresh 200 --radius-bin 2 --circle-probability-thresh 0.75 --radius-limits 80 90 --merging-thresh 15 2 --circle-perfectness 0.9
```

If the detections seem a bit off, you might need to change the parameters
Expand Down Expand Up @@ -139,6 +134,8 @@ to the command line arguments:

To run the circle detection, you must call the following method:
\snippet tutorial-circle-hough.cpp Run detection
The call to vpCircleHoughTransform::getDetectionsProbabilities permits to know the confidence in each detection.
It is sorted in the same way that are sorted the detections.

You could have also used the following method to get only the `num_best` best
detections:
Expand Down
20 changes: 18 additions & 2 deletions modules/core/include/visp3/core/vpImageCircle.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,25 @@ class VISP_EXPORT vpImageCircle
virtual ~vpImageCircle();

/*!
* Get the center of the image (2D) circle
* \return The center of the image (2D) circle.
* Compute the angular coverage, in terms of radians, that is contained in the Region of Interest (RoI).
* \sa \ref vpImageCircle::computeArcLengthInRoI() "vpImageCircle::computeArcLengthInRoI(const vpRect &roi)"
* \param[in] roi The rectangular RoI in which we want to know the number of pixels of the circle that are contained.
* \return Returns 2.f * M_PI for a circle that is fully visible in the RoI, or the sum of the angles of the arc(s) that is(are) visible in the RoI.
*/
float computeAngularCoverageInRoI(const vpRect &roi) const;

/*!
* Compute the arc length, in terms of number of pixels, that is contained in the Region of Interest (RoI).
* \sa \ref vpImageCircle::computeAngularCoverageInRoI() "vpImageCircle::computeAngularCoverageInRoI(const vpRect &roi)"
* \param[in] roi The rectangular RoI in which we want to know the number of pixels of the circle that are contained.
* \return The number of pixels of the circle that are contained in the RoI.
*/
float computeArcLengthInRoI(const vpRect &roi) const;

/*!
* Get the center of the image (2D) circle
* \return The center of the image (2D) circle.
*/
vpImagePoint getCenter() const;

/*!
Expand Down
959 changes: 959 additions & 0 deletions modules/core/src/image/vpImageCircle.cpp

Large diffs are not rendered by default.

Loading

0 comments on commit c607ae9

Please sign in to comment.