SynTronic / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

IsQuadrilateral can return true on U-shaped blobs. #162

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to locate a quadrilateral in an image that is supposed to contain 
one, but sometimes I instead locate a U-shaped blob. The attached image 
contains such a blob.

Given that image and:
 Bitmap bmp = new Bitmap("Quadrilateral.png");
 BlobCounter counter = new BlobCounter(bmp);
 List<IntPoint> points = counter.GetBlobsEdgePoints(counter.GetObjectsInformation()[0]);
 SimpleShapeChecker().IsQuadrilateral(points);

IsQuadrilateral returns true, which is not the effect I'd like.

My solution is to count the blob edge points that are close to the nominal 
sides of the quad, but there's likely a better one.

Original issue reported on code.google.com by dales...@gmail.com on 12 Oct 2010 at 5:19

Attachments:

GoogleCodeExporter commented 9 years ago
Yes, it is an issue of current implementation. The problem is that the code 
checks if all given points fit estimated shape with certain error. The shape 
you’ve attached fits it. The code needs to be changed to do a bit opposite 
check – we need to check that for each edge point of the estimated shape 
there is a point in the provided list, which is close enough. This check will 
be more CPU cost, but should work.

Original comment by andrew.k...@gmail.com on 13 Oct 2010 at 9:29