Wednesday, February 21, 2018

Penapisan Butterworth Untuk Merestorasi Citra Digital


Antarmuka GUI MATLAB ini dapat dipakai untuk laboratorium sinyal bagi mahasiswa dan untuk menunjang penelitian bagi para peneliti. Anda bisa memesannya pada form pemesanan di bawah ini.














KODE UNTUK SALAH SATU EVENT CALLBACK:



function tombolEvaluasiLowPass_Callback(hObject, eventdata, handles)
% hObject    handle to tombolEvaluasiLowPass (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

I=im2double(getimage(handles.axes1));
[baris, kolom, banyakKanal] = size(I);

 if banyakKanal ==1
        Semula=I;
 else
    Semula=rgb2gray(I);
 end

% Frek Cut-Off 50
oimg1=getimage(handles.axes3);
[fftI1, filterKeluaran1, hasil1] = butterworthlpf(oimg1,50,4);

% Frek Cut-Off 100
[fftI2, filterKeluaran2, hasil2] = butterworthlpf(oimg1,100,4);

% Frek Cut-Off 150
[fftI3, filterKeluaran3, hasil3] = butterworthlpf(oimg1,150,4);

% Frek Cut-Off 200
[fftI4, filterKeluaran4, hasil4] = butterworthlpf(oimg1,200,4);

% Frek Cut-Off 250
[fftI5, filterKeluaran5, hasil5] = butterworthlpf(oimg1,250,4);

% Frek Cut-Off 500
[fftI6, filterKeluaran6, hasil6] = butterworthlpf(oimg1,500,4);

% Frek Cut-Off 1000
[fftI7, filterKeluaran7, hasil7] = butterworthlpf(oimg1,1000,4);


% metrik-metrik evaluasi kualitas citra
[m,n]=size(Semula);
hasil1 = imresize(hasil1,[m n]);
hasil2 = imresize(hasil2,[m n]);
hasil3 = imresize(hasil3,[m n]);
hasil4 = imresize(hasil4,[m n]);
hasil5 = imresize(hasil5,[m n]);
hasil6 = imresize(hasil6,[m n]);
hasil7 = imresize(hasil7,[m n]);

oimg1 = imresize(oimg1,[m n]);

size(oimg1)
size(Semula)
size(hasil1)
[RMSE1,PFE1,MAE1,CORR1,SNR1,PSNR1,MI1,QI1,SSIM1] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil1));
[RMSE2,PFE2,MAE2,CORR2,SNR2,PSNR2,MI2,QI2,SSIM2] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil2));
[RMSE3,PFE3,MAE3,CORR3,SNR3,PSNR3,MI3,QI3,SSIM3] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil3));
[RMSE4,PFE4,MAE4,CORR4,SNR4,PSNR4,MI4,QI4,SSIM4] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil4));
[RMSE5,PFE5,MAE5,CORR5,SNR5,PSNR5,MI5,QI5,SSIM5] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil5));
[RMSE6,PFE6,MAE6,CORR6,SNR6,PSNR6,MI6,QI6,SSIM6] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil6));
[RMSE7,PFE7,MAE7,CORR7,SNR7,PSNR7,MI7,QI7,SSIM7] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil7));

t = handles.uitable4;

d1 = [RMSE1,PFE1,MAE1,CORR1,SNR1,PSNR1,MI1,QI1,SSIM1];
d2 = [RMSE2,PFE2,MAE2,CORR2,SNR2,PSNR2,MI2,QI2,SSIM2];
d3 = [RMSE3,PFE3,MAE3,CORR3,SNR3,PSNR3,MI3,QI3,SSIM3];
d4 = [RMSE4,PFE4,MAE4,CORR4,SNR4,PSNR4,MI4,QI4,SSIM4];
d5 = [RMSE5,PFE5,MAE5,CORR5,SNR5,PSNR5,MI5,QI5,SSIM5];
d6 = [RMSE6,PFE6,MAE6,CORR6,SNR6,PSNR6,MI6,QI6,SSIM6];
d7 = [RMSE7,PFE7,MAE7,CORR7,SNR7,PSNR7,MI7,QI7,SSIM7];

d = [d1;d2; d3; d4; d5; d6; d7];

set(t,'Data',d); 

set(t,'ColumnName',{'RMSE |(Root Mean Square Error)';'PFE |(Persentage Fit Error)';'MAE |(Mean Absolute Error)'; 'CORR| (Correlation)';...
    'SNR |(Signal to Noise Ratio'; 'PSNR |(Peak Signal to Noise Ratio)';'MI | (Mutual Information)'; 'QI| (Quality Index)';...
    'SSIM| (Measure of Structural Similarity)';})

set(t,'RowName',{'50 Hz'; '100 Hz'; '150 Hz'; '200 Hz'; '250 Hz'; '500 Hz'; '1000 Hz'});

%Menampilkan grafik
z=1:9;
axes(handles.axes11);
plot(z',d1, z',d2, z',d3, z',d4, z',d5, z',d6, z',d7); title('Grafik Kinerja TAPIS BUTTERWORTH LOWPASS'); grid on;
legend('50 Hz', '100 Hz', '150 Hz', '200 Hz', '250 Hz', '500 Hz', '1000 Hz')
set(gca,'XTick',1:9)
set(gca,'XTickLabel',{'RMSE','PFE','MAE','CORR','SNR','PSNR','MI','QI','SSIM'});

save d1.mat d1;
save d2.mat d2;
save d3.mat d3;
save d4.mat d4;
save d5.mat d5;
save d6.mat d6;
save d7.mat d7;

flag=1;
save flag.mat flag;


No comments: