read_image(Image,'clip') *1.图像二值化 被选中的是1 没选中的是0 threshold (Image, Regions, 10, 84) *2.连通分割 connection (Regions, ConnectedRegions) count_obj (ConnectedRegions, Number) area_center (ConnectedRegions, Area, Row, Column) select_shape (ConnectedRegions, SelectedRegions, 'column', 'and', 79.82, 1000) count_obj (ConnectedRegions, Number) * 形态学变换 边缘有阴影可以进行腐蚀 *3.占用面积 fill_up (SelectedRegions, RegionFillUp) *3.1.腐蚀 erosion_rectangle1 (RegionFillUp, RegionErosion, 1, 1) *3.2.膨胀 dilation_rectangle1 (RegionErosion, RegionDilation, 1, 1) count_obj (ConnectedRegions, Number) *合并 union1 (RegionDilation, RegionUnion) union2 (RegionDilation, Regions, RegionUnion1) *减操作 difference (RegionUnion1, SelectedRegions, RegionDifference) *相交 intersection (RegionDifference, RegionErosion, RegionIntersection) *补集 complement (ConnectedRegions, RegionComplement) *区域转换 求最小外接椭圆 select_obj (SelectedRegions, ObjectSelected, 1) shape_trans (ObjectSelected, RegionTrans, 'ellipse')
本文来自博客园,作者:董锡振,转载请注明原文链接:https://www.cnblogs.com/dongxizhen/p/16948161.html