Minggu, 18 Mei 2008

Portofolio 4

Portofolio 4:



myPhoto.jpg






portofolio4 = porto4('myPhoto.jpg')


Highboost filter membuat image menjadi blur:









high order highpass filter membuat efek seperti riak air pada image:







low order pada highpass filter mempertegas batas image:





high order lowpass filter membuat efek riak air dan mempertegas batas pada image:





low order lowpass filter menyebabkan image menjadi blur:







listing of porto4.m:

function portofolio4 = porto4(img)
im = imread(img);
im = rgb2gray(im);

lowpassffthigh = lowpassfilter(size(im), 0.05, 50);
highpassffthigh = highpassfilter(size(im), 0.05, 50);
highboostfft = highboostfilter(size(im), 0.05, 50, 0.5);
lowpassfftlow = lowpassfilter(size(im), 0.05, 1);
highpassfftlow = highpassfilter(size(im), 0.05, 1);

imfft = fft2(im);

surfl(fftshift(lowpassffthigh)), shading interp;
print -dpng lowpassffthighfreq.png
surfl(fftshift(highpassffthigh)), shading interp;
print -dpng highpassffthighfreq.png
surfl(fftshift(highboostfft)), shading interp;
print -dpng highboostfftfreq.png
surfl(fftshift(lowpassfftlow)), shading interp;
print -dpng lowpassfftlowfreq.png
surfl(fftshift(highpassfftlow)), shading interp;
print -dpng highpassfftlowfreq.png

surfl(fftshift(real(ifft2(lowpassffthigh)))), shading interp;
print -dpng lowpassffthighspac.png
surfl(fftshift(real(ifft2(highpassffthigh)))), shading interp;
print -dpng highpassffthighspac.png
surfl(fftshift(real(ifft2(highboostfft)))), shading interp;
print -dpng highboostfftspac.png
surfl(fftshift(real(ifft2(lowpassfftlow)))), shading interp;
print -dpng lowpassfftlowspac.png
surfl(fftshift(real(ifft2(highpassfftlow)))), shading interp;
print -dpng highpassfftlowspac.png

newlowpassffthigh = lowpassffthigh.*imfft;
newhighpassffthigh = highpassffthigh.*imfft;
newhighboostfft = highboostfft.*imfft;
newlowpassfftlow = lowpassfftlow.*imfft;
newhighpassfftlow = highpassfftlow.*imfft;

figure,imagesc(real(ifft2(newlowpassffthigh))),title('lowpassffthigh'),colormap gray;
figure,imagesc(real(ifft2(newhighpassffthigh))),title('highpassffthigh'),colormap gray;
figure,imagesc(real(ifft2(newhighboostfft))),title('highboostfft'),colormap gray;
figure,imagesc(real(ifft2(newlowpassfftlow))),title('lowpassfftlow'),colormap gray;
figure,imagesc(real(ifft2(newhighpassfftlow))),title('highpassfftlow'),colormap gray;
figure,imagesc(im),title('im'),colormap gray;

Tidak ada komentar: