opening_circle and closing_circle
1.The burr is on the convex surface
1.Method
Segment the black part, and then remove the burr through the opening_circle, and then original image subtract the area after the open operation to obtain the burr area.
1 read_image (Img, 'C:/Users/LeiChen/OrgImg.jpg')
2 binary_threshold (Img, Region, 'max_separability', 'dark', UsedThreshold)
3 opening_circle (Region, RegionOpening, 50.5)
4 difference (Region, RegionOpening, RegionDifference)
5 dev_display (Img)
6 dev_display (RegionDifference)
note that: Four sharp corners are flattened!what is quite bad to my master thesis!
2.Method
Segment the white part, and then remove the burr through the closing_circle, and then the area after the open operation subtract original image to obtain the burr area.
1 read_image (Img, 'C:/Users/LeiChen/OrgImg.jpg')
2 binary_threshold (Img, Region, 'max_separability', 'light', UsedThreshold)
3 closing_circle (Region, RegionClosing, 50.5)
4 difference (RegionClosing, Region, RegionDifference)
5 dev_display (Img)
6 dev_display (RegionDifference)
good result!
Burrs on the concave surface
1.Method
Segment the black part, and then remove the burr through the opening_circle, and then the area after the open operation subtract original image to obtain the burr area.
1 read_image (Img, 'C:/Users/LeiChen/OrgImg.jpg')
2 binary_threshold (Img, Region, 'max_separability', 'dark', UsedThreshold)
3 opening_circle (Region, RegionOpening, 50.5)
4 difference (Region, RegionOpening, RegionDifference)
5 dev_display (Img)
6 dev_display (RegionDifference)
note that: Four sharp corners are flattened!what is quite bad to my master thesis!
2.Method
Segment the white part, and then remove the burr through the closing_circle, and then original image subtract the area after the close operation to obtain the burr area.
1 read_image (Img, 'C:/Users/LeiChen/OrgImg.jpg')
2 binary_threshold (Img, Region, 'max_separability', 'light', UsedThreshold)
3 closing_circle (Region, RegionClosing, 50.5)
4 difference (RegionClosing, Region, RegionDifference)
5 dev_display (Img)
6 dev_display (RegionDifference)
note that, I can replace the opening_circle by
set_system ('tsp_clip_region', 'false')
erosion_circle (Region, RegionErosion1, 50.5)
dilation_circle (RegionErosion1, RegionDilation, 50.5)
set_system ('tsp_clip_region', 'false')
means when the region beyond the original region, the region will not be cliped
there are some alternative:
1 *replacement of opening operation
2 set_system ('tsp_clip_region', 'false')
3 read_image (Img, 'C:/Users/LeiChen/Rect.jpg')
4 binary_threshold (Img, Region, 'max_separability', 'dark', UsedThreshold)
5 erosion_circle (Region, RegionErosion, 30.5)
6 dilation_circle (RegionErosion, RegionDilation, 30.5)
7 dev_display (Img)
8 dev_display (RegionDilation)
1 *replacement of closing operation
2 set_system ('tsp_clip_region', 'false')
3 read_image (Img, 'C:/Users/LeiChen/rect.jpg')
4 binary_threshold (Img, Region, 'max_separability', 'dark', UsedThreshold)
5 dilation_circle (Region, RegionDilation, 30.5)
6 erosion_circle (RegionDilation, RegionErosion, 30.5)
7 dev_display (Img)
8 dev_display (RegionErosion)
Summary
1.dilation smooth the sharp corners.( what is the biggest problem of segmentation in my project)
- for Convex polygon closing_circle is the best way to keep the shape
idea: shape_trans (Region, RegionTrans, 'convex') to convert the region to the convex polygon
3.in replacement of opening_circle, could I use larger parameter for erosion_circle and smaller parameter for dilation_circle?
because of the Confidentiality agreement i can only show the process
so my new approach:
1.use lower value in operator difference (RegionClosing, Region, ValueDifference), in order to get more details Info
2.do not use opening_circle, but use higher value in operator erosion_circle (Region, RegionErosion, ValueErosion)
and then lower value (even 0) in operator dilation_circle (RegionErosion, RegionDilation, ValueDilation), in order to keep the corners.
3.and most important thing! use shape_trans (Region, RegionTrans, 'convex') to keep the relatively straight boundary.