* Image Acquisition 01: Code generated by Image Acquisition 01
list_files ('D:/白色背景的脏污检测', ['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])
* Image Acquisition 01: Do something
binary_threshold (Image, Region, 'max_separability', 'light', UsedThreshold)
connection (Region, ConnectedRegions)
select_shape_std (ConnectedRegions, SelectedRegions, 'max_area', 70)
fill_up (SelectedRegions, RegionFillUp)
reduce_domain (Image, RegionFillUp, ImageReduced)
mean_image (ImageReduced, ImageMean1, 3, 3)
mean_image (ImageReduced, ImageMean2, 35, 35)
dyn_threshold (ImageMean1, ImageMean2, RegionDynThresh, 3, 'dark')
closing_circle (RegionDynThresh, RegionClosing, 3.5)
connection (RegionClosing, ConnectedRegions1)
select_shape (ConnectedRegions1, SelectedRegions1, ['area','circularity'], 'and', [150,0], [99999,0.8])
stop ()
endfor |