Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在使用SimpleShapeChecker检测到圆后绘制圆?(Accord.net便携式)_C#_Image Processing_Windows Phone 8.1_Aforge_Accord.net - Fatal编程技术网

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

C# 如何在使用SimpleShapeChecker检测到圆后绘制圆?(Accord.net便携式),c#,image-processing,windows-phone-8.1,aforge,accord.net,C#,Image Processing,Windows Phone 8.1,Aforge,Accord.net,因此,在我使用Accord.net便携库中的SimpleShapeChecker()找到一个圆后,我尝试绘制一个圆,使用以下代码: // locate objects using blob counter BlobCounter blobCounter = new BlobCounter( ); blobCounter.ProcessImage( bitmap ); Blob[] blobs = blobCounter.GetObjectsInformation( ); // create Gr

因此,在我使用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( );

因此,在我找到一个圆之后,我真的什么也做不了。是否有解决方法?

系统。Shim Drawing NuGet软件包中提供的图纸类型仅供相应的便携式Accord(和便携式AForge)库内部使用


不要使用
Graphics
bitmap
图像对象上绘制,而应该将
bitmap
转换为您正在使用的平台上的适当图像类型(
WriteableBitmap
在Windows上,
Android.Graphics.bitmap
在Android上,以及
CGImage
在iOS上)并使用每个特定平台上提供的绘图工具。

我明白了。谢谢我让它工作了。我用WriteableBitmapEx画了一个圆圈。
"inaccessible due to its protection level"