学习图像处理知识---EmguCv3.4 的PointCollection类

PointCollection类为静态类 ,Namespace:  Emgu.CV

1.通过点集确定矩形

public static Rectangle BoundingRectangle(
	PointF[] points
)

2.通过点集确认椭圆

public static Ellipse EllipseLeastSquareFitting(
	PointF[] points
)

3.在椭圆周围生成一个随机点云。

public static PointF[] GeneratePointCloud(
	Ellipse e, 
	int numberOfPoints // 点的个数
)

4.把点转换为线

public static LineSegment2D[] PolyLine(
	Point[] points,
	bool closed
)
public static LineSegment2DF[] PolyLine(
	PointF[] points,
	bool closed
)

5.单通道像素点转换到3D数组中

Re-project pixels on a 1-channel disparity map to array of 3D points.

public static MCvPoint3D32f[] ReprojectImageTo3D(
	IInputArray disparity,
	IInputArray Q
)
 
 

案例学习:

  PointF [] ki = new PointF[]{ new PointF(20, 20), new PointF(100, 20),  new PointF(20, 120) , new PointF(100, 120), new PointF(110, 125), new PointF(200, 300) };

          Rectangle a1=  PointCollection.BoundingRectangle(ki);  矩形

   //Ellipse a1 = PointCollection.EllipseLeastSquareFitting(ki);   椭圆

 LineSegment2DF[] ko = PointCollection.PolyLine(ki, false);  采用不闭合

            Emgu.CV.Image<Bgr, Byte> g2 = GG.ToImage<Bgr, Byte>();

            g2.Draw(a1, new Bgr(Color.Red));  //可以看出绘图矩形按照最大点位画出,而椭圆却不是采用。

 foreach (var jj in ko)
            {
                g2.Draw(jj, new Bgr(Color.Red),2);
            }

            imageBox1.Image = g2;     



猜你喜欢

转载自blog.csdn.net/tuto7534/article/details/79947305