检测解决策略之一blob分析+特征分析-dyn动态阈值分割(划伤,dot查找)
* 读取图像
read_image (Image, 'surface_scratch')
* 均值滤波
mean_image (Image, ImageMean, 7, 7)
* 动态阈值分割
dyn_threshold (Image, ImageMean, DarkPixels, 5, 'dark')
* 连通
connection (DarkPixels, ConnectedRegions)
* 去杂志
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 10, 1000)
* 合并
union1 (SelectedRegions, RegionUnion)
* 膨胀(更好的提取骨干)
dilation_circle (RegionUnion, RegionDilation, 3.5)
* 获取骨干(重要技巧)
skeleton (RegionDilation, Skeleton)
* 连通
connection (Skeleton, Errors)
* 通过面积选取划伤
select_shape (Errors, Scratches, 'area', 'and', 50, 10000)
* 通过面积选取点状缺陷
select_shape (Errors, Dots, 'area', 'and', 1, 50)
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/8d390a28810d4fefb38925345d27dc4d.png)