1.二值化图像实现方法
difference (EmptyImage, Regions, OutRegions)
paint_region (OutRegions, EmptyImage, ImageResult, 0, 'fill')
paint_region (Regions, ImageResult, ImageResult, 255, 'fill')
2.设置旋转点方法
vector_angle_to_rigid (height/2, width/2, 0, height/2, width/2, 0, HomMat2DIdentity)
draw_rectangle2 (3600, Row1, Column1, Phi, Length1, Length2)
find_line_Tool (Image, ImageResult, Row1, Column1, Phi, Length1, Length2, 5, 30, 50, 'drop', RowBegin1, ColBegin1, RowEnd1, ColEnd1)
angle:=atan((RowBegin1-RowEnd1)/(ColBegin1-ColEnd1))
hom_mat2d_rotate (HomMat2DIdentity, angle, height/2, width/2, HomMat2DRotate)
affine_trans_image (Image, ImageAffinTrans, HomMat2DRotate, 'constant', 'false')
3.移动Region
move_region (Regions, RegionMoved, -40, -170)
4.模板定位find_aniso_shape_models(Image : : ModelIDs,AngleStart,AngleExtent,ScaleRMin,ScaleRMax,ScaleCMin,ScaleCMax,MinScore,NumMatches,MaxOverlap,SubPixel,NumLevels,Greediness :Row,Column,Angle,ScaleR,ScaleC,Score,Model)
5.参考位置转换
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_scale (HomMat2DIdentity, ScaleR[Match], ScaleC[Match], 0, 0, HomMat2DScale)
hom_mat2d_rotate (HomMat2DScale, Angle[Match], 0, 0, HomMat2DRotate)
hom_mat2d_translate (HomMat2DRotate, Row[Match], Column[Match], HomMat2DTranslate)
affine_trans_contour_xld (ModelContours, ContoursAffinTrans, HomMat2DTranslate)
6.Contour至Region转换gen_region_contour_xld (ContoursAffinTrans, ContourRegion, 'filled')
7.将独立的特征连接为一个整体union1 (ContourRegion, RegionUnion)
8.连接目标(连接后还是独立的)concat_obj (contour, RegionUnion, contour)
9.分解目标select_obj (contour, ObjectSelectedB, j)
10.计算两个Region的交集intersection (ObjectSelectedA, ObjectSelectedB, RegionIntersection)
11.检查数组与数值或数组相等的位置tuple_not_equal_elem (NumberShow, ObjNumberi-1, Equal)
12.自定义标定板文件,生成图像,可打印
gen_caltab (7, 7, 0.0125, 0.5, 'E:/业务/项目/昆山马培德/剪刀引导/项目程序/calibrat10mm.descr', 'E:/calibrat10mm.ps')
CameraParameters := [0.008,-6.60159,8.2856e-006,8.3e-006,1557.94,557.799,2456,2058]
CameraPose := [-0.00759192,0.00945659,0.018806,359.913,0.0236049,359.641,0]
dev_open_window (0, 0, 2456, 2058, 'white', WindowHandle)
sim_caltab (SimImage, 'caltab_30mm.descr', CameraParameters, CameraPose, 255, 255, 0, 1)
write_image (SimImage, 'tiff', 0, 'C:/Users/Administrator/Desktop/10mm.tif')