【问题标题】:How does Matlab produce thin edges?Matlab如何产生薄边?
【发布时间】:2014-10-14 12:37:21
【问题描述】:

我正在使用 sobel 边缘检测。

Here is the sample image file if you have Matlab

Matlab 本身如何实现像这样的非常薄的边缘(仅使用 Matlab 的边缘函数,以 'sobel' 作为参数)

matlabsobel = edge(originalImage,'sobel')
imshow(matlabsobel)

但是当我尝试以自己的方式进行 sobel 算法时,假设过程是一样的..

originalImage = gaussianizedimage;
threshold = 60.5;
k = [1 2 1; 0 0 0; -1 -2 -1];
H = conv2(double(originalImage),k, 'same');
V = conv2(double(originalImage),k','same');
E = sqrt(H.*H + V.*V);
edgeImage = uint8((E > threshold) * 255);
imshow(edgeImage);
title('sobel algorithm')

为什么不一样?我的实现中还缺少什么来实现 Matlab 的薄边?

谢谢

【问题讨论】:

  • 出于好奇,当您使用“nothinning”选项时,您会从 Matlab 的算法中得到什么?
  • @Benoit_11 默认情况下,如果我们执行 matlabsobel = edge(originalImage,'sobel'), 总是显示细边...没有边缘函数的选项
  • 他们可能使用非最大抑制以及其他各种东西。 sobel 可能是估计局部梯度的第一步。如果您确实在命令提示符下执行edit edge,您可能能够看到他们在幕后所做的事情。我这里没有 MATLAB,所以无法为您验证。
  • 是的,这就是我的观点;如果你告诉 Matlab 不要细化边缘,我想知道图像是否看起来像你的

标签: matlab sobel


【解决方案1】:

感谢 rayryeng​​p>

Sobel是第一步,为了得到细边,需要进行skelotinization

>> BW3 = bwmorph(bww,'skel',Inf);
>> figure()
>> imshow(BW3)

生成的图像如下

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-29
    • 1970-01-01
    • 2020-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-02
    相关资源
    最近更新 更多