*手眼标定的Px和Py的求法。
open_framegrabber (‘DirectShow’, 1, 1, 0, 0, 0, 0, ‘default’, -1, ‘default’, -1, ‘false’, ‘printer_chip/printer_chip_01’, ‘’, 1, 2, AcqHandle)
*初始化相机
grab_image (Image, AcqHandle)
while(true)
grab_image_async (Image1, AcqHandle, -1)
*镜像图片,row是镜像反转,column是列反转,可以点击窗口-算子窗口查看具体命令
mirror_image (Image1, ImageMirror, ‘row’)
mirror_image (ImageMirror, ImageMirror1, ‘column’)
*先灰度化,注意要用镜像后的图片ImageMirror1
rgb1_to_gray (ImageMirror1, GrayImage)
*点灰度直方图,阈值选上勾,把九个点选出来,横坐标是灰度值,纵坐标是有灰度值的个数,九个点都有后插入代码,(5,77)根据情况不同更改 threshold (GrayImage, Region, 5, 77)
*用特征直方图筛选
connection (Region, ConnectedRegions)
*先用面积筛选
select_shape (ConnectedRegions, SelectedRegions, ‘area’, ‘and’, 150, 99999)
*再用圆度和面积共同筛选
select_shape (SelectedRegions, SelectedRegions1, [‘circularity’,‘area’], ‘and’, 150, 99999)
*按照行列排序
sort_region (SelectedRegions1, SortedRegions, ‘first_point’, ‘true’, ‘row’)
*求九个点的坐标
area_center (SelectedRegions1, Area, Row, Column)
endwhile