




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
跟我学机器视觉-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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【正版授权】 ISO/IEC 14496-15:2024/AMD1:2025 EN Information technology - Coding of audio-visual objects - Part 15: Carriage of network abstraction layer (NAL) unit structured video in th
- 【正版授权】 IEC 62813:2025 EN-FR Lithium ion capacitors for use in electric and electronic equipment - Test methods for electrical characteristics
- 【正版授权】 ISO/IEC 23094-4:2022/AMD1:2024 EN Information technology - General video coding - Part 4: Conformance and reference software for essential video coding - Amendment 1: Green
- 商务合同续签协议书
- 项目代建协议合同
- 居民采暖供用热合同
- 委托船舶单项其它工程服务合同
- 设计类合同协议
- 墙地砖劳务分包合同
- 美容院顾客服务效果免责协议
- 班会课件:逆风飞翔破茧成蝶-从《哪吒之魔童闹海》看青春期的成长与责任
- 2.1 坚持依宪治国 教案 -2024-2025学年统编版道德与法治八年级下册
- 【语文试卷+答案】2024-2025学年泉州高二上期末质检
- 《修缮定额讲解》课件
- 大学学生宿舍管理员工作培训
- 初三物理常识试卷单选题100道及答案
- 浙江2024公务员考试真题及答案
- 初中新课标培训课件
- 公司银行贷款申请书范文
- 机械设计制造及其自动化专业知识
- 新人教版小学五年级数学下册《第一单元 观察物体(三)》2022课标大单元整体教学设计-全析
评论
0/150
提交评论