high pass filter
古いコメントを表示
hi,
i want to apply a high pass filter to image in frequency domain. Here is the code:-
I= imread('cameraman.jpg');
FA = fftshift(fft2(I));
w=0.5; % cutoff frequency
N=2; %filter order
highPassFilter=butter(N,w,'high');
OM=highPassFilter(512,512).*abs(FA); % applying high-pass filter
-------------------------------------------------------------
I'm getting this error:
??? Attempted to access b(512,512); index out of bounds because size(b)=[1,3].
Error in ==> all at 32
OM=b(512,512).*abs(FA);
採用された回答
その他の回答 (1 件)
lama riad
2012 年 2 月 10 日
0 投票
2 件のコメント
Walter Roberson
2012 年 2 月 11 日
I am certain that this is wrong. butter() is pretty much useless unless you have multiple outputs. The number of outputs to butter() determines the filter representation that will be output. None of the representations can be expressed through a single vector.
ftrans2() is for FIR filters, but butter() is an IIR filter.
You are assuming that ftrans2() is returning something that can be simply resized to provide a 2D filter. That isn't how filters work. _If_ you were working with an FIR filter then you would take the output of ftrans2() and use it with filter2() against the image. However, you are not working with an FIR filter, and in the time I spent looking I have not found the equivalent of a 2D filter for IIR filters.
lama riad
2012 年 2 月 11 日
カテゴリ
ヘルプ センター および File Exchange で Floating-Point to Fixed-Point Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!