简介:
膨胀可以增大区域,填充内部孔和增强了离散点,但增大了面积。腐蚀可以缩小区域,减少间隔区域的连接和离散点的数量,但减小了面积。 开运算是先腐蚀后膨胀,有益于消除线和点区域,减少干扰。闭运算是先膨胀后腐蚀,有益于连接间隙和孔,使区域更加连贯。
介绍:
- 膨胀: dilation_rectangle1, dilation1, dilation2, dilation_circle, dilation_golay, dilation_seq.
- 腐蚀: erosion_rectangle1, erosion1, erosion2, erosion_circle, erosion_golay, erosion_seq.
- 开运算:opening_rectangle1, opening, opening_circle, opening_golay, opening_seq,gray_opening, gray_opening_rect, gray_opening_shape.
- 闭运算:closing_rectangle1, closing, closing_circle, closing_golay, gray_closing, gray_closing_rect, gtay_closing_shape.
Region (input_object) | Regions to be dilated. | 区域 |
RegionDilation (output_object) | Dilated regions. | 输出的膨胀区域 |
Width (input_control) | Width of the structuring rectangle. Default value: 11 Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201 Typical range of values: 1 ≤ Width ≤ 511 (lin) Minimum increment: 1 Recommended increment: 10 | 宽 |
Height (input_control) | Height of the structuring rectangle. Default value: 11 Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201 Typical range of values: 1 ≤ Height ≤ 511 (lin) Minimum increment: 1 Recommended increment: 10 | 高 |
Region (input_object) | Regions to be eroded. | 区域 |
RegionErosion (output_object) | Eroded regions. | 输出的腐蚀区域 |
Width (input_control) | Width of the structuring rectangle. Default value: 11 Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201 Typical range of values: 1 ≤ Width ≤ 511 (lin) Minimum increment: 1 Recommended increment: 1 | 宽 |
Height (input_control) | Height of the structuring rectangle. Default value: 11 Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201 Typical range of values: 1 ≤ Height ≤ 511 (lin) Minimum increment: 1 Recommended increment: 1 | 高 |
Region (input_object) | Regions to be opened. | 区域 |
RegionOpening (output_object) | Opened regions. | 输出的开运算区域 |
Width (input_control) | Width of the structuring rectangle. Default value: 10 Suggested values: 1, 2, 3, 4, 5, 7, 9, 12, 15, 19, 25, 33, 45, 60, 110, 150, 200 Typical range of values: 1 ≤ Width ≤ 511 (lin) Minimum increment: 1 Recommended increment: 1 | 宽 |
Height (input_control) | Height of the structuring rectangle. Default value: 10 Suggested values: 1, 2, 3, 4, 5, 7, 9, 12, 15, 19, 25, 33, 45, 60, 110, 150, 200 Typical range of values: 1 ≤ Height ≤ 511 (lin) Minimum increment: 1 Recommended increment: 1 | 高 |
Region (input_object) | Regions to be closed. | 区域 |
RegionClosing (output_object) | Closed regions. | 输出的闭运算区域 |
Width (input_control) | Width of the structuring rectangle. Default value: 10 Suggested values: 1, 2, 3, 4, 5, 7, 9, 12, 15, 19, 25, 33, 45, 60, 110, 150, 200 Typical range of values: 1 ≤ Width ≤ 511 (lin) Minimum increment: 1 Recommended increment: 1 | 宽 |
Height (input_control) | Height of the structuring rectangle. Default value: 10 Suggested values: 1, 2, 3, 4, 5, 7, 9, 12, 15, 19, 25, 33, 45, 60, 110, 150, 200 Typical range of values: 1 ≤ Height ≤ 511 (lin) Minimum increment: 1 Recommended increment: 1 | 高 |
使用:
- 通过动态阈值或全局阈值提取目标区域。
read_image (Image, 'E:/照片/RGB')
decompose3 (Image, Image1, Image2, Image3)
trans_from_rgb (Image1, Image2, Image3, ImageResult1, ImageResult2, ImageResult3, 'hsv')
auto_threshold (ImageResult3, Regions, 2)
connection (Regions, ConnectedRegions1)
select_shape (ConnectedRegions1, SelectedRegions, 'area', 'and', 200, 50000)
*threshold (ImageResult3, SelectedRegions, 128, 255)
*膨胀
dilation_rectangle1 (SelectedRegions, RegionDilation, 11, 11)
*腐蚀
erosion_rectangle1 (SelectedRegions, RegionErosion, 11, 11)
*开运算,先腐蚀后膨胀
opening_rectangle1 (SelectedRegions, RegionOpening, 11, 11)
*闭运算,先膨胀后腐蚀
closing_rectangle1 (SelectedRegions, RegionClosing, 11, 11)
![](https://img-blog.csdnimg.cn/20190722134732134.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NfZ3ls,size_16,color_FFFFFF,t_70)
![](https://img-blog.csdnimg.cn/20190722134406365.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NfZ3ls,size_16,color_FFFFFF,t_70)
![](https://img-blog.csdnimg.cn/20190722134424550.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NfZ3ls,size_16,color_FFFFFF,t_70)
![](https://img-blog.csdnimg.cn/20190722134445993.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NfZ3ls,size_16,color_FFFFFF,t_70)
![](https://img-blog.csdnimg.cn/20190722134510147.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NfZ3ls,size_16,color_FFFFFF,t_70)
![](https://img-blog.csdnimg.cn/20190722134526926.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NfZ3ls,size_16,color_FFFFFF,t_70)