1.文章主要代码:
dev_close_window ()
dev_open_window (0, 0, 670, 506, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_set_line_width (2)
*读图检测
read_image (Image, '1.bmp')
*获取图像尺寸
get_image_size (Image, Width, Height)
*灰度处理
rgb1_to_gray (Image, GrayImage)
*初步定位ROI
gen_rectangle2 (Rectangle, 1150, 1289, 0, 70, 440)
*抠图
reduce_domain (GrayImage, Rectangle, ImageReduced)
*图像锐化
emphasize (ImageReduced, ImageEmphasize, 50, 50, 1)
*高斯边缘检测
lines_gauss (ImageEmphasize, Lines, 1.5, 3, 8, 'dark', 'true', 'bar-shaped', 'true')
*合并临近的轮廓片段
union_adjacent_contours_xld (Lines, UnionContours, 15, 1, 'attr_keep')
*筛选最终的裂缝轮廓
select_shape_xld (UnionC