AForge没有检测到有一条线从圆圈出来的圆圈

时间:2017-02-28 11:59:02

标签: c# aforge

我使用 AForge 检测到特定图像中的圆圈,并且工作正常。但我面临一个问题。如果circle有一条小线从一个圆圈到外面,如下图所示,则它不会将此圆圈识别为圆圈。

是否有关于如何处理此类圈子的工作,或者这不再是 AForge 的圈子?

enter image description here

我使用了以下代码段并且它的工作正常  没有小线从圆圈出来的圆圈。

// locate objects using blob counter
BlobCounter blobCounter = new BlobCounter( );
blobCounter.ProcessImage( bitmap );
Blob[] blobs = blobCounter.GetObjectsInformation( );
// create Graphics object to draw on the image and a pen
Graphics g = Graphics.FromImage( bitmap );
Pen redPen = new Pen( Color.Red, 2 );
// check each object and draw circle around objects, which
// are recognized as circles
for ( int i = 0, n = blobs.Length; i < n; i++ )
{
    List<IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints( blobs[i] );

    Point center;
    float radius;

    if ( shapeChecker.IsCircle( edgePoints, out center, out radius ) )
    {
        g.DrawEllipse( redPen,
            (int) ( center.X - radius ),
            (int) ( center.Y - radius ),
            (int) ( radius * 2 ),
            (int) ( radius * 2 ) );
    }
}

redPen.Dispose( );
g.Dispose( );

0 个答案:

没有答案