C# pictureBox图像上的坐标绘制
我尝试在picturebox上绘图,代码如下:C# pictureBox图像上的坐标绘制,c#,system.drawing,aforge,C#,System.drawing,Aforge,我尝试在picturebox上绘图,代码如下: List<IntPoint> edgePoints; List<IntPoint> corners; AForge.Imaging.Blob[] blobs = blobCounter.GetObjectsInformation(); Graphics g = Graphics.FromImage(pictureBox2.Image); Pen bluePen = new Pen(Color.Blue, 5); doub
List<IntPoint> edgePoints;
List<IntPoint> corners;
AForge.Imaging.Blob[] blobs = blobCounter.GetObjectsInformation();
Graphics g = Graphics.FromImage(pictureBox2.Image);
Pen bluePen = new Pen(Color.Blue, 5);
double[] blobAdjustedSize = new double[blobs.Length];
for (int i = 0, n = blobs.Length; i < n; i++)
{
edgePoints = blobCounter.GetBlobsEdgePoints(blobs[i]);
corners = PointsCloud.FindQuadrilateralCorners(edgePoints);
g.DrawPolygon(bluePen, corners); // **UNDERLINE**
}
列出边缘点;
列出角落;
AForge.Imaging.Blob[]blobs=blobCounter.GetObjectsInformation();
Graphics g=Graphics.FromImage(pictureBox2.Image);
钢笔蓝色钢笔=新钢笔(颜色:蓝色,5);
double[]blobAdjustedSize=新的double[blobs.Length];
for(int i=0,n=blobs.Length;i
我得到了一个错误<代码>g.DrawPolygon(蓝笔,角)带下划线
错误是:
与System.Drawing.Graphics.DrawPolygon(System.Drawing.Pen,System.Drawing.Point[])匹配的最佳重载方法具有一些无效参数
它需要的是一个列表,而不是一个列表,将角点定义为或添加
,并将该行更改为
g.DrawPolygon( bluePen, corners.ToArray());
错误提到了它。您没有提供正确的参数。您需要将CLR点对象数组传递到方法中,它可能不喜欢aForge IntPoint,您需要将它们的类强制到.NET Point Classis is logical@Rich。可能您是对的。但是当我更改时,edgePoints=blobCounter.GetBlobsEdgePoints(blobs[I]);corners=points loud.find四边形角点(edgePoints);线出错。:)我只是在计算值,不是在绘制屏幕。:)现在解决了。谢谢帮助。
g.DrawPolygon( bluePen, corners.ToArray());