??? Undefined function or method 'fftshow' for input arguments of type 'double'.

39 visualizaciones (últimos 30 días)
Tricky
Tricky el 22 de Mayo de 2012
Comentada: nethala bhanu el 25 de Nov. de 2021
Error ??? Undefined function or method 'fftshow' for input arguments of type 'double'.
when trying to display the image
c=imread('cameraman.tif');
cf=fftshift(fft2(c));
fftshow(cf,'abs')
or fftshow(cf,'log');
both are showing the same error how to overcome this

Respuestas (6)

Wayne King
Wayne King el 22 de Mayo de 2012
What is fftshow.m ? That is not a MathWorks' function or method. If you have downloaded this MATLAB program from somewhere and saved it in a folder, then make sure you add that folder to the MATLAB search path with addpath or use pathtool.

Walter Roberson
Walter Roberson el 14 de Jun. de 2012
  3 comentarios
Steven Lord
Steven Lord el 23 de Nov. de 2021
The code to call ifft is just ifft(). You need to fill in the input arguments to ifft inside those parentheses.
If you're asking to see the source code that implements ifft we do not distribute the source code for it. If you really want to see it start here.
nethala bhanu
nethala bhanu el 25 de Nov. de 2021
is there any code for ifftshow .like fft show

Iniciar sesión para comentar.


Kumar Vaibhav
Kumar Vaibhav el 11 de Ag. de 2016
The error is due to fftshow function, which is not inbuilt function of MATLAB. You can find fftshow function in the link given below:
  2 comentarios
Reham bun
Reham bun el 19 de Feb. de 2021
How can i inbuilt ifftshow? the fftshiw cannot be inverted why?
nethala bhanu
nethala bhanu el 23 de Nov. de 2021
rehm bun did you get the code for iftt

Iniciar sesión para comentar.


yanqi liu
yanqi liu el 20 de Feb. de 2021
sir, may be use the follow code
clc; clear all; close all;
c=imread('cameraman.tif');
cf=fftshift(fft2(c));
figure;
fftshow(cf,'abs')
figure;
fftshow(cf,'log');
function fftshow(f,type)
% from:https://ww2.mathworks.cn/matlabcentral/fileexchange/30947-gaussian-bandpass-filter-for-image-processing
% Usage: FFTSHOW(F,TYPE)
%
% Displays the fft matrix F using imshow, where TYPE must be one of
% 'abs' or 'log'. If TYPE='abs', then then abs(f) is displayed; if
% TYPE='log' then log(1+abs(f)) is displayed. If TYPE is omitted, then
% 'log' is chosen as a default.
%
% Example:
% c=imread('cameraman.tif');
% cf=fftshift(fft2(c));
% fftshow(cf,'abs')
%
if nargin<2,
type='log';
end
if (type=='log')
fl = log(1+abs(f));
fm = max(fl(:));
imshow(im2uint8(fl/fm))
elseif (type=='abs')
fa=abs(f);
fm=max(fa(:));
imshow(fa/fm)
else
error('TYPE must be abs or log.');
end
end
  2 comentarios
Reham bun
Reham bun el 20 de Feb. de 2021
Editada: Reham bun el 20 de Feb. de 2021
Sorry, i want to implement Gaussian low pass filter for this image, I used this code (ifftshow) for the inverted fftshow but it didn't work with me because the file is not found.
Here's my code
a=imread('Fig0441(a).tif')
whos a
g=fspecial('gaussian',688,10);
max(g(:));
g1=mat2gray(g);
max(g1(:));
f=fftshift(fft2(a));
i=f.*g1;
fftshow(i)
f1=ifft2(i);

Iniciar sesión para comentar.


yanqi liu
yanqi liu el 20 de Feb. de 2021
sir, please copy to one m file, like follows
clc; clear all; close all;
a=imread('Fig0441(a).tif');
% whos a
g=fspecial('gaussian',688,10);
if ndims(a) > 2
a = rgb2gray(a);
end
if ~isequal(size(a), size(g))
a = imresize(a, size(g), 'bilinear');
end
max(g(:));
g1=mat2gray(g);
max(g1(:));
f=fftshift(fft2(a));
i=f.*g1;
fftshow(i)
f1=ifft2(i);
figure; imshow(f1, []);
function fftshow(f,type)
% from:https://ww2.mathworks.cn/matlabcentral/fileexchange/30947-gaussian-bandpass-filter-for-image-processing
% Usage: FFTSHOW(F,TYPE)
%
% Displays the fft matrix F using imshow, where TYPE must be one of
% 'abs' or 'log'. If TYPE='abs', then then abs(f) is displayed; if
% TYPE='log' then log(1+abs(f)) is displayed. If TYPE is omitted, then
% 'log' is chosen as a default.
%
% Example:
% c=imread('cameraman.tif');
% cf=fftshift(fft2(c));
% fftshow(cf,'abs')
%
if nargin<2,
type='log';
end
if (type=='log')
fl = log(1+abs(f));
fm = max(fl(:));
imshow(im2uint8(fl/fm))
elseif (type=='abs')
fa=abs(f);
fm=max(fa(:));
imshow(fa/fm)
else
error('TYPE must be abs or log.');
end
end

Raghunathan P
Raghunathan P el 7 de Abr. de 2021
It is another library instead you can use this code:
c=imread('cameraman.tif');
cf=fftshift(fft2(c));
fl = log(1+abs(cf)); % Your DFT matrix of image 'cf' wil come HERE
fm = max(fl(:));
imshow(im2uint8(fl/fm))
or for advanced
function fftshow(f,type)
% Usage: FFTSHOW(F,TYPE)
%
% Displays the fft matrix F using imshow, where TYPE must be one of
% 'abs' or 'log'. If TYPE='abs', then then abs(f) is displayed; if
% TYPE='log' then log(1+abs(f)) is displayed. If TYPE is omitted, then
% 'log' is chosen as a default.
%
% Example:
% c=imread('cameraman.tif');
% cf=fftshift(fft2(c));
% fftshow(cf,'abs')
if nargin<2,
type='log';
end
if (type=='log')
fl = log(1+abs(f)); % Your matrix 'cf' wil come HERE instead of 'f'
fm = max(fl(:));
imshow(im2uint8(fl/fm))
elseif (type=='abs')
fa=abs(f);
fm=max(fa(:));
imshow(fa/fm)
else
error('TYPE must be abs or log.');
end;

Categorías

Más información sobre Time-Frequency Analysis en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by