【问题标题】:Matlab's Canny edge function not workingMatlab Canny边缘功能不起作用
【发布时间】:2014-10-24 09:19:19
【问题描述】:

当我尝试运行时

   BW = edge(im,'canny') 

im 是我的图像 (256X256 uint8)。

这是我得到的错误:

 Error using gradient (line 3)
 Not enough input arguments.

 Error in edge>smoothGradient (line 709)
 derivGaussKernel = gradient(gaussKernel);

 Error in edge (line 213)
 [dx, dy] = smoothGradient(a, sigma);

 Error in ps_1_1 (line 2)
 BW = edge(im,'canny')

【问题讨论】:

  • 这是什么版本的 MATLAB?在 2010 年,这很好用: im = imread('some_image.jpg'); im_gray = rgb2gray(im); edegs = edge(im_gray, 'canny'); imshow(边);
  • 其他边缘检测算法有用吗?
  • @Anthony im_gray 对我来说不起作用,因为我的图像是 256X256 图像。
  • 我用的是R2012a版的Matlab(学生版)
  • @lars 图像的大小无关紧要。您可以像我一样在 32x32 的小缩略图或具有数百万像素的 5MB 原始图像上使用它。但是,该函数是 rgb2gray。如果您使用 imread 加载图像,您应该可以使用 rgb2gray。

标签: matlab image-processing edge-detection canny-operator


【解决方案1】:

由于该函数在我测试时对我来说很好,我认为您可能将图像传递给不是灰度的函数(意味着每个像素都有一个灰度值),如果不是这种情况,请尝试重新安装库,因为正如 cmets 中提到的那样,该函数工作正常。但无论如何请务必仔细阅读edge document

【讨论】:

猜你喜欢
  • 2012-04-16
  • 1970-01-01
  • 1970-01-01
  • 2020-09-02
  • 2012-12-31
  • 1970-01-01
  • 1970-01-01
  • 2017-04-22
  • 1970-01-01
相关资源
最近更新 更多