opening_circle and closing_circle
1.The burr is on the convex surface
![](https://img.haomeiwen.com/i11067097/593c911adab367f5.jpg)
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.
![](https://img.haomeiwen.com/i11067097/04ae398140360e58.jpg)
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
![](https://img.haomeiwen.com/i11067097/6a9c04c6a8c07f36.jpg)
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
![](https://img.haomeiwen.com/i11067097/013276c33068e85f.jpg)
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.
![](https://img.haomeiwen.com/i11067097/e564af34d7f8f21a.jpg)
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.
![](https://img.haomeiwen.com/i11067097/9f3e2618e6922111.jpg)
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)
![](https://img.haomeiwen.com/i11067097/22000e7e8577f946.jpg)
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)
![](https://img.haomeiwen.com/i11067097/756a2c0e496b0c0c.jpg)
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.
![](https://img.haomeiwen.com/i11067097/c090d23746ae6cf4.png)
![](https://img.haomeiwen.com/i11067097/6cba49fc5e48d5fd.png)
网友评论