筛选出来的点得坐标已经显示在PxRow
、PxColunm
里边
* Image Acquisition 01: Code generated by Image Acquisition 01
read_image (Image, 'C:/Users/Administrator/Desktop/标定板图片.png')
dev_close_window ()
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
dev_display (Image)
binary_threshold (Image, Region, 'max_separability', 'dark', UsedThreshold)
connection (Region, ConnectedRegions)
*筛选出来九个点
select_shape_std (ConnectedRegions, SelectedRegions, 'max_area', 70)
shape_trans (SelectedRegions, RegionTrans, 'outer_circle')
*求出九点坐标
area_center (RegionTrans, Area, Row, Column)
disp_message (WindowHandle, 'R:'+Row+' C:'+Column, 'Image', Row, Column, 'black', 'true')
*九点标定行
PxRow:=[23.5, 23.5, 23.5, 71.5, 71.5, 71.5, 118.5, 118.5, 118.5]
*九点标定列
PxColunm:=[28.5, 75.5, 122.5, 28.5, 75.5, 122.5, 28.5, 75.5, 122.5]*机器坐标行
Qx:=[100,50,0,100,50,0,100,50,0]
*机器坐标列
Qy:=[0,0,0,50,50,50,100,100,100]*拿到机器坐标和像素坐标求出关系矩阵
* 标定行 标定列 机器X 机器Y 得到矩阵
vector_to_hom_mat2d (PxRow, PxColunm, Qx, Qy, HomMat2D)
*保存矩阵
write_tuple (HomMat2D, '九点标定.tup')
*读取矩阵
read_tuple ('九点标定.tup', HomMat2D)
*利用求出来的物体行列坐标得到机器坐标
affine_trans_point_2d (HomMat2D, PxRow, PxColunm, Qx1, Qy1)