原图像:
需求:
检测出图中所有的小划痕缺陷区域,定位标识出。
处理代码:
dev_update_off()
dev_close_window ()
dev_open_window (0, 0, 700, 512, 'black', WindowHandle)
dev_set_draw ('fill')
dev_set_line_width (3)
dev_set_draw ('margin')
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
list_files ('', ['files','follow_links'], ImageFiles)
tuple_regexp_select (ImageFiles, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$','ignore_case'], ImageFiles)
for Index := 0 to |ImageFiles| - 1 by 1
read_image (Image, ImageFiles[Index])
get_image_size(Image, Width, Height)
dev_set_part (0, 0, Height-1, Width-1)
threshold (Image, Regions, 150, 255)
fill_up (Regions, RegionFillUp