关于机器视觉机械手与相机标定走位点位的计算模块

首先标定要确定机械手和相机的安装方式选择平台属性。
一:眼在手上即标定的对象是相机
二:眼在手外即标定的对象是平台
输入原点坐标即机械手拍照点位置(X,Y,C,R)
选择X,Y,R轴方向及运动步长(写入整形)
点击【点位生成】输出数据表报。
附上界面效果展示
在这里插入图片描述

   
        //加密狗访问
        private void button1_Click(object sender, EventArgs e)
        {
   
            
            System.Diagnostics.Process.Start("Explorer.exe", "http://localhost:1947/");
        }

        //退出事件
        private void button2_Click(object sender, EventArgs e)
        {
   
            Process[] pc=Process.GetProcesses();
            foreach (var item in pc)//
            {
   
               try
               {
   
                    if (item.ProcessName =="iexplore")
                {
   
                    item.Kill();
                }
               }
               catch (System.Exception ex)
               {
   
                   Console.WriteLine( ex.Message  );
               	
               }

               }
            this.Close();
            }

        //生成文件
        private void button3_Click(object sender, EventArgs e)
        {
   
            string path=@"D:\Luster";
            string files=textBox2.Text;
            if(files=="")
            {
   
                files="1.工程;2.软件;3.数据;4.图片;5.文档;6.标定;7.其他";
                textBox2.Text=files;
            
            }
            textBox1.Text = Directory.Exists(path).ToString();
            if (textBox1.Text=="False")
            {
   
                string[] filepaths=files.Split(';');
                for (int i = 0; i < filepaths.Length; i++)
                {
   
                    Directory.CreateDirectory(path + "\\" + filepaths[i]);
                }
                textBox2.Text = files;
                MessageBox.Show("文件创建完成!!");
            }
            else
            {
   
                MessageBox.Show("文件已创建!!");
            
            }
           
        }

        //点击按钮生成标定坐标
        //需要 原点坐标   轴方向   步长   输出文件位置 
        private void button4_Click(object sender, EventArgs e)
        {
   
            if (Reasult())
            {
   
                StringBuilder sb = new StringBuilder();
                int stepX=int.Parse(textBox5.Text);
                int stepY=int.Parse(textBox8.Text);
                int stepR=int.Parse(textBox6.Text);
                int selectnum=SelcetNums();
                List<List<double>> A = CalibrationPointList(stepX, stepY, stepR, selectnum);
                for (int i = 0; i < A.Count; i++)
                {
   
                    for (int j = 0; j < A[i].Count; j++)
                    {
   
                        
                        sb.Append(A[i][j]);
                        sb.Append(",");
                    }
                    sb.Append("\r\n");
                }
                textBox7.Text=sb.ToString();
                string fileName = @"C:\Users\至尊宝\Desktop\标定文件.csv";
                using (FileStream fsw = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write))
                {
   
                    byte[] buffer = Encoding.Default.GetBytes(textBox7.Text);
                    fsw.Write(buffer,0, buffer.Length);
                } 
            }
            else
            {
   
                MessageBox.Show("请填入正确的参数信息!");

            }
        }
              
 


        //判断条件符合要求
        private bool Reasult()
        {
   
            if (textBox3.Text.Count() > 4 && (comboBox4.Text == "顺时针" || comboBox4.Text == "逆时针") && (comboBox3.Text == "平台" || comboBox3.Text == "相机") && (comboBox1.Text == "向左" || comboBox1.Text == "向右") && (comboBox2.Text == "向上" || comboBox2.Text == "向下") && Regex.IsMatch(textBox5.Text, @"^\d+$") && Regex.IsMatch(textBox6.Text, @"^\d+$"))
            {
   
                return true;
            }
            else
            {
   
                return false;
            }
        }

        private List<List<double>> CalibrationPointList(int X,int Y,int R,int SelcectNum)
        {
   
            double X1=0;
            double Y1=0
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值