在pictureBox图像上绘制坐标

本文关键字:绘制 坐标 图像 pictureBox | 更新日期: 2023-09-27 18:08:17

我想在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);
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**
}        

我得到一个错误。g.DrawPolygon(bluePen, corners)下划线。

错误是:

最好的重载方法匹配System.Drawing. graphics . drawpolygon (System.Drawing. graphics . drawpolygon)Pen, System.Drawing.Point[])"有一些无效的参数

在pictureBox图像上绘制坐标

它期望一个点的数组而不是一个列表,定义角为数组或添加

using System.Linq;

放到文件的顶部,并将该行改为

g.DrawPolygon( bluePen, corners.ToArray());