ImFusion SDK 4.3
CircleHoughTransform Class Reference

#include <ImFusion/Base/CircleHoughTransform.h>

Hough transform for detecting circles. More...

+ Inheritance diagram for CircleHoughTransform:

Detailed Description

Hough transform for detecting circles.

Public Member Functions

 CircleHoughTransform (const MemImage *img, const vec4i &roi=vec4i::Zero(), const vec2i &radiusRange=vec2i::Zero())
 Takes the image on which to perform the hough transform, the ROI in which to search (x,y,width,height) and the radius range (min,max) The image is normalized before running the hough transformation.
 
void setBlurKernelSize (int size)
 Setting the kernel size to zero disables blurring.
 
int blurKernelSize () const
 
void setUseCanny (bool useCanny)
 
bool useCanny () const
 
void compute (float gradientThreshold=0.1f, float gradientsAboveThreshold=0.0f)
 Run hough detection The gradient threshold is wrt.
 
std::vector< vec3i > detections (float threshold=0.95f, bool combineDuplicates=true) const
 Return all detected squares in the form [top left x, top left y, side length].
 
const TypedImage< float > * detectionMatrix () const
 
const TypedImage< float > * edgeMap () const
 

Protected Attributes

std::unique_ptr< TypedImage< float > > m_inputNorm
 Normalized input image.
 
std::unique_ptr< TypedImage< float > > m_detectionMatrix
 
std::unique_ptr< TypedImage< float > > m_edgeMap
 
vec4i m_roi
 ROI in which circle must be located in the format (x,y,width,height), default is entire image.
 
vec2i m_radiusRange
 Allowed range for the radius, default is a minimum of 10 pixels and up to the half the image size.
 
int m_blurKernelSize
 Size of blur kernel which is applied to image before running edge detection.
 
bool m_useCanny
 Use Canny edge detection instead of gradient magnitude.
 

Member Function Documentation

◆ compute()

void compute ( float gradientThreshold = 0.1f,
float gradientsAboveThreshold = 0.0f )

Run hough detection The gradient threshold is wrt.

a normalized version of the image. When maxGradientsAboveThreshold is large 0 the threshold is increased until there are this many percent of gradients left. The gradient threshold is never decreased below gradientThreshold.

◆ detections()

std::vector< vec3i > detections ( float threshold = 0.95f,
bool combineDuplicates = true ) const

Return all detected squares in the form [top left x, top left y, side length].

The score is normalized with respect to the number of pixels on the border of the square, so that an ideal square has score 1. Due to numerical accuracy even for perfect data a smaller threshold shoud be used.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close