:: AForge.NET Framework :: Articles :: Forums ::

Not Detecting Rectangle

The forum is to discuss topics related to different areas of image processing and computer vision.

Not Detecting Rectangle

Postby Portekoi » Sun Feb 12, 2017 11:54 am


I've discovered recently because I'm trying to create a basic license plate reader from photo.

I've take this code but reds points are only around the photo.

My code :
Code: Select all
BlobCounter blobCounter = new BlobCounter();

                blobCounter.FilterBlobs = true;
                blobCounter.MinHeight = 5;
                blobCounter.MinWidth = 5;

                blobCounter.ObjectsOrder = AForge.Imaging.ObjectsOrder.Size;
                AForge.Imaging.Blob[] blobs = blobCounter.GetObjectsInformation();

                blobs = blobCounter.GetObjectsInformation();

                // check for rectangles
                AForge.Math.Geometry.SimpleShapeChecker shapeChecker = new AForge.Math.Geometry.SimpleShapeChecker();

                foreach (var blob in blobs)
                    List<IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints(blob);
                    List<IntPoint> cornerPoints;

                    // use the shape checker to extract the corner points
                    if (shapeChecker.IsQuadrilateral(edgePoints, out cornerPoints))
                        // only do things if the corners form a rectangle
                        if (shapeChecker.CheckPolygonSubType(cornerPoints) == AForge.Math.Geometry.PolygonSubType.Rectangle)
                            // here i use the graphics class to draw an overlay, but you
                            // could also just use the cornerPoints list to calculate your
                            // x, y, width, height values.
                            List<System.Drawing.Point> Points = new List<System.Drawing.Point>();
                            foreach (var point in cornerPoints)
                                Points.Add(new System.Drawing.Point(point.X, point.Y));

                            Graphics g = Graphics.FromImage(bmp);
                            g.DrawPolygon(new Pen(Color.Red, 5.0f), Points.ToArray());


Found here : ... s-in-image

Result : Image

How can I isolate the license plate? And why my code is only coloring in red around my photo?

Posts: 1
Joined: Sun Feb 12, 2017 11:48 am

Return to Image Processing and Computer Vision