很简答的需求
- read_image (Image0, 'D:/个人/5/裂纹20260123.png')
- rgb1_to_gray (Image0, Image0)
- mean_image (Image0, Image, 3, 3)
- scale_image_max (Image, Image)
- *提取有效区域
- threshold (Image, RegionB, 0, 87)
- connection (RegionB, RegionB)
- select_shape_std (RegionB, RegionB, 'max_area', 70)
- erosion_circle (RegionB, RegionB, 10)
- *提取缺陷区域
- local_threshold (Image, Region, 'adapted_std_deviation', 'dark', ['mask_size','scale','range'], [15,0.1,128])
- connection (Region, Region)
- select_shape (Region, RegionS, 'area', 'and', 5, 9999999)
- *//把你画的红框去掉
- union1 (RegionS, RegionS)
- closing_circle (RegionS, RegionS, 3.5)
- connection (RegionS, RegionS)
- select_shape (RegionS, RegionS, 'width', 'and', 0, 40)
- intersection (RegionB, RegionS, RegionS)
- dev_clear_window ()
- dev_display (Image)
- dev_set_draw ('margin')
- dev_set_color ('green')
- dev_display (RegionB)
- dev_set_color ('red')
- dev_display (RegionS)
复制代码
|