Beruflich Dokumente
Kultur Dokumente
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = ImageFilter_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Outputs from this function are returned to the command line.
function varargout = ImageFilter_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%-----------------------------------------------------------------
[namefile,pathname]=uigetfile({'*.bmp;*.jpg;*.jpeg','IMAGE Files
(*.bmp,*.jpg,*.jpeg)'},'Select an Image');
if namefile~=0
[img,map]=imread(strcat(pathname,namefile));
handles.img=img;
handles.flag2=1;
guidata(hObject,handles);
axes(handles.axes2);
imshow(img);
warndlg('IMAGE SELECTED','Message');
else
errordlg('Select a image','Error');
end
handles.count=1;
guidata(hObject,handles);
%-------------------------------------------------------------
Close GUI:
--- Executes on button press in pushbutton20.
function pushbutton20_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton20 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close ImageFilter;
FILTER SELECTION:
Wiener Filter selection in GUI:
grayImage = j;
[rows columns] = size(grayImage);
figure,
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grey Scale Image');
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
% Add noise to it.
noisyImage = imnoise(grayImage, 'gaussian', 0, 0.001);
subplot(2, 2, 2);
imshow(noisyImage, []);
title('Noisy Image');
% Calculate mean square error.
mseImage = (double(grayImage) - double(noisyImage)) .^ 2;
subplot(2, 2, 3);
imshow(mseImage, []);
title('MSE Image');
mse = sum(sum(mseImage)) / (rows * columns);
% Calculate PSNR (Peak Signal to noise ratio).
PSNR = 20 * log10( 256^2 / mse^2);