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!