一维卡尺边缘对

news/2024/9/22 9:53:29/文章来源:https://www.cnblogs.com/zeussbook/p/18392318

一、代码部分

* 一维卡尺 边缘对read_image (Image, 'printer_chip/printer_chip_01')*打开助手操作生成代码* Measure 02: Code generated by Measure 02
* Measure 02: Prepare measurement
AmplitudeThreshold := 40
RoiWidthLen2 := 5
set_system ('int_zooming', 'true')
* Measure 02: Coordinates for line Measure 02 [0]
LineRowStart_Measure_02_0 := 147.099
LineColumnStart_Measure_02_0 := 497.926
LineRowEnd_Measure_02_0 := 145.627
LineColumnEnd_Measure_02_0 := 915.834
* Measure 02: Convert coordinates to rectangle2 type
TmpCtrl_Row := 0.5*(LineRowStart_Measure_02_0+LineRowEnd_Measure_02_0)
TmpCtrl_Column := 0.5*(LineColumnStart_Measure_02_0+LineColumnEnd_Measure_02_0)
TmpCtrl_Dr := LineRowStart_Measure_02_0-LineRowEnd_Measure_02_0
TmpCtrl_Dc := LineColumnEnd_Measure_02_0-LineColumnStart_Measure_02_0
TmpCtrl_Phi := atan2(TmpCtrl_Dr, TmpCtrl_Dc)
TmpCtrl_Len1 := 0.5*sqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc)
TmpCtrl_Len2 := RoiWidthLen2* Measure 02: Create measure for line Measure 02 [0]
* Measure 02: Attention: This assumes all images have the same size!
gen_measure_rectangle2 (TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, 1600, 1200, 'nearest_neighbor', MsrHandle_Measure_02_0)
* Measure 02: ***************************************************************
* Measure 02: * The code which follows is to be executed once / measurement *
* Measure 02: ***************************************************************
* Measure 02: The image is assumed to be made available in the
* Measure 02: variable last displayed in the graphics window
copy_obj (Image, Image, 1, 1)*边缘对测量
*边缘对,两点成对,一对必有第一个点和第二个点,必须先理解这个概念。
* 输出结果 Row1 第一行 (边缘对第一个点row)
* 输出结果 Column1 第一列(边缘对第一个点column)
* 输出结果 Row2 第二行(边边缘对第第二个点row)
* 输出结果 Column2 第二列(边缘对第二个点column)
* 输出结果 Width 边缘对内部的距离
* 输出结果 Distance 边缘对之间的距离
measure_pairs (Image, MsrHandle_Measure_02_0, 1, AmplitudeThreshold, 'all', 'all', \Row1_Measure_02_0, Column1_Measure_02_0, Amplitude1_Measure_02_0, \Row2_Measure_02_0, Column2_Measure_02_0, Amplitude2_Measure_02_0, \Width_Measure_02_0, Distance_Measure_02_0)*--生成代码结束*显示第一个点
gen_cross_contour_xld (Cross, Row1_Measure_02_0[0], Column1_Measure_02_0[0], 36, 0.785398)

 

二、生成代码

1.打开助手,打开Measure窗口,绘制直线

 

2.勾选边缘对,生成代码

 

三、练习作业

计算第一排针脚的个数,标注第20针脚的位置

* 一维卡尺作业,计算针脚个数,标准第20个
read_image (Image, 'D:/hoclan/bianyuandui.png')*打开助手,绘制Measure直线,插入代码
* Measure 03: Code generated by Measure 03
* Measure 03: Prepare measurement
AmplitudeThreshold := 40
RoiWidthLen2 := 5
set_system ('int_zooming', 'true')
* Measure 03: Coordinates for line Measure 03 [0]
LineRowStart_Measure_03_0 := 63.125
LineColumnStart_Measure_03_0 := 34.6127
LineRowEnd_Measure_03_0 := 63.125
LineColumnEnd_Measure_03_0 := 949.966
* Measure 03: Convert coordinates to rectangle2 type
TmpCtrl_Row := 0.5*(LineRowStart_Measure_03_0+LineRowEnd_Measure_03_0)
TmpCtrl_Column := 0.5*(LineColumnStart_Measure_03_0+LineColumnEnd_Measure_03_0)
TmpCtrl_Dr := LineRowStart_Measure_03_0-LineRowEnd_Measure_03_0
TmpCtrl_Dc := LineColumnEnd_Measure_03_0-LineColumnStart_Measure_03_0
TmpCtrl_Phi := atan2(TmpCtrl_Dr, TmpCtrl_Dc)
TmpCtrl_Len1 := 0.5*sqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc)
TmpCtrl_Len2 := RoiWidthLen2
* Measure 03: Create measure for line Measure 03 [0]
* Measure 03: Attention: This assumes all images have the same size!
gen_measure_rectangle2 (TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, 988, 1018, 'nearest_neighbor', MsrHandle_Measure_03_0)
* Measure 03: ***************************************************************
* Measure 03: * The code which follows is to be executed once / measurement *
* Measure 03: ***************************************************************
* Measure 03: The image is assumed to be made available in the
* Measure 03: variable last displayed in the graphics window
copy_obj (Image, Image, 1, 1)
* Measure 03: Execute measurements
measure_pairs (Image, MsrHandle_Measure_03_0, 1, AmplitudeThreshold, 'all', 'all', Row1_Measure_03_0, Column1_Measure_03_0, Amplitude1_Measure_03_0, Row2_Measure_03_0, Column2_Measure_03_0, Amplitude2_Measure_03_0, Width_Measure_03_0, Distance_Measure_03_0)
* Measure 03: Do something with the results
*--插入代码结束*计算第20个针脚的位置,并生成矩形2轮廓
gen_rectangle2_contour_xld (Rectangle, Row1_Measure_03_0[19]+Row2_Measure_03_0[19]-Row1_Measure_03_0[19], Column1_Measure_03_0[19]+Column2_Measure_03_0[19]-Column1_Measure_03_0[19], rad(90), 25, \Column2_Measure_03_0[20]-Column1_Measure_03_0[20])*显示信息
dev_disp_text ('这是第20个针脚,共有'+|Row1_Measure_03_0|+'个针脚', 'image', Row1_Measure_03_0[19]+Row2_Measure_03_0[19]-Row1_Measure_03_0[19], Column1_Measure_03_0[19]+Column2_Measure_03_0[19]-Column1_Measure_03_0[19], 'blue', [], [])

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/790913.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

mongodb 集合的导入导出

在新版本的mongodb中已经不默认安装这些工具,需要到mongodb网站单独下载 https://www.mongodb.com/try/download/database-tools 下载完成后使用scp D:\mongodb-tools.tgz root@8.143.49.192:/home/mongodb_tools.tgz命令将文件复制到linux服务器用 tar -zxvf demo.tar.gz -C …

nginx 版本升级 转载

Nginx 的版本最开始使用的是 Nginx-1.18.0 , 由于服务升级,需要将 Nginx 的版本升级到 Nginx-1.19.7 ,要求 Nginx 不能中断提供服务。 为了应对上述的需求,提供两种解决方案: 方案1: make upgrade 完成升级方案2: 服务信号 完成升级nginx 版本升级环境说明当前是 CentOS…

如何从 AWS CodeCommit 迁移到极狐GitLab?

本文将分享如何从 AWS CodeCommit 服务无缝迁移到极狐GitLab,并且使用极狐GitLab 的一体化 DevSecOps 平台功能来进行软件研发。2024 年 7 月 25 日,AWS 官方发布了一则重要通知:旗下的代码托管服务 AWS CodeCommit 服务将不再接受新用户的注册,老用户可以继续使用,但是该…

【验证码逆向专栏】某某邮政滑块逆向分析

声明 本文章中所有内容仅供学习交流使用,不用于其他任何目的,不提供完整代码,抓包内容、敏感网址、数据接口等均已做脱敏处理,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关! 本文章未经许可禁止转载,禁止任何修改后二次传播,擅自使用本文讲解的技术…

PyTorch从入门到放弃之张量模块

目录张量的数据类型torch.rand()函数torch.randn()函数torch.normal()函数torch.linspace()函数torch.manual_seed()函数torch.ones()、torch.zeros()、torch.eye()张量的基本操作增加和删除维度交换维度拼接和分割堆叠和分解索引和切片基本数学运算元素求和按索引求和元素乘积…

Windows + macOS n合一 安装U盘制作

还不会制作MacOS多合一+Windows系统U盘?分享一个制作macOS和Windows双系统U盘的方法,macOS系统以macOS10.15.7和11.5.2为例(12和13制作方法一样,只是制作的命令不一样,Window PE系统以微PE为例子,准备工作如下: 1、第一步准备好一个32GU盘; 2、准备一台Windows电脑; …

推荐分享一个好用的api测试工具

Packer-Fuzzer 随着WEB前端打包工具的流行,在日常渗透测试、安全服务中是否遇到越来越多以Webpack打包器为代表的网站?这类打包器会将整站的API和API参数打包在一起供Web集中调用,这也便于我们快速发现网站的功能和API清单,但往往这些打包器所生成的JS文件数量异常之多并且…

电商API接口对接:打造高效、稳定、安全的数字商业链

https://img2024.cnblogs.com/blog/3506472/202409/3506472-20240902100747324-1465861685.png在数字化浪潮的推动下,电商API接口已成为连接电商平台与商家后台系统的重要桥梁。然而,随着数据量的激增和业务需求的多样化,如何在对接过程中确保高效性、稳定性和安全性,成为了…

k8s CSI 插件注册原理

目录一、CSI Driver 如何注册到 kubelet 的1、启动 CSI Node Server2、启动 Node Driver Registrar3、Node Driver Registrar 获取 CSI Plugin 信息4、Kubelet 发现 Node Driver Registrar5、Kubelet 获取 Node Server 信息6、更新 Node 和 CSINode 对象7、通知注册状态 一、CS…

Switch 塞尔达传说旷野之息:中文本体+1.6.0+2DLC整合版+林可儿3.0.1 增强整合MOD

整合包复制到SD卡,同时解压MOD复制到atmosphere/contents,使用DBI安装成功。 安装后原来版本的存档还在。 本体+1.6.0+2DLC整合版XCI塞尔达传说:狂野之息/旷野之息 游戏变成了完全的开放地图,沙盒式的玩法拓展出了更多的内容,林克可以爬山、游泳, 而且游戏对应外观变化,玩…