Archive for Portofolio4

Portofolio 4

Image Enhancement

% mendapatkan image

im = imread(‘polka.jpg’);

% grayscale image

im = rgb2gray(im);

% lowpass filter di domain spasial, cutoff 0.04, n 60

lowpassffthigh = lowpassfilter(size(im), 0.04, 60);

% highpass filter di domain spasial, cutoff 0.05, n 3

highpassffthigh = highpassfilter(size(im), 0.05, 3);

% highboost filter di domain spasial, cutoff 0.1, n 10, boost 150

highboostfft = highboostfilter(size(im), 0.1, 10, 150);

% lowpass filter di domain frekuensi, cutoff 0.2, n 50

lowpassfftlow = lowpassfilter(size(im), 0.2, 50);

% highpass filter di domain frekuensi, cutoff 0.1, n 35

highpassfftlow = highpassfilter(size(im), 0.1, 35);

%FFT image

imfft = fft2(im);

% menampilkan plot permukaan lowpass filter di domain frekuensi tinggi

surfl(fftshift(lowpassffthigh)), shading interp;

print -dpng lowpassffthighfreq.png

% menampilkan plot permukaan highpass filter di domain frekuensi tinggi

surfl(fftshift(highpassffthigh)), shading interp;

print -dpng highpassffthighfreq.png

% menampilkan plot permukaan highboost filter di domain frekuensi

surfl(fftshift(highboostfft)), shading interp;

print -dpng highboostfftfreq.png

% menampilkan plot permukaan lowpass filter di domain frekuensi rendah

surfl(fftshift(lowpassfftlow)), shading interp;

print -dpng lowpassfftlowfreq.png

% menampilkan plot permukaan highpass filter di domain frekuensi rendah

surfl(fftshift(highpassfftlow)), shading interp;

print -dpng highpassfftlowfreq.png

% menampilkan plot permukaan lowpass filter di domain spasial tinggi

surfl(fftshift(real(ifft2(lowpassffthigh)))), shading interp;

print -dpng lowpassffthighspac.png

% menampilkan plot permukaan highpass filter di domain spasial tinggi

surfl(fftshift(real(ifft2(highpassffthigh)))), shading interp;

print -dpng highpassffthighspac.png

% menampilkan plot permukaan highboost filter di domain spasial

surfl(fftshift(real(ifft2(highboostfft)))), shading interp;

print -dpng highboostfftspac.png

% menampilkan plot permukaan lowpass filter di domain spasial rendah

surfl(fftshift(real(ifft2(lowpassfftlow)))), shading interp;

print -dpng lowpassfftlowspac.png

% menampilkan plot permukaan highpass filter di domain spasial rendah

surfl(fftshift(real(ifft2(highpassfftlow)))), shading interp;

print -dpng highpassfftlowspac.png

% perkalian filter dengan fft image

imglowpassffthigh = lowpassffthigh.*imfft;

imghighpassffthigh = highpassffthigh.*imfft;

imghighboostfft = highboostfft.*imfft;

imglowpassfftlow = lowpassfftlow.*imfft;

imghighpassfftlow = highpassfftlow.*imfft;

% menampilkan image hasil perkalian filter dengan fft image

figure,imagesc((real(ifft2(imglowpassffthigh)))),colormap gray;

figure,imagesc((real(ifft2(imghighpassffthigh)))),colormap gray;

figure,imagesc((real(ifft2(imghighboostfft)))),colormap gray;

figure,imagesc((real(ifft2(imglowpassfftlow)))),colormap gray;

figure,imagesc((real(ifft2(imghighpassfftlow)))),colormap gray;

%menampilkan image grayscale

figure,imagesc(im),colormap gray;

program lain yang digunakan: lowpassfilter.m, highpassfilter.m, dan highboostfilter.m

Output

plot permukaan lowpass filter di domain frekuensi tinggi:

clip_image002

plot permukaan highpass filter di domain frekuensi tinggi:

clip_image004

plot permukaan lowpass filter di domain frekuensi rendah:

clip_image006

plot permukaan highpass filter di domain frekuensi rendah:

clip_image008

plot permukaan highboost filter di domain frekuensi:

clip_image010

plot permukaan lowpass filter di domain spasial tinggi:

clip_image012

plot permukaan highpass filter di domain spasial tinggi:

clip_image014

plot permukaan lowpass filter di domain spasial rendah:

clip_image016

plot permukaan highpass filter di domain spasial rendah:

clip_image018

plot permukaan highboost filter di domain spasial:

clip_image020

Image dengan high order pada lowpass filter:

clip_image022

Image dengan high order pada highpass filter:

clip_image024

Image dengan high order pada high-boost filter :

clip_image026

Image dengan low order pada lowpass filter:

clip_image028

Image dengan low order pada highpass filter:

clip_image030

Parameter yang digunakan

Pada lowpass filter domain spasial:

cutoff : 0.04

n : 60

Pada highpass filter domain spasial:

cutoff : 0.05

n : 3

Pada lowpass filter domain frekuensi:

cutoff : 0.2

n : 50

Pada highpass filter domain frekuensi:

cutoff : 0.1

n : 35

Pada highboost filter:

cutoff : 0.1

n : 10

boost : 150

Kesimpulan: apabila nilai boost yang digunakan pada high-boost filtering sangat besar, maka efek blur pada image juga akansemakin besar.

Leave a comment »