- dev_update_off ()
- dev_clear_window ()
- for Index := 1 to 2 by 1
- read_image (Image, 'C:/Users/TIAN/Desktop/bb053aa1b6baf861c111a40a47a3c8ba.jpeg')
- get_image_size (Image, Width, Height)
- dev_open_window (0, 0, Width , Height, 'blue', WindowHandle)
- set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
- dev_display (Image)
- threshold (Image, Regions, 147, 255)
- connection (Regions, ConnectedRegions)
- select_shape (ConnectedRegions, CircularRegions, \
- ['area', 'circularity'], 'or', \
- [20000, 0.6], [9999999, 1.0])
- reduce_domain (Image, CircularRegions, ImageReduced)
- derivate_gauss (ImageReduced, DerivGauss, 1.5, 'gradient')
- threshold (DerivGauss, GaussRegion, 9, 50)
- connection (GaussRegion, ConnectedGaussRegions)
- select_shape_std (ConnectedGaussRegions, EdgeSelectedStd, 'max_area', 70)
- fill_up (EdgeSelectedStd, RegionFillUp)
- difference (RegionFillUp, EdgeSelectedStd, RegionFillUp)
- connection (RegionFillUp, DiffRegions)
- select_shape (DiffRegions, DefectRegions, 'area', 'and', 50, 2000)
- dev_display (Image)
- * dev_set_draw ('margin')
- dev_display (DefectRegions)
- if (Index < 2)
- disp_continue_message (WindowHandle, 'black', 'true')
- stop ()
- endif
复制代码
|