C# Class Accord.Imaging.HoughCircleTransformation

Hough circle transformation.

The class implements Hough circle transformation, which allows to detect circles of specified radius in an image.

The class accepts binary images for processing, which are represented by 8 bpp grayscale images. All black pixels (0 pixel's value) are treated as background, but pixels with different value are treated as circles' pixels.

Sample usage:

HoughCircleTransformation circleTransform = new HoughCircleTransformation( 35 ); // apply Hough circle transform circleTransform.ProcessImage( sourceImage ); Bitmap houghCirlceImage = circleTransform.ToBitmap( ); // get circles using relative intensity HoughCircle[] circles = circleTransform.GetCirclesByRelativeIntensity( 0.5 ); foreach ( HoughCircle circle in circles ) { // ... }

Initial image:

Hough circle transformation image:

Show file Open project: accord-net/framework

Public Methods

Method Description
GetCirclesByRelativeIntensity ( double minRelativeIntensity ) : Accord.Imaging.HoughCircle[]

Get circles with relative intensity higher then specified value.

GetMostIntensiveCircles ( int count ) : Accord.Imaging.HoughCircle[]

Get specified amount of circles with highest intensity.

HoughCircleTransformation ( int radiusToDetect ) : System

Initializes a new instance of the HoughCircleTransformation class.

ProcessImage ( Bitmap image ) : void

Process an image building Hough map.

ProcessImage ( BitmapData imageData ) : void

Process an image building Hough map.

ProcessImage ( UnmanagedImage image ) : void

Process an image building Hough map.

ToBitmap ( ) : Bitmap

Ñonvert Hough map to bitmap.

Private Methods

Method Description
CollectCircles ( ) : void
DrawHoughCircle ( int xCenter, int yCenter ) : void
SetHoughCirclePoints ( int cx, int cy, int x, int y ) : void
SetHoughPoint ( int x, int y ) : void

Method Details

GetCirclesByRelativeIntensity() public method

Get circles with relative intensity higher then specified value.
public GetCirclesByRelativeIntensity ( double minRelativeIntensity ) : Accord.Imaging.HoughCircle[]
minRelativeIntensity double Minimum relative intesity of circles.
return Accord.Imaging.HoughCircle[]

GetMostIntensiveCircles() public method

Get specified amount of circles with highest intensity.
public GetMostIntensiveCircles ( int count ) : Accord.Imaging.HoughCircle[]
count int Amount of circles to get.
return Accord.Imaging.HoughCircle[]

HoughCircleTransformation() public method

Initializes a new instance of the HoughCircleTransformation class.
public HoughCircleTransformation ( int radiusToDetect ) : System
radiusToDetect int Circles' radius to detect.
return System

ProcessImage() public method

Process an image building Hough map.
Unsupported pixel format of the source image.
public ProcessImage ( Bitmap image ) : void
image System.Drawing.Bitmap Source image to process.
return void

ProcessImage() public method

Process an image building Hough map.
Unsupported pixel format of the source image.
public ProcessImage ( BitmapData imageData ) : void
imageData System.Drawing.Imaging.BitmapData Source image data to process.
return void

ProcessImage() public method

Process an image building Hough map.
Unsupported pixel format of the source image.
public ProcessImage ( UnmanagedImage image ) : void
image UnmanagedImage Source unmanaged image to process.
return void

ToBitmap() public method

Ñonvert Hough map to bitmap.
Hough transformation was not yet done by calling /// ProcessImage() method.
public ToBitmap ( ) : Bitmap
return System.Drawing.Bitmap