*关闭程序计数器,图形变量,窗口图形更新
dev_update_off() * Image Acquisition 01: Code generated by Image Acquisition 01
ImageFiles := []
ImageFiles[0] := '1.bmp'
ImageFiles[1] := '2.bmp'
for Index := 0 to |ImageFiles| - 1 by 1*读取一张图像read_image (Image, ImageFiles[Index])*分割出环形区域threshold (Image, Region, 100, 255)*对区域进行连通处理connection (Region, ConnectedRegions)*过滤出圆环区域select_shape (ConnectedRegions, SelectedConnectedRegions, ['area','circularity'], 'and', [40000,0.6], [99999,1]) *将圆环区域中的图像剪切出来reduce_domain (Image, SelectedConnectedRegions, ImageReduced) *将图像和高斯导数进行卷积运算求轮廓derivate_gauss (ImageReduced, DerivGaussImage, 1.5, 'gradient') *分割出图像中的轮廓threshold (DerivGaussImage, DerivGaussRegion, 9, 50)*对轮廓区域进行连通处理connection (DerivGaussRegion, DerivGaussConnectedRegions) *获取的轮廓区域select_shape_std (DerivGaussConnectedRegions, SelectedDerivGaussConnectedRegions, 'max_area', 70) *填充该轮廓区域fill_up (SelectedDerivGaussConnectedRegions, RegionFillUp) *求轮廓区域和填充的轮廓区域之间的补集区域difference (RegionFillUp, SelectedDerivGaussConnectedRegions, RegionDifference) *对补集区域进行连通处理connection (RegionDifference, ResultConnectedRegions) *获取缺陷区域select_shape (ResultConnectedRegions, DefectResult, 'area', 'and', 50, 999) *显示图像dev_display (Image) *显示缺陷区域dev_display (DefectResult)stop()endfor