这种效果叫什么?如何使用 Matlab 实现它?

发布于 2024-12-12 10:35:25 字数 260 浏览 0 评论 0原文

我正在尝试从 MATLAB 中的基本形状生成以下“效果”:

http://i.imgur.com/DkLVp .png

但我什至不知道这个过程是如何调用的。假设我有一个包含棕色形状的图像,我想要的是生成它外部的轮廓,随着它们变大,轮廓会变得更平滑。

是否有此效果的名称、在 MATLAB 中执行此操作的函数或从头开始执行此操作的算法?

谢谢

I am trying to generate the following "effect" from a basic shape in MATLAB:

http://i.imgur.com/DkLVp.png

But I don't even know how this process is called. Let's say I have an image containing the brown shape, what I want is generate the contours outside of it, that get smoother as they get bigger.

Is there either a name for this effect, a function to do this in MATLAB or an algorithm that does it from scratch?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

舞袖。长 2024-12-19 10:35:25

我认为您正在寻找 bwdist

您显示的图像看起来像是距形状边界的距离函数的正部分。您可以使用 上述手册页。

I think you are looking for bwdist.

The image you are displaying looks like the positive part of a distance function from the boundary of your shape. You can perform this easily in Matlab using the examples on the aforementioned manual page.

时光倒影 2024-12-19 10:35:25

试试这个:

I = imread('brown_image.png');
I_bw = (rgb2gray(I) > 0);   % or whatever, just so I_bw is 1 in the 'brown' region
r = 10;
se1 = strel('disk', r);
se2 = strel('disk', r-1);
imshow(imdilate(I_bw, se1) - imdilate(I_bw, se2))

需要图像处理工具箱,但基本思想是使用相差 1 的膨胀元素(或者无论您希望轮廓有多粗)将图像膨胀两次,然后从较大的元素中减去较小的元素的结果。然后你可以为它们涂上你想要的颜色。

Try this:

I = imread('brown_image.png');
I_bw = (rgb2gray(I) > 0);   % or whatever, just so I_bw is 1 in the 'brown' region
r = 10;
se1 = strel('disk', r);
se2 = strel('disk', r-1);
imshow(imdilate(I_bw, se1) - imdilate(I_bw, se2))

Requires image processing toolbox, but the basic idea is to dilate the image twice with dilation elements that differ by 1 (or however thick you want the contours to be) and subtract the result of the smaller one from the bigger one. You could then color them however you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文