* 关闭窗口
dev_close_window ()*关闭程序计数器,图形变量更新,窗口图形更新
dev_update_off ()*设置图像路径
Path := 'lcd/mura_defects_blur_'*读取一张图像
read_image (Image, Path + '01')*获取图像大小
get_image_size (Image, Width, Height)*创建一个新窗体
dev_open_window_fit_size (0, 0, Width, Height, 640, 480, WindowHandle)*设置字体信息:字体大小为16,字体为mono,粗体,斜体
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')*设置区域的填充方式
dev_set_draw ('margin')*设置线宽度
dev_set_line_width (3)*设置输出对象的显示颜色
dev_set_color ('red')ScaleFactor := 0.4
*获取lines_gauss算子Sigma, Low, High三个参数值
calculate_lines_gauss_parameters (17, [25,3], Sigma, Low, High)
for f := 1 to 3 by 1*读取一张图像read_image (Image, Path + f$'.2i')*获取彩色图像的R,G,B三分量decompose3 (Image, R, G, B)* *将图像转化为频域图像rft_generic (B, ImageFFT, 'to_freq', 'none', 'complex', Width)*生成一个高斯滤波核gen_gauss_filter (ImageGauss, 100, 100, 0, 'n', 'rft', Width, Height)*将频域图像核高斯滤波核进行卷积运算convol_fft (ImageFFT, ImageGauss, ImageConvol)*将卷积后的图像转换为时域图像rft_generic (ImageConvol, ImageFFT1, 'from_freq', 'none', 'byte', Width)*用缺陷图像减去背景图像(时域图像)sub_image (B, ImageFFT1, ImageSub, 2, 100)* 对上述图像进行数码变焦zoom_image_factor (ImageSub, ImageZoomed, ScaleFactor, ScaleFactor, 'constant')*获取变焦后的图像的ROIget_domain (ImageZoomed, Domain)*图像ROI进行腐蚀操作erosion_rectangle1 (Domain, RegionErosion, 7, 7)*获取变焦图像中ROI区域内的图像reduce_domain (ImageZoomed, RegionErosion, ImageReduced)*探测线和获取线宽度lines_gauss (ImageReduced, Lines, Sigma, Low, High, 'dark', 'true', 'gaussian', 'true')*生成一个2D的齐次变换矩阵hom_mat2d_identity (HomMat2DIdentity)*添加一个缩放因子到齐次变换矩阵hom_mat2d_scale_local (HomMat2DIdentity, 1 / ScaleFactor, 1 / ScaleFactor, HomMat2DScale)*仿射变换affine_trans_contour_xld (Lines, Defects, HomMat2DScale)* 显示图像dev_display (Image)* 显示线缺陷dev_display (Defects)stop ()endfor