I really need help... i have two axes which represent image with noise and filtered image.I have 5 checkboxes that represent 5 noises that i use and 4 checkboxes that represent 4 filters that i use.When i click noise checkbox i want the PSNR,MSE,SNR value of the image is show on the edittext.I'm really stuck at this,hope anyone can help me.Here my current code for checkbox noise.
function checkbox1_Callback(hObject, eventdata, handles)
global noiseImage
fontSize = 13;
if isfield(handles,'imgData')
imgData = handles.imgData;
noiseStr = '';
if get(handles.checkbox1,'Value')
noiseStr = 'Salt & pepper';
imgData = imnoise(imgData,'salt & pepper',0.5);
end
if get(handles.checkbox2,'Value')
if ~isempty(noiseStr)
noiseStr = [noiseStr ', '];
end
noiseStr = [noiseStr 'Gaussian'];
imgData = imnoise(imgData,'gaussian',0.1,0.1);
end
if get(handles.checkbox3,'Value')
if ~isempty(noiseStr)
noiseStr = [noiseStr ', '];
end
noiseStr = [noiseStr 'localvar'];
imgData = imnoise(imgData,'localvar',0.05*rand(size(imgData)));
end
if get(handles.checkbox4,'Value')
if ~isempty(noiseStr)
noiseStr = [noiseStr ', '];
end
noiseStr = [noiseStr 'poisson'];
imgData = imnoise(imgData,'poisson');
end
if get(handles.checkbox5,'Value')
if ~isempty(noiseStr)
noiseStr = [noiseStr ', '];
end
noiseStr = [noiseStr 'speckle'];
imgData = imnoise(imgData,'speckle', 0.3);
end
axes(handles.axes2);
imshow(imgData);
PSNR_1=psnr(imgData, imgData)
mse_1=mse(imgData, imgData)
SNR_1=snr(imgData, imgData)
set(handles.edit6, 'String',num2str(PSNR_1),'FontSize', fontSize);
set(handles.edit7, 'String', mse_1,'FontSize', fontSize);
set(handles.edit8, 'String',num2str(SNR_1),'FontSize', fontSize);
title(['Noise type: ' noiseStr,]);
noiseImage = imgData;
Aucun commentaire:
Enregistrer un commentaire