How to determine only the low frequency signals from the filter output?

1 view (last 30 days)
Thank you for the last answer.I want to zero down high frequency signals and retain low frequency signals so that I can reconstruct signal using IIFT.But how to do that?Please help me I am struck at this stage.

Answers (1)

Anitha Raj
Anitha Raj on 7 Oct 2014
%This code is used to Butterworth lowpass filter close all; clear all; clc; I=imread('Sunflower.bmp'); R = I(:,:,1); G = I(:,:,2); B = I(:,:,3);
fc=50;%Cutoff frequency n=0.9; [co,ro,so] = size(I); cx = round(co/2); % find the center of the image cy = round (ro/2); cz = round(so/2); imf1=fftshift(fft2®); imf2=fftshift(fft2(G)); imf3=fftshift(fft2(B)); H=zeros(co,ro); for i = 1 : co for j =1 : ro d = (i-cx).^2 + (j-cy).^ 2 ; H(i,j) = 1/(1+((d/fc/fc).^(2*n))); end; end; H1=double(H<=fc); outf1 = imf1.*H1; % Fs=100; %sampling frequency % T=1; %signal length % N=T*Fs; %number of samples % f=-Fs/2:Fs/N:Fs/2-Fs/N; %frequency vector % plot(f,abs(outf1)) % outf1(n/2+1-20:n/2+20) = zeros(40,1) % Maxium1=max(max(max(abs(outf1)))); % Minium1=min(min(min(abs(outf1)))); % Th1=0.01*Maxium1;
%to set below threshold values to zero % outf1=outf1.*(outf1>Th1);
% To filter zeros from matrix
pos1=find(outf1<=2000);
pos1(pos1==0)=[];% To remove zeros
outf2 = imf2 .* H1; pos2=find(outf2<=2000); pos2(pos2==0)=[] outf3 = imf3 .* H1; pos3=find(outf3<=2000); pos3(pos3==0)=[] Nz=length(pos1+pos2+pos3); CR=(m*n*3)/size(Nz);% compression in transform domain defined as ratio of image size to number %of non zero fft co efficients out1 = abs(ifft2(outf1)); out2 = abs(ifft2(outf2)); out3 = abs(ifft2(outf3)); out=cat(3,out1,out2,out3); imshow(I),title('Original Image'),figure,imshow(uint8(out)),title('Lowpass Filterd Image');
This is my code.Input is color image and fft is found , then passed through lpf.The output of lpf contains both low frequency & high frequency contents so I am zerdowning high frequency to perform compression.Please see where Iam going wrong?

Tags

Community Treasure Hunt

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

Start Hunting!