跟我学机器视觉

上传人:d**** 文档编号:203310927 上传时间:2023-04-24 格式:DOCX 页数:9 大小:552.98KB
收藏 版权申诉 举报 下载
跟我学机器视觉_第1页
第1页 / 共9页
跟我学机器视觉_第2页
第2页 / 共9页
跟我学机器视觉_第3页
第3页 / 共9页
资源描述:

《跟我学机器视觉》由会员分享,可在线阅读,更多相关《跟我学机器视觉(9页珍藏版)》请在装配图网上搜索。

1、跟我学机器视觉-HALCON学习例程中文详解-IC引脚测量l=JIM* Lead Measurement: Example for the application of the measure object* including a lot of visualization operators.* First, the length of the leads is measured, then, their width and distance from each other.* First, read in the image and initialize the programread_i

2、mage (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)+ + + + + + + + + + + + + + + + + + + +

3、 + + + + + + + + + + + + + + + + + + + + 个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个dev_display (Image)& kL- kL- + + + + + + + + + 力力 KP 个个个个个个个个个个个个个个个个显示图像如下:dev_set_line_width (3)* Define and display the rectangular ROIs within which the edges will be detectedRow := 55RowBottom := 955Column := 200Ph

4、i := rad(-90)Lengthl := 50Length2 := 35 dev_set_color (gray) gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2)gen_rectangle2 (Rectangle, RowBottom, Column, Phi, Lengthl, Length2)e kl. kl- + + + + + + + + + + + + + + + + + + + + + + + 个个个个个个个个个个个个个个个个个个个个个个个个个个*测量位置如绿色矩形所示下:disp_continue

5、_message (WindowHandle, black, true) stop ()* Create a measure object for the ROI at the top of the image.*获取一阶灰度剖面图的插值方法,测量矩形框与图像坐标系之间有角度时生效*Interpolation := nearest_neighbor生成测量矩形框,先测上部+ + + + + + + + + + + + + + + + + + + + + + + + + + + + 个个个个个个个个个个个个个个个个个个个个个个个个个个个个 + + + + + + + + + + + + + +

6、+ + + + + + + + + + + + + + 个个个个个个个个个个个个个个个个个个个个个个个个个个个个gen_measure_rectangle2 (Row, Column, Phi, Lengthl, Length2, Width, Height, Interpolation,MeasureHandle)* Determine all edges and calculate the lead height at the top of the imageSigma := 1.0Threshold := 30Transition := allSelect := allS+P 4二雨H

7、曰.a” 个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个中什4/ | 由个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个 妃L I J加申.measure_pos (Image, MeasureHandle, Sigma, Threshold, Transition, Select, RowEdge,ColumnEdge, Amplitude, Distance)LeadLength1 := Distance* Display the results disp_line (WindowHandle, RowEdge, ColumnEdge-Leng

8、th2, RowEdge, ColumnEdge+Length2) disp_message (WindowHandle, Lead Length: +LeadLength1$.2f, window, RowEdge1+40, ColumnEdge1+100, yellow, false) *& kL- kL- + + + + + + + + + + + + + + + + + + + + + +& 力 KP个个个个个个个个个个个个个个个个个个个个个个个个个个个个个dev_set_color (white)*将测量结果画出* Shift the measure object and deter

9、mine the lead height at the bottom of the image *转移测量框至新的参考坐标点,及测量下部*translate_measure (MeasureHandle, RowBottom, Column)个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个中什/ | 由个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个 妃L I J加申.measure_pos (Image, MeasureHandle, Sigma, Threshold, Transition, Select, RowEdge,ColumnEdge,

10、 Amplitude, Distance)LeadLength2 := Distance* Display the results dev_set_color (white)*将测量结果画出 *disp_line (WindowHandle, RowEdge, ColumnEdge-Length2, RowEdge, ColumnEdge+Length2) disp_message (WindowHandle, Lead Length:+LeadLength2$.2f, window, 360,ColumnEdge1+100, red, false) * Close the measurecl

11、ose_measure (MeasureHandle)disp_continue_message (WindowHandle, black, true) stop () * Now, define and display a rectangular ROI perpendicular to the leads and create the measure dev_display (Image)Row := 47Column := 485Phi := 0Length1 := 420Length2 := 8Interpolation := nearest_neighbordev_set_color

12、 (black)& 力 + + + + + + + + + + + + + + & 力 kP 个个个个个个个个个个个个个个个个个个个*创建新的测量矩形ROI,如图蓝色矩形: gen_rectangle2 (Rectangle, Row, Column, Phi, Lengthl, Length2)gen_measure_rectangle2 (Row, Column, Phi, Length1, Length2, Width, Height, Interpolation, MeasureHandle) * Determine all edge pairs that have a negativ

13、e transition, i.e., edge pairs* that enclose dark regions.Sigma := 1.0Threshold := 30Transition := negativeSelect := all*北彳洲管 并息亦站里*measure_pairs (Image, MeasureHandle, Sigma, Threshold, Transition, Select, RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSeco

14、nd, 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|

15、numLeads := |IntraDistance|disp_message (WindowHandle, Number of Leads: +numLeads, window, 200, 100, yellow, false)disp_message (WindowHandle, Average Lead Width: +avgLeadWidth$.2f, window, 260, 100, yellow, false)disp_message (WindowHandle, Average Lead Distance: +avgLeadDistance$.2f, window, 320,

16、100, yellow, false)disp_continue_message (WindowHandle, black, true)disp_continue_message (WindowHandle, black, true)stop ()* Zoom in to visualize the measurement results in more detail.* First, define and display the zoom window.Rowl := 0Column! := 600Row2 := 100Column2 := 700e 力 e + + + + + + + +

17、+ + + 虫力 kp 个个个个个个个个个个个个个个个个个dev_set_color (blue)e kl. 士 + + + + + + + + + + + + + + + + + + + + + + + 个个个个个个个个个个个个个个个个个个个个个个个个个个设置放大区域矩形并显示,图中绿色矩形disp_rectangle1 (WindowHandle, Rowl, Columnl, Row2, Column2) disp_continue_message (WindowHandle, black, true) stop () * Then, zoom the image and display

18、 the results.e kl. kl. + + + + + + + + + + + + + + + & & + 个个个个个个个个个个个个个个个个个个个个个设置图像放大区域并显示e kl. kl.山 + + + + + + + + + + + + + + + + + + + + + + + + + + + e kl. kp 个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个个dev_set_part (Rowl, Columnl, Row2, Column2)dev_display (Image)& kl. kl. e + + + + + + + + + + + + + +

19、 + + + e kl. kl. 个个个个个个个个个个个个个个个个个个个个个个个个个dev_set_color (black)*画出测量矩形ROI和测得的边缘如图dev_display (Rectangle)p_disp_edge_marker (RowEdgeFirst, ColumnEdgeFirst, Phi, 5, white, 3, WindowHandle) p_disp_edge_marker (RowEdgeSecond, ColumnEdgeSecond, Phi, 5, white, 3, WindowHandle) * Close the measureclose_measure (MeasureHandle)* Reset the display parameters.dev_set_part (0, 0, Height-1, Width-1)dev_set_draw (fill)dev_set_line_width(1)

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!