QuadrilateralFinder Class |
Namespace: Accord.Imaging
The QuadrilateralFinder type exposes the following members.
Name | Description | |
---|---|---|
QuadrilateralFinder | Initializes a new instance of the QuadrilateralFinder class |
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ProcessImage(Bitmap) |
Find corners of quadrilateral/triangular area in the specified image.
| |
ProcessImage(BitmapData) |
Find corners of quadrilateral/triangular area in the specified image.
| |
ProcessImage(UnmanagedImage) |
Find corners of quadrilateral/triangular area in the specified image.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
The class searches for quadrilateral's/triangle's corners on the specified image. It first collects edge points of the object and then uses FindQuadrilateralCorners(IEnumerableIntPoint) to find corners the quadrilateral/triangle.
Note |
---|
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: