跟我学机器视觉--example

跟我学机器视觉--example

ID:14720491

大小:89.50 KB

页数:13页

时间:2018-07-30

跟我学机器视觉--example_第1页
跟我学机器视觉--example_第2页
跟我学机器视觉--example_第3页
跟我学机器视觉--example_第4页
跟我学机器视觉--example_第5页
资源描述:

《跟我学机器视觉--example》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、HALCON学习例程中文-IC引脚测量路径-------C:ProgramFilesMVTecHALCON-10.0exampleshdevelopApplicationsMeasuring-2Dmeasure_pin.hdev·LeadMeasurement:Examplefortheapplicationofthemeasureobject·includingalotofvisualizationoperators.·First,thelengthoftheleadsismeasured,then,theirwidthanddistancefr

2、omeachother.·First,readintheimageandinitializetheprogramRead_image(Image,'icpin')****取得图像第一通道的指针,同时得到图像宽度高度**Get_image_pointer1(Image,Pointer,Type,Width,Height)*get_image_pointer1(Image:::Pointer,Type,Width,Height);获得图像的数据。如:类型(='字节',''',uint2int2等等)和图像的尺寸(的宽度和高度)Dev_close_window()dev

3、_close_window(:::)  关闭活跃的图形窗口。Dev_open_window_fit_image(Image,0,0,509,509,WindowHandle)设置窗口自适应图片,获得句柄Set_display_font(WindowHandle,14,'mono','true','false')内部程序,设置字体dev_display(Image)****显示图像如下:************·DefineanddisplaytherectangularROIswithinwhichtheedgeswillbedetected//ROI设置Dev_

4、set_draw('margin')Dev_se_tline_width(3)Row:=55RowBottom:=955Column:=200Phi:=rad(-90)Length1:=50Length2:=35devsetcolor('gray')gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)gen_rectangle2(Rectangle,RowBottom,Column,Phi,Length1,Length2)创建ROI的矩形显示区域*******测量位置如绿色矩形所示下:********Di

5、sp_continue_message(WindowHandle,'black','true')显示‘继续’信息stop()·CreateameasureobjectfortheROIatthetopoftheimage.*获取一阶灰度剖面图的插值方法,测量矩形框与图像坐标系之间有角度时生效*Interpolation:='nearest_neighbor'********生成测量矩形框,先测上部********Gen_measure_rectangle2(Row,Column,Phi,Length1,Length2,Width,Height,Interpolat

6、ion,MeasureHandle)·Determinealledgesandcalculatetheleadheightatthetopoftheimage//垂直与矩形的直线边缘的提取。Sigma:=1.0Threshold:=30Transition:='all'Select:='all'***********进行测量*********measure_pos(Image,MeasureHandle,Sigma,Threshold,Transition,Select,RowEdge,ColumnEdge,Amplitude,Distance)提取与矩形或环状弧

7、垂直的直线边缘。LeadLength1:=Distance·Displaytheresultsdevsetcolor('white')**********将测量结果画出********disp_line(WindowHandle,RowEdge,ColumnEdge-Length2,RowEdge,ColumnEdge+Length2)disp_message(WindowHandle,'LeadLength:'+LeadLength1$'.2f','window',RowEdge[1]+40,ColumnEdge[1]+100,'yellow','false')

8、程序写入文

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。