1. 文件所在
Namespace: Emgu.CV.Structure
Assembly: Emgu.CV (in Emgu.CV.dll) Version: 3.0.0.2157
(3.0.0.2157)
类型分:LineSegment2D 、 LineSegment2DF、 LineSegment3DF
- 2. 函数说明:
2.1构造函数:LineSegment2DF
测试夹角的验证:画线确认之间夹角
部分代码:
Point[] a = new Point[2]; //构造线的点数组
LineSegment2DF [] lin1=new LineSegment2DF [2]; 线段的数组
int lin_num = 0; //线段数字超下标
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (butleft_num < 2) //
{
++butleft_num;
a[butleft_num - 1] = e.Location;
}
if (butleft_num> 2)
{
butleft_num = 0;
}
if (butleft_num == 2)
{
if (lin_num < 2)
{
++lin_num;
lin1[lin_num - 1]
= new LineSegment2DF(a[0], a[1]);
}
Graphics g1 = pictureBox1.CreateGraphics(); // 画图
g1.DrawLine(new Pen(Color.Red,5), a[0], a[1]); 画线
g1.Dispose();
butleft_num = 0;
if (lin_num==2)
{
label1.Text = lin1[1].GetExteriorAngleDegree(lin1[0]).ToString(); //验证角度计算
}
if (lin_num>=2)
{
lin_num = 0;
}
}
}
}