电子元件插针引脚测量实验.doc
文本预览下载声明
电子元件插针引脚测量实验
【实验目的】
掌握如何建立被测量工件对象的基本检测步骤,包括工件定位、光源调整、焦距调节等图象测量,进而掌握工件尺寸测量可视化组态编程方法和技术,掌握如何对多插针相关尺寸参数同时测量的新方法,建立被测量插针的基本检测框架,进而扎实掌握插件多针尺寸、针间距及针宽度测量新技术,具备解决实际复杂插件多针参数视觉测量的技术难题。
【实验内容】
测量如图1-1 所示电子插件插针参数尺寸
(a) (b)
图1-1 :开关
需要测量开关引脚的宽度及相互之间的距离。(b)确定检测边缘的矩形感兴趣区。
【实验步骤】
1、工件定位:将工件放置到平台转盘上相应位置,确保动态图象采集根据被测对象求。
2、光源调整:选择前光源或背光源确保图象不受自然光源影响。
3、焦距调节:根据被测对象大小和厚度,调节支架横枞位置和相机焦距。
4、打开图像处理软件,通过变量输入窗口、源程序窗口、菜单栏算子三种方式添加算子,编写工件尺寸的测量与标定程序。
* This example program demonstrates the basic usage of a measure object.
* Here, the task is to determine the width of and the distance between the
* pins of a switch.
*
* First, read in the image and initialize the program.
read_image (Image, C:/Users/lipengfei/Pictures/图片库/1、插针引脚/bin_switch_7.png)
get_image_pointer1 (Image, _, _, Width, Height)
dev_open_window (0, 0, Width, Height, black, WindowHandle)
dev_display (Image)
*
* Define the rectangular ROI within which the edges will be detected
* and create the measure.
Row := 390
Column := 380
Phi := rad(-60)
Length1 := 60
Length2 := 10
Interpolation := nearest_neighbor
gen_measure_rectangle2 (Row, Column, Phi, Length1, Length2, Width, Height, Interpolation, MeasureHandle)
*
* Determine all edge pairs that have a negative transition, i.e., edge pairs
* that enclose dark regions.
Sigma := 0.9
Threshold := 12
Transition := negative
Select := all
measure_pairs (Image, MeasureHandle, Sigma, Threshold, Transition, Select, RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)
*
* Visualize the results
dev_display (Image)
dev_set_draw (margin)
dev_set_color (black)
gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2)
p_disp_dimensions (RowEdgeFirst, ColumnEdgeFirst, RowEdgeSecond, ColumnEdgeSecond, IntraDistance, InterDistance, Phi, Length2, WindowHandle)
*
* Free the memory that has been allocated for the measure.
close_measure (MeasureHandle)
算法
主要算法步骤:
1)通过包含如图1-1(b)描述引脚的ROI矩形创建测量
显示全部