使用SimpleShapeChecker检测到圆后如何绘制圆? (Accord.net 便携式)

How to draw a circle after a circle is detected using SimpleShapeChecker? (Accord.net Portable)

因此,在使用以下代码使用 Accord.net 可移植库中的 SimpleShapeChecker() 找到一个圆后,我尝试绘制一个圆:

// 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( );

然而,System.Drawing.Graphics和System.Drawing.Pen都显示错误:

"inaccessible due to its protection level"

所以我找到一个圆圈之后就什么也做不了了。有什么解决方法吗?

Shim Drawing NuGet 包中提供的 System.Drawing 类型仅供相应的 Portable Accord[=24= 内部使用](和 便携式 AForge)库。

与其使用 Graphicsbitmap 图像对象上绘制,不如将 bitmap 转换为您正在使用的平台上的适当图像类型(WriteableBitmap Windows、Android.Graphics.Bitmap Android 和 CGImage iOS)并使用每个特定平台上可用的绘图工具。