具有零结构元素的Erose / Dilate图像 [英] Erose/Dilate image with zeros structuring element

查看:231
本文介绍了具有零结构元素的Erose / Dilate图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个结构元素看起来像这个(原点位于SE的中心):

If I have a structuring element looks like this one (the origin is at the center of SE):

0  0  0
0  0  0 
0  0  0

如果我执行侵蚀/在二进制图像上扩张,结果全部为0或1.
有人可以向我解释这个吗? (通过matlab检查)

非常感谢。

If I perform the erosion/dilation on an binary image, the result turns out all 0 or 1. Can someone please explain this one to me? (Check by matlab)
Thank you very much.

推荐答案

你有一个完全有效的SE。它是一个扁平的正方形,在每个图像处理库中都可以使用。

You have a perfectly valid SE. It is a flat square, commonly accepted and available in every image processing library.

现在,了解平面和非平面结构元素之间的差异和相似性非常重要(或结构化功能)。相似之处在于它们在某个邻域上运行。对于elementar square元素,邻域可以用3x3矩阵表示,其中每个元素都在元素的邻域中(例如,对于菱形SE,它也将是3x3矩阵,但角落不属于邻里)。在Matlab中,这个特定的邻域关系用那些(3,3)表示,或者只是 [1 1 1; 1 1 1; 1 1 1] 。平坦和非平坦SE之间的区别是使Matlab中的 strel 函数成为现实。非平坦的SE意味着它可以不同地对待邻居,因此它不仅仅依赖于值0(侵蚀和扩张的定义被略微修改以处理这种情况)。例如,方形SE在Matlab中正确定义为 strel('任意',一(3,3),零(3,3))(指定零(3,3)因为第二个参数基本上是一个错误,因为你说你没有邻居)。另一方面,非平面正方形可以无限方式定义,其中一个可以是 strel('任意',一个(3,3),[-1 -1 -1; - 1 0 -1; -1 -1 -1])

Now, it is important to understand the difference and similarity between flat and non-flat structuring elements (or structuring functions). The similarity is that they operate over a certain neighborhood. For an elementar square element, the neighborhood can be represented by a 3x3 matrix where every element is in the neighborhood of the element (for a rhombus SE, for example, it would be a 3x3 matrix too but the corners wouldn't belong to the neighborhood). In Matlab, this specific neighborhood relation is expressed by ones(3, 3) or simply [1 1 1; 1 1 1; 1 1 1]. The difference between flat and non-flat SE is what makes the strel function in Matlab be the way it is. A non-flat SE implies that it can treat neighbors differently, so it doesn't rely exclusively on the value 0 (the definitions of erosion and dilation are slightly modified to handle this situation). As an example, the square SE is correctly defined in Matlab as strel('arbitrary', ones(3, 3), zeros(3, 3)) (specifying zeros(3, 3) as the second parameter is basically an error, since you are saying you have no neighbors then). On the other hand, a non-flat square can be defined in infinite ways, one of them could be strel('arbitrary', ones(3, 3), [-1 -1 -1; -1 0 -1; -1 -1 -1]).

总结一下,你最有可能使用 strel 错误。

Summing up, you are most likely using strel incorrectly.

这篇关于具有零结构元素的Erose / Dilate图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆