필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
Tricky
Tricky 2012년 5월 22일
댓글: nethala bhanu 2021년 11월 25일
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

답변 (6개)

Wayne King
Wayne King 2012년 5월 22일
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 2012년 6월 14일
  댓글 수: 3
Steven Lord
Steven Lord 2021년 11월 23일
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 2021년 11월 25일
is there any code for ifftshow .like fft show

댓글을 달려면 로그인하십시오.


Kumar Vaibhav
Kumar Vaibhav 2016년 8월 11일
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
Reham bun
Reham bun 2021년 2월 19일
How can i inbuilt ifftshow? the fftshiw cannot be inverted why?
nethala bhanu
nethala bhanu 2021년 11월 23일
rehm bun did you get the code for iftt

댓글을 달려면 로그인하십시오.


yanqi liu
yanqi liu 2021년 2월 20일
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
Reham bun
Reham bun 2021년 2월 20일
편집: Reham bun 2021년 2월 20일
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);

댓글을 달려면 로그인하십시오.


yanqi liu
yanqi liu 2021년 2월 20일
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 2021년 4월 7일
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;

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by