*外焊缝检测
*读取图片
*遍历文件夹
list_files ('D:/D程序/外焊缝方案/不锈钢方 -外/30000', 'files', Files)
*文件格式筛选
tuple_regexp_select (Files, '.*', ImageFiles)
*依次读取图片
for I := 0 to |ImageFiles|-1 by 1
read_image (Image, ImageFiles[I])
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window_fit_image (Image, 0, 0, 640, 640, WindowHandle)//打开一个窗口
decompose3 (Image, ImageR, ImageG, ImageB)
rgb1_to_gray (Image, GrayImage)//转化为灰度图像
sobel_amp (GrayImage, EdgeAmplitude, 'sum_abs', 3)//求梯度图像
trans_from_rgb ( ImageR, ImageG, ImageB, ImageResult1, ImageResult2, ImageResult3, 'hsv')
scale_image (GrayImage, ImageScaled1, 1, 0)
stop ()
*手动画记号笔位置
gen_rectangle2 (ROI_0, 526.5, 284.5, rad(0.962864), 238.034, 118.017+10)
reduce_domain (ImageScaled1, ROI_0, ImageReduced)
*显示焊缝所在区域
dev_set_draw ('margin')/