C# 如何在使用SimpleShapeChecker检测到圆后绘制圆?(Accord.net便携式)
因此,在我使用Accord.net便携库中的SimpleShapeChecker()找到一个圆后,我尝试绘制一个圆,使用以下代码: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
// 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"