module #include "diplib/detection.h"
Circle detectors Circle detection algorithms
Classes

struct dip::
RadonCircleParameters  Stores the parameters for one hypersphere (circle, sphere).
Aliases

using dip::
RadonCircleParametersArray = std::vector<RadonCircleParameters>  An array of
dip::RadonCircleParameters
, storing parameters for all hyperspheres detected bydip::RadonTransformCircles
.
Functions

void dip::
HoughTransformCircleCenters (dip::Image const& in, dip::Image const& gv, dip::Image& out, dip::UnsignedArray const& range = {})  Hough transform for circles in 2D binary images.

auto dip::
FindHoughMaxima (dip::Image const& in, dip::dfloat distance = 10.0, dip::dfloat fraction = 0.1) > dip::CoordinateArray  Find local maxima in Hough parameter space.

auto dip::
PointDistanceDistribution (dip::Image const& in, dip::CoordinateArray const& points, dip::UnsignedArray range = {}) > dip::Distribution  Compute distance distribution for a set of points.

auto dip::
FindHoughCircles (dip::Image const& in, dip::Image const& gv, dip::UnsignedArray const& range = {}, dip::dfloat distance = 10.0, dip::dfloat fraction = 0.1) > dip::FloatCoordinateArray  Find circles in 2D binary images.

auto dip::
RadonTransformCircles (dip::Image const& in, dip::Image& out, dip::Range radii = {10,30}, dip::dfloat sigma = 1.0, dip::dfloat threshold = 1.0, dip::String const& mode = S::FULL, dip::StringSet const& options = {S::NORMALIZE,S::CORRECT}) > dip::RadonCircleParametersArray  Detects hyperspheres (circles, spheres) using the generalized Radon transform.
Class documentation
struct dip::RadonCircleParameters
Stores the parameters for one hypersphere (circle, sphere).
Variables  

dip::FloatArray origin  Coordinates of the origin of the hypersphere 
dip::dfloat radius  Radius of the hypersphere 
Function documentation
void
dip::HoughTransformCircleCenters (dip::Image const& in,
dip::Image const& gv,
dip::Image& out,
dip::UnsignedArray const& range = {})
Hough transform for circles in 2D binary images.
Computes the Hough parameter space for circles in 2D images, with the radius dimension collapsed.
The parameter space out
has the same sizes as the binary input image in
. gv
is a vector image
of the same sizes as in
, with the gradient vector for each pixel of in
.
range
must be empty, or have exactly two elements representing the minimum and maximum radius to
be considered. If empty, the minimum radius is 0, and the maximum is the length of the image diagonal.
dip::CoordinateArray
dip::FindHoughMaxima (dip::Image const& in,
dip::dfloat distance = 10.0,
dip::dfloat fraction = 0.1)
Find local maxima in Hough parameter space.
Finds the local maxima (using dip::WatershedMaxima
) in the given Hough parameter space.
Maxima distance
pixels away from a higher maximum are filtered out.
Maxima lower than fraction
times the highest maximum are ignored. fraction
should be lower than 1.
dip::Distribution
dip::PointDistanceDistribution (dip::Image const& in,
dip::CoordinateArray const& points,
dip::UnsignedArray range = {})
Compute distance distribution for a set of points.
Computes the distance distributions from points
to all ‘on’ pixels in the binary image in
.
The returned (multivalued) distribution indicates, for every integer distance, how many ‘on’ pixels
are found at that distance for that point.
range
must be empty, or have exactly two elements representing the minimum and maximum distance to
be considered. If empty, the minimum distance is 0, and the maximum is the length of the image diagonal.
dip::FloatCoordinateArray
dip::FindHoughCircles (dip::Image const& in,
dip::Image const& gv,
dip::UnsignedArray const& range = {},
dip::dfloat distance = 10.0,
dip::dfloat fraction = 0.1)
Find circles in 2D binary images.
Finds circles in 2D binary images using the 21 Hough transform. First, circle centers are computed
using dip::HoughTransformCircleCenters
, and then a radius is calculated for each center. Note that
only a single radius is returned per center coordinates.
gv
is a vector image of the same sizes as in
, with the gradient vector for each pixel of in
.
range
must be empty, or have exactly two elements representing the minimum and maximum radius to
be considered. If empty, the minimum radius is 0, and the maximum is the length of the image diagonal.
distance
is the minimum distance between centers, used to suppress noisy results.
fraction
is the minimum height of a peak in the Hough transform, with respect to the largest peak,
that should be considered, again to suppress noisy results.
dip::RadonCircleParametersArray
dip::RadonTransformCircles (dip::Image const& in,
dip::Image& out,
dip::Range radii = {10,30},
dip::dfloat sigma = 1.0,
dip::dfloat threshold = 1.0,
dip::String const& mode = S::FULL,
dip::StringSet const& options = {S::NORMALIZE,S::CORRECT})
Detects hyperspheres (circles, spheres) using the generalized Radon transform.
This function can obtain highly precise values for the origin and the radius.
radii
determines the radii for the template, and thus also the size of the parameter space. Note that it is
not possible to find locations of maxima with subpixel precision at the boundary of an image, so the first
radius to be probed should be strictly smaller than the smallest circle/sphere to be detected, and the last
radius should be strictly larger.
sigma
specifies the parameter to the Gaussian regularization used when creating the templates. This parameter
is linked to the step size of radii
. For example, if sigma
is set to 2, then the step size can be 2 also,
reducing the size of the parameter space.
threshold
is used to distinguish relevant peaks in the parameter space: Peaks must be at least threshold
above the surrounding valley to be counted. dip::WatershedMaxima
is used to find peaks, threshold
sets
the maxDepth
parameter there.
The Radon transform parameter space can be computed in three different ways, determined by the value for mode
:
"full"
:out
is the full parameter space, an image of the size ofin
with an additional dimension for the r axis. This is the default."projection"
:out
is of the size ofin
, with two tensor components (channels).out[ 0 ]
is the max projection of the parameter space over the r axis,out[ 1 ]
is the argmax projection."subpixel projection"
: Idem, but the argmax is computed with subpixel precision. It computes 3 slices along r at the time, and looks for local maxima along the r axis by fitting a parabola to the the 3 samples.
The parameter options
can contain the following values:
"normalize"
: Normalizes the integral over the template for each r, so that larger circles don’t have a larger maximum. This prevents a bias towards larger circles."correct"
: If normalized, the size of the template is corrected to reduce bias in the radius estimate."hollow"
: Adds a negative ring just inside the positive ring of the template. This forces the algorithm to look for rings, not disks."filled"
: Fills the positive ring with negative values. This forces the algorithm to look for rings without anything in them."no maxima detection"
: Thedip::RadonCircleParametersArray
output is an empty array."no parameter space"
: Theout
image is not used.
By default, options
contains "normalize"
and "correct"
.
in
must be scalar and noncomplex, and have at least one dimension. out
will be of type dip::DT_SFLOAT
.