Matlab - 输入参数类型为Double的未定义错误

问题描述:

我试图编写一个函数,它可以在不使用内置函数的情况下执行什么操作conv2(h1,h2,A) & conv2(...'shape')。 (速度目前不是问题)。这里定义:http://www.mathworks.co.uk/help/matlab/ref/conv2.htmlMatlab - 输入参数类型为Double的未定义错误

这是我的命令:

imgC = imread('camerman.tif'); 
    imgC = double(imgC); 

    sigma = 1; 
    inp = (-1 .*2.5 .*sigma):1:(2.5 .* sigma);         
    gauss1d = (1/(sigma .* sqrt(2*pi))).*exp(-(inp.^2/(2.*sigma.*sigma)));  
    gaussprime = diff(gauss1d);  

    x = conv2fft(gaussprime,1,imgC , 'same'); 
    y = conv2fft(1,gaussprime.',imgC , 'same'); 
    blur = conv2fft (gauss1d, gauss1d, imgC); 

这是我的错误:

Undefined function 'convfft' for input arguments of type 'double'. 
    Error in conv2fft (line 81) `if size(convfft(a(1,:),r),1)==1` 

如果我运行相同的命令,但使用conv2功能:

imgC = imread('camerman.tif'); 
    imgC = double(imgC); 

    sigma = 1; 
    inp = (-1 .*2.5 .*sigma):1:(2.5 .* sigma);         
    gauss1d = (1/(sigma .* sqrt(2*pi))).*exp(-(inp.^2/(2.*sigma.*sigma)));  
    gaussprime = diff(gauss1d);  

    x = conv2(gaussprime,1,imgC , 'same'); 
    y = conv2(1,gaussprime.',imgC , 'same'); 
    blur = conv2(gauss1d, gauss1d, imgC); 

它工作正常吗?...我一直在四处寻找,盯着t他的代码数小时。我只是看不到它。任何人都注意到我的功能有什么问题?

Undefined function 'xxx' for input arguments of type 'double'通常表示功能xxx不在路径上。

要确认这确实是问题,请在命令行键入which convfft,因为which应指示Matlab知道文件所在的位置。

如果没有找到该文件,请确保它存在于您的计算机上,并将该文件的父文件夹添加到Matlab路径中。

+0

你当然知道你的Matlab。我只是做了这个,它返回没有找到''确认'。'... – Reanimation 2013-02-14 12:41:30

+0

我相信它已经知道路径,因为它发现被调用的函数并将图像转换为灰度并将其保存(它实现)。它只在犯罪时出错。我已经将convfft更改为conv2fft(函数名称错字),现在错误是'下标分配维度不匹配。 错误cannyWorkingOn> conv2fft(行295) y3(:,ii)= conv2fft(y2(:,ii),c);' – Reanimation 2013-02-14 13:00:33

+2

@Reanimation:Matlab知道'conv2fft',但不知道'convfft'。使用您的文件系统来搜索文件。如果找不到,它应该在文件交换中可用。 – Jonas 2013-02-14 13:19:56