




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
跟我学机器视觉-HALCON学习例程中文详解-IC引脚测量*LeadMeasurement:Examplefortheapplicationofthemeasureobject*includingalotofvisualizationoperators.*First,thelengthoftheleadsismeasured,then,theirwidthanddistancefromeachother.***First,readintheimageandinitializetheprogramread_image(Image,'ic_pin')*****************取得图像第一通道的指针,同时得到图像宽度高度*********get_image_pointer1(Image,Pointer,Type,Width,Height)dev_close_window()dev_open_window_fit_image(Image,0,0,509,509,WindowHandle)set_display_font(WindowHandle,14,'mono','true','false')dev_set_draw('margin')dev_set_line_width(3)*、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、!>dev_display(Image)k1*k1*k1*显示图像如下:*DefineanddisplaytherectangularROIswithinwhichtheedgeswillbedetectedRow:=55RowBottom:=955
Column:=200Phi:=rad(-90)Length1:=50Length2:=35dev_set_color('gray')gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)gen_rectangle2(Rectangle,RowBottom,Column,Phi,Length1,Length2)*************************测量位置如绿色矩形所示下:**************************图形窗□:3600-Rectangle易丨询也亀%*图形窗□:3600-Rectangle易丨询也亀%*H适应窗口- 100%★disp_continue_message(WindowHandle,'black','true')stop()**CreateameasureobjectfortheROIatthetopoftheimage.******获取一阶灰度剖面图的插值方法,测量矩形框与图像坐标系之间有角度时生效******Interpolation:='nearest_neighbor'gen_measure_rectangle2(Row,Column,Phi,Length1,Length2,Width,Height,Interpolation,MeasureHandle)、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>生成测量矩形框,、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>、!>生成测量矩形框,先测上部、、、、、、、、、、、、、、、、、、、、、、、、、、、、!>**DeterminealledgesandcalculatetheleadheightatthetopoftheimageSigma:=1.0Threshold:=30
Transition:='all'Select:='all'一.、‘k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*、一甲.measure_pos(Image,MeasureHandle,Sigma,Threshold,Transition,Select,RowEdge,ColumnEdge,Amplitude,Distance)LeadLength1:=Distance*Displaytheresultsdev_set_color('white')k1*k1*、k1*k1*、、、、、、、、、、、、、、、、、、、、、、、、k1*■M图旳窗口:3600-■M图旳窗口:3600-RectangleiiiiririiiiiinTmnmTiTvrjinmrnvjniPressRun(F5)tocontinue醪[观也欧%k11适应窗口F画100%kdisp_line(WindowHandle,RowEdge,ColumnEdge-Length2,RowEdge,ColumnEdge+Length2)disp_message(WindowHandle,'LeadLength:'+LeadLength1$'.2f','window',RowEdge[1]+40,ColumnEdge[1]+100,'yellow','false')*Shiftthemeasureobjectanddeterminetheleadheightatthebottomoftheimage************************转移测量框至新的参考坐标点,及测量下部******************translate_measure(MeasureHandle,RowBottom,Column)一.、‘k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*k1*、一应工甲.measure_pos(Image,MeasureHandle,Sigma,Threshold,Transition,Select,RowEdge,ColumnEdge,Amplitude,Distance)LeadLength2:=Distance
*Displaytheresultsdev_set_color('white')、、、、、、、、、、、、、、、、、k1************************************将测量结果画出适应窗口100%口叵区图旳窗□:3600-Rectangle***********************************将测量结果画出适应窗口100%口叵区图旳窗□:3600-RectanglePressRun(F5)tocontinue**Closethemeasureclose_measure(MeasureHandle)disp_continue_message(WindowHandle,'black','true')stop()**Now,defineanddisplayarectangularROIperpendiculartotheleadsandcreatethemeasuredev_display(Image)Row:=47Column:=485Phi:=0Length1:=420Length2:=8Interpolation:='nearest_neighbor'dev_set_color('black')*******************创建新的测量矩形ROI,如图蓝色矩形:gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)gen_measure_rectangle2(Row,Column,Phi,Length1,Length2,Width,Height,Interpolation,MeasureHandle)**Determinealledgepairsthathaveanegativetransition,i.e.,edgepairs*thatenclosedarkregions.Sigma:=1.0Threshold:=30Transition:='negative'Select:='all'measure_pairs(Image,MeasureHandle,Sigma,Threshold,Transition,Select,RowEdgeFirst,ColumnEdgeFirst,AmplitudeFirst,RowEdgeSecond,ColumnEdgeSecond,AmplitudeSecond,IntraDistance,InterDistance)disp_continue_message(WindowHandle,'black','true')stop()dev_set_color('white')disp_line(WindowHandle,RowEdgeFirst,ColumnEdgeFirst,RowEdgeSecond,ColumnEdgeSecond)avgLeadWidth:=sum(IntraDistance)/|IntraDistance|avgLeadDistance:=sum(InterDistance)/|InterDistance|numLeads:=|IntraDistance|disp_message(WindowHandle,'NumberofLeads:'+numLeads,'window',200,100,'yellow','false')disp_message(WindowHandle,'AverageLeadWidth:'+avgLeadWidth$'.2f','window',260,100,'yellow','false')disp_message(WindowHandle,'AverageLeadDistance:'+avgLeadDistance$'.2f','window',320,100,'yellow','false')disp_continue_message(WindowHandle,'black','true')disp_continue_message(WindowHandle,'black','true')stop()
*Zoomintovisualizethemeasurementresultsinmoredetail.*First,defineanddisplaythezoomwindow.Row1:=0Column1:=600Row2:=100Column2:=700dev_set_color('blue')k1*、、、、、、、、、、、、k1*、、、、、、、、、、、、、、、!>设置放大区域矩形并显示,图中绿色矩形disp_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)disp_continue_message(WindowHandle,'black','true')stop()**Then,zoomtheimageanddisplaytheresults.k1*k1*、、、、、、、、、、、、、、、、、、!>设置图像放大区域并显示k1*k1*、、、、、、、、、、、、、、、、、、、、、、、、、、、、、k1*dev_set_part(Row1,Column1,Row2,Column2)dev_display(Image)、、、、、、、、、、、、k1*dev_set_color('black')**********************画出测量矩形ROI和测得的边缘如图dev_display(Rectangle)p_disp_edge_marker(RowEdgeFirst,ColumnEdgeFir
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- YY 0459-2025外科植入物丙烯酸类树脂骨水泥
- 新疆北庭希望环保科技有限公司吉木萨尔县25万吨-年危废处理利用项目(2)环评报告
- 某著名企业DeepSeek系列09DeepSeek政务应用场景与解决方案
- 工业废水处理与绿色工艺技术
- 工业废气治理技术与方法探讨
- 工业大数据的分析与应用
- 工业建筑设计及自动化机电系统
- 工业污染防治与绿色制造技术分析
- 工业网络通信协议与技术标准
- 工业生产中的设备优化管理
- 2025年合肥城建发展股份有限公司及所属子公司招聘17人(二批次)笔试参考题库附带答案详解
- 【上料机械手结构中的真空系统的设计计算案例1100字】
- 西方美术史试题及答案
- 七年级数学下学期期末测试卷(1)(学生版+解析)-2025年七年级数学下学期期末总复习(北师大版)
- 医院员工手册管理制度
- 校园短剧创作与演出指导行业跨境出海项目商业计划书
- 东航客运岗位面试题目及答案
- 【7历期末】安徽省合肥市包河区2023-2024学年部编版七年级下学期期末历史试卷
- 国家开放大学本科《理工英语4》一平台机考第五大题写作题总题库
- 路基交验具体要求(共5页)
- 粉煤灰对土壤和作物生长的影响
评论
0/150
提交评论