How do I apply my filter to my image? (first matlab project)
5 ビュー (過去 30 日間)
古いコメントを表示
First matlab project I've had so I'm not used to the system... ok so basically I'm trying to enhance an image I've done
>> Transformed = fft2(Image);
>> Shifted = fftshift(Transformed);
>> imshow(log(abs(Shifted)),[]);
Now I've used the fda tool to create a filter and I have saved this file
>> function Hd = filter1
%FILTER1 Returns a discrete-time filter object.
%
% MATLAB Code
% Generated by MATLAB(R) 7.12 and the Signal Processing Toolbox 6.15.
%
% Generated on: 11-Nov-2011 14:23:58
%
% Equiripple Lowpass filter designed using the FIRPM function.
% All frequency values are normalized to 1.
N = 30; % Order
Fpass = 0.2; % Passband Frequency
Fstop = 0.8; % Stopband Frequency
Wpass = 1; % Passband Weight
Wstop = 1; % Stopband Weight
dens = 20; % Density Factor
% Calculate the coefficients using the FIRPM function.
b = firpm(N, [0 Fpass Fstop 1], [1 1 0 0], [Wpass Wstop], {dens});
Hd = dfilt.dffir(b);
% [EOF]
how do I apply this filter onto my image "Shifted" with mathlab syntax?
Thank you.
0 件のコメント
回答 (2 件)
Daniel Shub
2011 年 11 月 11 日
I would start by reading the documentation for dfilt
doc dfilt
From there you will see:
y = filter(Hd,x)
which in your case is really
Hd = filter1;
Filtered = filter(Hd, Image);
0 件のコメント
Wayne King
2011 年 11 月 11 日
Since you're filtering an image, I would create a 2-D separable filter and use filter2. filter() will just apply a 1-D filter to the columns of your image. I think you want to filter both the columns and rows.
b = firpm(N, [0 Fpass Fstop 1], [1 1 0 0], [Wpass Wstop], {dens});
b = b'*b;
outimage = filter2(b,imagedata);
Do you have the Image Processing Toolbox, if so, see the help for imfilter.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Digital Filter Design についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!