Hough Transformation
AForge.NET framework provides Hough transformations - line and circle Hough
transformation, which may be useful in detecting straight lines and circles.
Below is the list of implemented Hough transformation routines and the result of
their application to the below source image.
Source image
Hough Line Transformation
The routine implements Hough line transformation, which allows to detect straight lines in an image.
HoughLineTransformation lineTransform = new HoughLineTransformation( );
// apply Hough line transofrm
lineTransform.ProcessImage( sourceImage );
Bitmap houghLineImage = lineTransform.ToBitmap( );
// get lines using relative intensity
HoughLine[] lines = lineTransform.GetLinesByRelativeIntensity( 0.5 );
foreach ( HoughLine line in lines )
{
// ...
}
Hough Circle Transformation
The routine implements Hough circle transformation, which allows to detect circles of specified radius in an image.
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 )
{
// ...
}
|