CircleHoughTransform

class CircleHoughTransform(*args, **kwargs)

Bases: pybind11_object

Class that permits to detect 2D circles in a image using the gradient-based Circle Hough transform. Please find more information on the algorithm here

Overloaded function.

  1. __init__(self: visp._visp.imgproc.CircleHoughTransform) -> None

Construct a new vpCircleHoughTransform object with default parameters.

  1. __init__(self: visp._visp.imgproc.CircleHoughTransform, algoParams: vpCircleHoughTransform::vpCircleHoughTransformParameters) -> None

Methods

__init__

Overloaded function.

computeVotingMask

Compute the mask containing pixels that voted for the detections .

detect

Overloaded function.

getCannyThreshold

Get internal Canny filter upper threshold.

getCenterCandidatesList

Get the list of Center Candidates, stored as pair <idRow, idCol>

getCenterCandidatesVotes

Get the number of votes of each Center Candidates.

getCircleCandidates

Get the Circle Candidates before merging step.

getCircleCandidatesProbabilities

Get the probabilities of the Circle Candidates.

getCircleCandidatesVotes

Get the votes of the circle candidates.

getCircleCenterMinDist

Get circles center min distance in pixels.

getCircleMaxRadius

Get circles max radius in pixels.

getCircleMinRadius

Get circles min radius in pixels.

getDetectionsProbabilities

Get the probabilities of the detections that are outputed by vpCircleHoughTransform::detect()

getDetectionsVotes

Get the number of votes for the detections that are outputed by vpCircleHoughTransform::detect()

getEdgeMap

Get the Edge Map computed thanks to the Canny edge filter.

getGradientX

Get the gradient along the horizontal axis of the image.

getGradientY

Get the gradient along the vertical axis of the image.

init

setCannyBackend

Set the backend to use to perform the Canny edge detection.

setCannyThreshold

Set the threshold for the Canny operator.

setCannyThresholdRatio

Set the Canny thresholds ratio that are used to automatically compute the Canny thresholds in case the user asks to.

setCenterComputationParameters

Set the parameters of the computation of the circle center candidates.

setCircleCenterBoundingBox

Set circles center min and max location in the image.

setCircleCenterMinDist

Set circles center min distance.

setCircleMaxRadius

Set circles max radius.

setCircleMinRadius

Set circles min radius.

setCirclePerfectness

Set circles perfectness, which corresponds to the threshold of the colinearity between the gradient of a point and the radius it would form with a center candidate to be able to vote.

setFilteringAndGradientType

Permits to choose the filtering + gradient operators to use.

setGaussianParameters

Set the parameters of the Gaussian filter, that permits to blur the gradients of the image.

setGradientFilterAperture

Set the parameters of the gradient filter (Sobel or Scharr) kernel size filters.

setMask

setRadiusMergingThresholds

Set the radius merging threshold used during the merging step in order to merge the circles that are similar.

setRadiusRatioThreshold

Set the parameters of the computation of the circle radius candidates.

toString

Create a string with all Hough transform parameters.

Inherited Methods

Operators

__doc__

__init__

Overloaded function.

__module__

__repr__

Attributes

__annotations__

edgeMapOff

edgeMapOn

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: visp._visp.imgproc.CircleHoughTransform) -> None

Construct a new vpCircleHoughTransform object with default parameters.

  1. __init__(self: visp._visp.imgproc.CircleHoughTransform, algoParams: vpCircleHoughTransform::vpCircleHoughTransformParameters) -> None

computeVotingMask(self: visp._visp.imgproc.CircleHoughTransform, I: visp._visp.core.ImageGray, detections: list[visp._visp.core.ImageCircle], mask: Optional[vpImage<bool>], opt_votingPoints: Optional[list[list[tuple[int, int]]]]) None

Compute the mask containing pixels that voted for the detections .

Parameters:
I

The image for which we want to have the information.

detections

Vector containing the list of vpImageCircle for which we want to know the voting points.

mask

Optional mask where pixels to exclude have a value set to false.

opt_votingPoints

Optional vector of pairs of pixel coordinates that voted for the detections .

detect(*args, **kwargs)

Overloaded function.

  1. detect(self: visp._visp.imgproc.CircleHoughTransform, cv_I: cv::Mat) -> list[visp._visp.core.ImageCircle]

  2. detect(self: visp._visp.imgproc.CircleHoughTransform, I: visp._visp.core.ImageRGBa) -> list[visp._visp.core.ImageCircle]

Convert the input image in a gray-scale image and then perform Circle Hough Transform to detect the circles in it.

Parameters:
I

The input color image.

Returns:

std::vector<vpImageCircle> The list of 2D circles detected in the image.

  1. detect(self: visp._visp.imgproc.CircleHoughTransform, I: visp._visp.core.ImageGray) -> list[visp._visp.core.ImageCircle]

Perform Circle Hough Transform to detect the circles in a gray-scale image.

Parameters:
I

The input gray scale image.

Returns:

std::vector<vpImageCircle> The list of 2D circles detected in the image.

  1. detect(self: visp._visp.imgproc.CircleHoughTransform, I: visp._visp.core.ImageGray, nbCircles: int) -> list[visp._visp.core.ImageCircle]

Perform Circle Hough Transform to detect the circles in in a gray-scale image. Get only the nbCircles circles having the greatest number of votes.

Parameters:
I

The input gray scale image.

nbCircles

The number of circles we want to get. If negative, all the circles will be returned, sorted such as result[0] has the highest number of votes and result[end -1] the lowest.

Returns:

std::vector<vpImageCircle> The list of 2D circles with the most number of votes detected in the image.

getCannyThreshold(self) float

Get internal Canny filter upper threshold. When value is equal to -1 (default), it means that the threshold is computed automatically.

getCenterCandidatesList(self) list[tuple[float, float]]

Get the list of Center Candidates, stored as pair <idRow, idCol>

Returns:

std::vector<std::pair<float, float> > The list of Center Candidates, stored as pair <idRow, idCol>

getCenterCandidatesVotes(self) list[int]

Get the number of votes of each Center Candidates.

Returns:

std::vector<int> The number of votes of each Center Candidates, ordered in the same way than m_centerCandidatesList .

getCircleCandidates(self) list[visp._visp.core.ImageCircle]

Get the Circle Candidates before merging step.

Returns:

std::vector<vpImageCircle> The list of circle candidates that were obtained before the merging step.

getCircleCandidatesProbabilities(self) list[float]

Get the probabilities of the Circle Candidates.

Returns:

std::vector<float> The votes accumulator.

getCircleCandidatesVotes(self) list[int]

Get the votes of the circle candidates.

Returns:

std::vector<unsigned int> The votes of the circle candidates.

getCircleCenterMinDist(self) float

Get circles center min distance in pixels.

getCircleMaxRadius(self) float

Get circles max radius in pixels.

getCircleMinRadius(self) float

Get circles min radius in pixels.

getDetectionsProbabilities(self) list[float]

Get the probabilities of the detections that are outputed by vpCircleHoughTransform::detect()

getDetectionsVotes(self) list[int]

Get the number of votes for the detections that are outputed by vpCircleHoughTransform::detect()

getEdgeMap(self) visp._visp.core.ImageGray

Get the Edge Map computed thanks to the Canny edge filter.

Returns:

vpImage<unsigned char> The edge map computed during the edge detection step.

getGradientX(self) visp._visp.core.ImageFloat

Get the gradient along the horizontal axis of the image.

Returns:

vpImage<float> The gradient along the horizontal axis of the image.

getGradientY(self) visp._visp.core.ImageFloat

Get the gradient along the vertical axis of the image.

Returns:

vpImage<float> The gradient along the vertical axis of the image.

init(self: visp._visp.imgproc.CircleHoughTransform, algoParams: vpCircleHoughTransform::vpCircleHoughTransformParameters) None
setCannyBackend(self, type: visp._visp.core.ImageFilter.CannyBackendType) None

Set the backend to use to perform the Canny edge detection.

Parameters:
type: visp._visp.core.ImageFilter.CannyBackendType

The backend that must be used.

setCannyThreshold(self, lowerCannyThreshold: float, upperCannyThreshold: float) None

Set the threshold for the Canny operator. Only value greater than this value are marked as an edge. If negative, the threshold is automatically computed.

Parameters:
lowerCannyThreshold: float

Canny filter lower threshold. When set to -1 (default), compute automatically this threshold.

upperCannyThreshold: float

Canny filter upper threshold. When set to -1 (default), compute automatically this threshold.

setCannyThresholdRatio(self, lowerThreshRatio: float, upperThreshRatio: float) None

Set the Canny thresholds ratio that are used to automatically compute the Canny thresholds in case the user asks to.

Note

See vpCircleHoughTransform::setCannyThreshold(const float&, const float&)

Parameters:
lowerThreshRatio: float

The ratio of the upper threshold the lower threshold will be equal to.

upperThreshRatio: float

The ratio of pixels that must have a gradient lower than the upper threshold.

setCenterComputationParameters(self, dilatationSize: int, centerThresh: float, averagingWindowSize: int = 5, expectedNbCenters: int = -1) None

Set the parameters of the computation of the circle center candidates.

Parameters:
dilatationSize: int

Kernel size of the dilatation operation used to detect the maxima in the center accumulator.

centerThresh: float

Minimum number of votes a point must exceed to be considered as center candidate.

averagingWindowSize: int = 5

Size of the averaging window around the maximum number of votes to compute the center candidate such as it is the barycenter of the window. Must be odd.

expectedNbCenters: int = -1

Expected number of centers in the image. If the number is negative, all the centers are kept. Otherwise, maximum up to this number of centers are kept.

setCircleCenterBoundingBox(self, center_min_x: int, center_max_x: int, center_min_y: int, center_max_y: int) None

Set circles center min and max location in the image. If one value is equal to std::numeric_limits<int>::min or std::numeric_limits<int>::max() , the algorithm will set it either to -maxRadius or +maxRadius depending on if it is the lower or upper limit that is missing.

Parameters:
center_min_x: int

Center min location on the horizontal axis, expressed in pixels.

center_max_x: int

Center max location on the horizontal axis, expressed in pixels.

center_min_y: int

Center min location on the vertical axis, expressed in pixels.

center_max_y: int

Center max location on the vertical axis, expressed in pixels.

setCircleCenterMinDist(self, center_min_dist: float) None

Set circles center min distance. Change this value to detect circles with different distances to each other.

Parameters:
center_min_dist: float

Center min distance in pixels.

setCircleMaxRadius(self, circle_max_radius: float) None

Set circles max radius.

Parameters:
circle_max_radius: float

Max radius in pixels.

setCircleMinRadius(self, circle_min_radius: float) None

Set circles min radius.

Parameters:
circle_min_radius: float

Min radius in pixels.

setCirclePerfectness(self, circle_perfectness: float) None

Set circles perfectness, which corresponds to the threshold of the colinearity between the gradient of a point and the radius it would form with a center candidate to be able to vote. The formula to get the equivalent angle is: angle = acos(circle_perfectness) .

Parameters:
circle_perfectness: float

Circle perfectness. Value between 0 and 1. A perfect circle has value 1.

setFilteringAndGradientType(self, type: visp._visp.core.ImageFilter.CannyFilteringAndGradientType) None

Permits to choose the filtering + gradient operators to use.

Parameters:
type: visp._visp.core.ImageFilter.CannyFilteringAndGradientType

The type of filtering + gradient operators to use.

setGaussianParameters(self, kernelSize: int, stdev: float) None

Set the parameters of the Gaussian filter, that permits to blur the gradients of the image.

Parameters:
kernelSize: int

The size of the Gaussian kernel. Must be an odd value.

stdev: float

The standard deviation of the Gaussian function.

setGradientFilterAperture(self, apertureSize: int) None

Set the parameters of the gradient filter (Sobel or Scharr) kernel size filters.

Parameters:
apertureSize: int

The size of the gradient filters kernel. Must be an odd value.

setMask(self: visp._visp.imgproc.CircleHoughTransform, mask: vpImage<bool>) None
setRadiusMergingThresholds(self, radiusDifferenceThresh: float) None

Set the radius merging threshold used during the merging step in order to merge the circles that are similar.

Parameters:
radiusDifferenceThresh: float

Maximum radius difference between two circle candidates to consider merging them.

setRadiusRatioThreshold(self, radiusRatioThresh: float) None

Set the parameters of the computation of the circle radius candidates.

Parameters:
radiusRatioThresh: float

Minimum number of votes per radian a radius candidate RC_ij of a center candidate CeC_i must have in order that the circle of center CeC_i and radius RC_ij must be considered as circle candidate.

toString(self) str

Create a string with all Hough transform parameters.