2018-03-13-Best Segmentation in Halcon

opening_circle and closing_circle


1.The burr is on the convex surface

original image

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.

opening_circle
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

closing_circle

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

Original image

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.

opening_circle

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.

closing_circle

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)
process of opening
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)
process of closing

Summary
1.dilation smooth the sharp corners.( what is the biggest problem of segmentation in my project)

  1. 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.


bad segmentation
new segmentation
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,458评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,980评论 0 23
  • 3月9日周四【丁酉年二月十二】 落雨。 1,早上7点20才醒来,赶紧洗漱,8点8分才出门。迟到是肯定的了。 2,中...
    毕钵罗子阅读 342评论 0 0
  • 是否已经形成了晚睡的习惯,今天早早的躺在床上竟然了无睡意,心中很慌乱不知道该如何是好。 说实话我想要的真的不多只是...
    梓晰沐染阅读 185评论 2 1
  • 禅意 一切皆禅也,一切皆佛法也,贪淫致老,瞋恚致病,愚痴致死,除三得道。《法句经》释义:贪婪淫乱使人衰老,愤怒使人...
    xcy无名阅读 413评论 0 0