TUGAS
REDUKSI NOISE PADA GAMBAR CITRA DENGAN
MENGUNAKAN FILTER
DOSEN :
DR BUDI SETIYONO, S.SI, MT
19720207 199702 1 001
OLEH:
GITHA ANDANI SUHARNINGTYAS
06111950010008
DEPARTEMEN MATEMATIKA
FAKULTAS SAINS DAN DATA ANALITIK
INSTITUT TEKNOLOGI SEPULUH NOPEMBER
2020
A. Simulasi GUI
1. Load Gambar Asli
Gaussian
(Gambar 1)
Speckle
(Gambar 2)
Mean
Median
Low Pass
High Pass
MSE, RMSE, PSNR
Filter
Gambar 1 Gambar 2 Gambar 3 Gambar 4
Mean
Median
Low
Pass
High
Pass
Berdasarkan hasil simulasi gambar dengan noise Gaussian selanjutnya dilakukan reduksi
noise menggunakan filter mean, median, low pass dan high pass. Hasil filter mean dengan noise
Gaussian terlihat bahwa gambar dengan mean 0.4 dan varians 0.07 artinya semakin kecil nilai
mean dan semakin besar nilai varians akan menghasilkan gambar yang lebih jelas dan mendekati
gambar asli. Dibandingkan filter median dan low pass masih sedikit tampak ada noise pada
gambar, serta filter high pass terlihat jauh dari gambar asli. Tetapi untuk PNSR tertinggi diperoleh
pada gambar 2 dengan filter median
4. Gambar Dengan Noise Speckle Direduksi dengan Filter
Filter SIMULASI
Mean
Median
Low Pass
High Pass
MSE, RMSE, PSNR
Filter
Gambar 1 Gambar 2 Gambar 3 Gambar 4
Mean
Median
Low
Pass
High
Pass
Berdasarkan hasil simulasi gambar dengan noise speckle selanjutnya dilakukan reduksi noise
menggunakan filter mean, median, low pass dan high pass. Hasil filter median dengan noise
speckle gambar terlihat lebih jelas dengan varians 0.2 artinya semakin kecil nilai varians akan
menghasilkan gambar yang lebih jelas dan mendekati gambar asli. Dibandingkan filter mean dan
low pass masih sedikit tampak ada noise pada gambar dan kontras rendah, serta filter high pass
terlihat jauh dari gambar asli masih tampak banyak noise. Selanjutnya untuk PNSR terbaik juga
pada gambar 4 deng filter median
5. Gambar Dengan Noise Salt & Pepper Direduksi dengan Filter
Filter SIMULASI
Mean
Median
Low Pass
High Pass
MSE, RMSE, PSNR
Filter
Gambar 1 Gambar 2 Gambar 3 Gambar 4
Mean
Median
Low
Pass
High
Pass
Berdasarkan hasil simulasi gambar dengan noise Salt and Pepper. Hasil filter median dengan
noise Salt and Pepper terlihat bahwa menghasilkan gambar yang lebih jelas dan mendekati gambar
asli. Dibandingkan filter median dan low pass masih sedikit tampak ada noise pada gambar, serta
filter high pass terlihat jauh dari gambar asli. Selanjutnya, nilai PNSR terbesar diperoleh pada
gambar 4 dengan filter median, hal ini menunjukkan penapis yang paling baik
B. Source Code
Load Gambar
function pushbutton1_Callback(hObject, eventdata, handles)
filename = get(handles.filename,'string');
if isempty(filename)
msgbox('Pilih File!!', 'informasi','warn');
else
jenis3 = filename(1,length(filename)-3:end);
jenis4 = filename(1,length(filename)-4:end);
if jenis3=='.jpg'
axes(handles.axes1)
gambar=imread(filename);
imshow(gambar);
elseif jenis3=='.png'
axes(handles.axes1)
gambar=imread(filename);
imshow(gambar);
end
end
else
gabung=[pathname filename];
set(handles.filename,'string',gabung);
end
axes(handles.axes2)
gambar = imread(filename);
gaussian1 = imnoise(gambar,'gaussian',0.6, 0.07);
imshow(gaussian1);
title('Mean 0.6, Varians 0.07', 'BackgroundColor','white')
handles.gaussian1 = gaussian1;
guidata(hObject,handles);
axes(handles.axes29)
gambar = imread(filename);
gaussian2 = imnoise(gambar,'gaussian',0.6, 0.03);
imshow(gaussian2);
title('Mean 0.6, Varians 0.03', 'BackgroundColor','white')
handles.gaussian2 = gaussian2;
guidata(hObject,handles);
axes(handles.axes31)
gambar = imread(filename);
gaussian3 = imnoise(gambar,'gaussian',0.8, 0.07);
imshow(gaussian3);
title('Mean 0.8, Varians 0.07', 'BackgroundColor','white')
handles.gaussian3 = gaussian3;
guidata(hObject,handles);
axes(handles.axes30)
gambar = imread(filename);
gaussian4 = imnoise(gambar,'gaussian',0.4, 0.07);
imshow(gaussian4);
title('Mean 0.4, Varians 0.07', 'BackgroundColor','white')
handles.gaussian4 = gaussian4;
guidata(hObject,handles);
case 2
filename = get(handles.filename,'string');
axes(handles.axes2)
gambar = imread(filename);
speckle1 = imnoise(gambar,'speckle',0.8);
imshow(speckle1);
title('Varians 0.8', 'BackgroundColor','white')
handles.speckle1 = speckle1;
guidata(hObject,handles);
axes(handles.axes29)
gambar = imread(filename);
speckle2 = imnoise(gambar,'speckle',0.6);
imshow(speckle2);
title('Varians 0.6', 'BackgroundColor','white')
handles.speckle2 = speckle2;
guidata(hObject,handles);
axes(handles.axes31)
gambar = imread(filename);
speckle3= imnoise(gambar,'speckle',0.4);
imshow(speckle3);
title('Varians 0.07', 'BackgroundColor','white')
handles.speckle3 = speckle3;
guidata(hObject,handles);
axes(handles.axes30)
gambar = imread(filename);
speckle4 = imnoise(gambar,'speckle',0.2);
imshow(speckle4);
title('Varians 0.2', 'BackgroundColor','white')
handles.speckle4 = speckle4;
guidata(hObject,handles);
case 3
filename = get(handles.filename,'string');
axes(handles.axes2)
gambar = imread(filename);
salt1 = imnoise(gambar,'salt & pepper',0.8);
imshow(salt1);
title('Density 0.8', 'BackgroundColor','white')
handles.salt1 = salt1;
guidata(hObject,handles);
axes(handles.axes29)
gambar = imread(filename);
salt2 = imnoise(gambar,'salt & pepper',0.6);
imshow(salt2);
title('Density 0.6', 'BackgroundColor','white')
handles.salt2 = salt2;
guidata(hObject,handles);
axes(handles.axes31)
gambar = imread(filename);
salt3= imnoise(gambar,'salt & pepper',0.4);
imshow(salt3);
title('Density 0.07', 'BackgroundColor','white')
handles.salt3 = salt3;
guidata(hObject,handles);
axes(handles.axes30)
gambar = imread(filename);
salt4 = imnoise(gambar,'salt & pepper',0.2);
imshow(salt4);
title('Density 0.2', 'BackgroundColor','white')
handles.salt4 = salt4;
guidata(hObject,handles);
end
handles.ambil= ambil;
disp(ambil)
guidata(hObject,handles);
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian2;
axes(handles.axes33)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian3;
axes(handles.axes34)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian4;
axes(handles.axes35)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
case 2
disp('Reduksi Noise Speckle Dengan Mean Filter')
gambar = handles.speckle1;
axes(handles.axes3)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle2;
axes(handles.axes33)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle3;
axes(handles.axes34)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle4;
axes(handles.axes35)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
case 3
disp('Reduksi Noise Salt and Pepper Dengan Mean Filter')
gambar = handles.salt1;
axes(handles.axes3)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt2;
axes(handles.axes33)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt3;
axes(handles.axes34)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt4;
axes(handles.axes35)
mean = imfilter(gambar,ones(5)/25);
imshow(mean);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-mean).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
end
Filter Median
function Median_Callback(hObject, eventdata, handles)
ambil = handles.p;
filename = get(handles.filename,'string');
gambarasli = imread(filename);
[row,col,~]=size(gambarasli);
switch ambil
case 1
disp('Reduksi Noise Gaussian Dengan Median Filter')
gambar = handles.gaussian1;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
axes(handles.axes3)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian2;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
size(gambar)
axes(handles.axes33)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian3;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
size(gambar)
axes(handles.axes34)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian4;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
size(gambar)
axes(handles.axes35)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
case 2
disp('Reduksi Noise Speckle Dengan Median Filter')
gambar = handles.speckle1;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
axes(handles.axes3)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle2;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
axes(handles.axes33)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle3;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
axes(handles.axes34)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle4;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
axes(handles.axes35)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
case 3
disp('Reduksi Noise Salt & Pepper Dengan Median Filter')
gambar = handles.salt1;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
axes(handles.axes3)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt2;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
axes(handles.axes33)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt3;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
axes(handles.axes34)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt4;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
axes(handles.axes35)
median(:,:,1) = medfilt2(red);
median(:,:,2) = medfilt2(green);
median(:,:,3) = medfilt2(blue);
imshow(median);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-median).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
end
axes(handles.axes3)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian2;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes33)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian3;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes34)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian4;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes35)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
case 2
disp('Reduksi Noise Speckle Dengan Low Pass Filter')
gambar = handles.speckle1;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes3)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle2;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes33)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle3;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes34)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle4;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes35)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
case 3
disp('Reduksi Noise Salt & Pepper Dengan Low Pass Filter')
gambar = handles.salt1;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes3)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt2;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes33)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt3;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes34)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt4;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
lpf =[1 1 1;1 1 1;1 1 1]/9;
axes(handles.axes35)
low(:,:,1)=uint8(conv2(double(red), lpf,'same'));
low(:,:,2)=uint8(conv2(double(green), lpf,'same'));
low(:,:,3)=uint8(conv2(double(blue), lpf,'same'));
imshow(low);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-low).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
end
axes(handles.axes3)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian2;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes33)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian3;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes34)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.gaussian4;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes35)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
case 2
disp('Reduksi Noise Speckle Dengan High Pass Filter')
gambar = handles.speckle1;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes3)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle2;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes33)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle3;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes34)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.speckle4;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes35)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
case 3
disp('Reduksi Noise Salt & Pepper Dengan High Pass Filter')
gambar = handles.salt1;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes3)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 1','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 1 RGB')
disp('-----------------------------')
disp('MSE Gambar 1 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 1 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 1 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt2;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes33)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 2','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 2 RGB')
disp('-----------------------------')
disp('MSE Gambar 2 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 2 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 2 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt3;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes34)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 3','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 3 RGB')
disp('-----------------------------')
disp('MSE Gambar 3 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 3 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 3 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
gambar = handles.salt4;
red = gambar(:,:,1);
green = gambar(:,:,2);
blue = gambar(:,:,3);
hpf =[-1 -1 -1;-1 8 -1;-1 -1 -1];
axes(handles.axes35)
high(:,:,1)=uint8(conv2(double(red), hpf,'same'));
high(:,:,2)=uint8(conv2(double(green), hpf,'same'));
high(:,:,3)=uint8(conv2(double(blue), hpf,'same'));
imshow(high);
title('Hasil Gambar 4','BackgroundColor','white')
MSE = sum(sum((gambarasli-high).^2))/(row*col);
RMSE = sqrt(MSE);
PNSR = 10*log10(256*256/MSE);
disp('MSE, RMSE dan PNSR Gambar 4 RGB')
disp('-----------------------------')
disp('MSE Gambar 4 RGB')
disp('*****************')
fprintf('MSE %d \n', MSE)
disp('RMSE Gambar 4 RGB')
disp('*****************')
fprintf('RMSE %d \n', RMSE)
disp('PNSR Gambar 4 RGB')
disp('*****************')
fprintf('PNSR %d \n', PNSR)
end