zoukankan      html  css  js  c++  java
  • EmguCv“线段” 结构类型学习

    1. 文件所在

    Namespace: Emgu.CV.Structure
    Assembly: Emgu.CV (in Emgu.CV.dll) Version: 3.0.0.2157 (3.0.0.2157)

    类型分:LineSegment2D 、 LineSegment2DF、 LineSegment3DF

    1. 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;

                        }

                    }

                }

            }

  • 相关阅读:
    使用 Log4Net 记录日志
    NuGet安装和使用
    .NET Framework 4 与 .NET Framework 4 Client Profile
    “init terminating in do_boot” Windows10 Rabbit MQ fails to start
    Ubuntu / Win7 安装db2 v10.5
    Win7下的内置FTP组件的设置详解
    c/s模式 (C#)下Ftp的多文件上传及其上传进度
    C#路径/文件/目录/I/O常见操作汇总
    C# 遍历指定目录下的所有文件及文件夹
    Mongodb主从复制 及 副本集+分片集群梳理
  • 原文地址:https://www.cnblogs.com/nulidemaomaochong/p/8480802.html
Copyright © 2011-2022 走看看