C# 클래스 Accord.Imaging.QuadrilateralFinder

Searching of quadrilateral/triangle corners.

The class searches for quadrilateral's/triangle's corners on the specified image. It first collects edge points of the object and then uses Accord.Math.Geometry.PointsCloud.FindQuadrilateralCorners to find corners the quadrilateral/triangle.

The class treats all black pixels as background (none-object) and all none-black pixels as object.

The class processes grayscale 8 bpp and color 24/32 bpp images.

Sample usage:

// get corners of the quadrilateral QuadrilateralFinder qf = new QuadrilateralFinder( ); List<IntPoint> corners = qf.ProcessImage( image ); // lock image to draw on it with AForge.NET's methods // (or draw directly on image without locking if it is unmanaged image) BitmapData data = image.LockBits( new Rectangle( 0, 0, image.Width, image.Height ), ImageLockMode.ReadWrite, image.PixelFormat ); Drawing.Polygon( data, corners, Color.Red ); for ( int i = 0; i < corners.Count; i++ ) { Drawing.FillRectangle( data, new Rectangle( corners[i].X - 2, corners[i].Y - 2, 5, 5 ), Color.FromArgb( i * 32 + 127 + 32, i * 64, i * 64 ) ); } image.UnlockBits( data );

Source image:

Result image:

파일 보기 프로젝트 열기: accord-net/framework

공개 메소드들

메소드 설명
ProcessImage ( Bitmap image ) : List

Find corners of quadrilateral/triangular area in the specified image.

ProcessImage ( BitmapData imageData ) : List

Find corners of quadrilateral/triangular area in the specified image.

ProcessImage ( UnmanagedImage image ) : List

Find corners of quadrilateral/triangular area in the specified image.

비공개 메소드들

메소드 설명
CheckPixelFormat ( PixelFormat format ) : void

메소드 상세

ProcessImage() 공개 메소드

Find corners of quadrilateral/triangular area in the specified image.
Unsupported pixel format of the source image.
public ProcessImage ( Bitmap image ) : List
image System.Drawing.Bitmap Source image to search quadrilateral for.
리턴 List

ProcessImage() 공개 메소드

Find corners of quadrilateral/triangular area in the specified image.
Unsupported pixel format of the source image.
public ProcessImage ( BitmapData imageData ) : List
imageData System.Drawing.Imaging.BitmapData Source image data to search quadrilateral for.
리턴 List

ProcessImage() 공개 메소드

Find corners of quadrilateral/triangular area in the specified image.
Unsupported pixel format of the source image.
public ProcessImage ( UnmanagedImage image ) : List
image UnmanagedImage Source image to search quadrilateral for.
리턴 List