Matlab - Undefined Error for input arguments of type Double

I am trying to write a function that does what it does conv2(h1,h2,A)

and conv2(...'shape')

without using an inline function. (speed is not an issue at the moment). as defined here: http://www.mathworks.co.uk/help/matlab/ref/conv2.html

These are my commands:

    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 );

      

That's my fault:

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

      

If I run the same commands, but use a function 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 );

      

Does it work great? ... I've searched around and stared at this code for hours. I just don't see it. Does anyone notice what is wrong with my function?

+3


source to share


1 answer


Undefined function 'xxx' for input arguments of type 'double'

usually indicates that the function is xxx

not on the path.

To verify that this is indeed the problem, type which convfft

in the command line, as it which

should indicate where Matlab knows the file is located.



If the file is not found, make sure it exists on your computer and add the parent folder of the file to the Matlab path.

+6


source







All Articles