Hasil rekonstruksi image dengan menggunakan freqcomp.m

Original image
imread(‘afwan.jpg’);
Reconstruction using component frequency 50

Reconstruction using component frequency 100

Reconstruction using component frequency 500

Filtering


Original image
FFT dari Original image
Gaussian Filter
FFT dari Gaussian filter
gaussianFilter = fspecial(‘gaussian’,[baris kolom],8);
Perkalian FFT image dengan FFT Gaussian Filter

Gaussian Filter Result Image
Average Filter
FFT dari filter Average
Perkalian FFT Image dengan FFT Average Filter
Average Filter Result Image

Citra Hasil Pertukaran Nilai Fase dan Citra Versi Fase Saja


Image 1

Image 2
Image 1 yang Fasenya Ditukar dengan Image 2
Image 2 yang Fasenya Ditukar dengan Image 1
Image 1 Versi Fase Saja
Image 2 Versi Fase Saja

Listing perintah MATLAB yang digunakan untuk pertukaran nilai fase

function phase = fase(image1, image2)% dapatkan input image
input1 = imread(image1);
input2 = imread(image2);

% ubah ke bentuk grayscale
gray1 = rgb2gray(input1);
gray2 = rgb2gray(input2);

subplot(2,3,1),imshow(gray1);
subplot(2,3,4),imshow(gray2);

% ubah ke bentuk domain frekuensi
fftImage1 = fft2(gray1);
fftImage2 = fft2(gray2);

% dapatkan fase dari setiap image
phaseImage1 = angle(fftImage1);
phaseImage2 = angle(fftImage2);

% dapatkan magnitude dari setiap image
magnitudeImage1 = abs(fftImage1);
magnitudeImage2 = abs(fftImage2);

% tukar fase dari kedua image

exchangePhase1 = magnitudeImage1 .* (cos(phaseImage2) + i .* sin(phaseImage2));
exchangePhase2 = magnitudeImage2 .* (cos(phaseImage1) + i .* sin(phaseImage1));

% ubah kembali ke bentuk domain spasial
exchangeImage1 = real(ifft2(exchangePhase1));
subplot(2,3,2),imagesc(exchangeImage1),colormap
gray;

exchangeImage2 = real(ifft2(exchangePhase2));
subplot(2,3,5),imagesc(exchangeImage2),colormap gray;

% dapatkan frekuensi image versi fase saja
Image1PhaseOnly = fftImage1 ./ magnitudeImage1;
Image2PhaseOnly = fftImage2 ./ magnitudeImage2;

% ubah ke bentuk domain spasial
resultImage1 = real(ifft2(Image1PhaseOnly));
resultImage2 = real(ifft2(Image2PhaseOnly));

subplot(2,3,3),imagesc(resultImage1),colormap gray;
subplot(2,3,6),imagesc(resultImage2),colormap gray;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s