C# 클래스 AForge.Imaging.HoughLineTransformation

Hough line transformation.

The class implements Hough line transformation, which allows to detect straight lines in an image. Lines, which are found by the class, are provided in polar coordinates system - lines' distances from image's center and lines' slopes are provided. The pole of polar coordinates system is put into processing image's center and the polar axis is directed to the right from the pole. Lines' slope is measured in degrees and is actually represented by angle between polar axis and line's radius (normal going from pole to the line), which is measured in counter-clockwise direction.

Found lines may have negative radius. This means, that the line resides in lower part of the polar coordinates system and its HoughLine.Theta value should be increased by 180 degrees and radius should be made positive.

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 lines' pixels.

See also documentation to HoughLine class for additional information about Hough Lines.

Sample usage:

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 ) { // ... }

Initial image:

Hough line transformation image:

파일 보기 프로젝트 열기: holisticware-admin/MonoVersal.AForgeNET 1 사용 예제들

공개 메소드들

메소드 설명
GetLinesByRelativeIntensity ( double minRelativeIntensity ) : AForge.Imaging.HoughLine[]

Get lines with relative intensity higher then specified value.

GetMostIntensiveLines ( int count ) : AForge.Imaging.HoughLine[]

Get specified amount of lines with highest intensity.

HoughLineTransformation ( ) : System

Initializes a new instance of the HoughLineTransformation class.

ProcessImage ( Bitmap image ) : void

Process an image building Hough map.

ProcessImage ( Bitmap image, Rectangle rect ) : void

Process an image building Hough map.

ProcessImage ( BitmapData imageData ) : void

Process an image building Hough map.

ProcessImage ( BitmapData imageData, Rectangle rect ) : void

Process an image building Hough map.

ProcessImage ( UnmanagedImage image ) : void

Process an image building Hough map.

ProcessImage ( UnmanagedImage image, Rectangle rect ) : void

Process an image building Hough map.

ToBitmap ( ) : Bitmap

Convert Hough map to bitmap.

비공개 메소드들

메소드 설명
CollectLines ( ) : void

메소드 상세

GetLinesByRelativeIntensity() 공개 메소드

Get lines with relative intensity higher then specified value.
public GetLinesByRelativeIntensity ( double minRelativeIntensity ) : AForge.Imaging.HoughLine[]
minRelativeIntensity double Minimum relative intesity of lines.
리턴 AForge.Imaging.HoughLine[]

GetMostIntensiveLines() 공개 메소드

Get specified amount of lines with highest intensity.
public GetMostIntensiveLines ( int count ) : AForge.Imaging.HoughLine[]
count int Amount of lines to get.
리턴 AForge.Imaging.HoughLine[]

HoughLineTransformation() 공개 메소드

Initializes a new instance of the HoughLineTransformation class.
public HoughLineTransformation ( ) : System
리턴 System

ProcessImage() 공개 메소드

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.
리턴 void

ProcessImage() 공개 메소드

Process an image building Hough map.
Unsupported pixel format of the source image.
public ProcessImage ( Bitmap image, Rectangle rect ) : void
image System.Drawing.Bitmap Source image to process.
rect System.Drawing.Rectangle Image's rectangle to process.
리턴 void

ProcessImage() 공개 메소드

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.
리턴 void

ProcessImage() 공개 메소드

Process an image building Hough map.
Unsupported pixel format of the source image.
public ProcessImage ( BitmapData imageData, Rectangle rect ) : void
imageData System.Drawing.Imaging.BitmapData Source image data to process.
rect System.Drawing.Rectangle Image's rectangle to process.
리턴 void

ProcessImage() 공개 메소드

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.
리턴 void

ProcessImage() 공개 메소드

Process an image building Hough map.
Unsupported pixel format of the source image.
public ProcessImage ( UnmanagedImage image, Rectangle rect ) : void
image UnmanagedImage Source unmanaged image to process.
rect System.Drawing.Rectangle Image's rectangle to process.
리턴 void

ToBitmap() 공개 메소드

Convert Hough map to bitmap.
Hough transformation was not yet done by calling /// ProcessImage() method.
public ToBitmap ( ) : Bitmap
리턴 System.Drawing.Bitmap