function varargout = see(varargin)
% SEE M-file for see.fig
% SEE, by itself, creates a new SEE or raises the existing
% singleton*.
%
% H = SEE returns the handle to a new SEE or the handle to
% the existing singleton*.
%
% SEE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SEE.M with the given input arguments.
%
% SEE('Property','Value',...) creates a new SEE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before see_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to see_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help see
% Last Modified by GUIDE v2.5 28-Nov-2008 16:06:22
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @see_OpeningFcn, ...
'gui_OutputFcn', @see_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes on button press in radiobuttonF.
function radiobuttonF_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobuttonF
% --- Executes on button press in radiobuttonS.
function radiobuttonS_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonS (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobuttonS
% --- Executes on selection change in ff.
function ff_Callback(hObject, eventdata, handles)
% hObject handle to ff (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns ff contents as cell array
% contents{get(hObject,'Value')} returns selected item from ff
% --- Executes during object creation, after setting all properties.
function ff_CreateFcn(hObject, eventdata, handles)
% hObject handle to ff (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in fn.
function fn_Callback(hObject, eventdata, handles)
% hObject handle to fn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns fn contents as cell array
% contents{get(hObject,'Value')} returns selected item from fn
% --- Executes during object creation, after setting all properties.
function fn_CreateFcn(hObject, eventdata, handles)
% hObject handle to fn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function CF_Callback(hObject, eventdata, handles)
% hObject handle to CF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of CF as text
% str2double(get(hObject,'String')) returns contents of CF as a double
% --- Executes during object creation, after setting all properties.
function CF_CreateFcn(hObject, eventdata, handles)
% hObject handle to CF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in ss.
function ss_Callback(hObject, eventdata, handles)
% hObject handle to ss (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns ss contents as cell array
% contents{get(hObject,'Value')} returns selected item from ss
% --- Executes during object creation, after setting all properties.
function ss_CreateFcn(hObject, eventdata, handles)
% hObject handle to ss (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function r_Callback(hObject, eventdata, handles)
% hObject handle to r (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of r as text
% str2double(get(hObject,'String')) returns contents of r as a double
% --- Executes during object creation, after setting all properties.
function r_CreateFcn(hObject, eventdata, handles)
% hObject handle to r (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in sn.
function sn_Callback(hObject, eventdata, handles)
% hObject handle to sn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns sn contents as cell array
% contents{get(hObject,'Value')} returns selected item from sn
% --- Executes during object creation, after setting all properties.
function sn_CreateFcn(hObject, eventdata, handles)
% hObject handle to sn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function c_Callback(hObject, eventdata, handles)
% hObject handle to c (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of c as text
% str2double(get(hObject,'String')) returns contents of c as a double
% --- Executes during object creation, after setting all properties.
function c_CreateFcn(hObject, eventdata, handles)
% hObject handle to c (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes just before see is made visible.
function see_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to see (see VARARGIN)
% Choose default command line output for see
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes see wait for user response (see UIRESUME)
uiwait(handles.f1);
%uiwait(handles.f1);
% --- Outputs from this function are returned to the command line.
function varargout = see_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)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in p1.
function p1_Callback(hObject, eventdata, handles)
% hObject handle to p1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
UIRESUME(handles.f1)
fff=get(handles.radiobuttonF,'Value');
sss=get(handles.radiobuttonS,'Value');
sn=get(handles.sn,'Value');
% fn=get(handles.fn,'Value');
% if fff==1
% set(handles.fes,'Visible','on')
% if fn==2
% set(handles.ntx,'String','Gaussian Variance')
% end
%
% if fn==3
% set(handles.ntx,'String','Noise Density ((1 Maximum))')
% end
%
% if fn==4
% set(handles.ntx,'String','Leave Blank')
% end
%
% end
% if sss==1
% set(handles.ses,'Visible','on')
if sn==2
set(handles.ntx,'String','Gaussian Noise Variance')
end
if sn==3
set(handles.ntx,'String','Noise Density ((1 Maximum))')
end
if sn==4
set(handles.e,'Visible','off')
end
% end
if sss==1
set(handles.ses,'Visible','on')
end
if fff==1
set(handles.fes,'Visible','on')
end
set(handles.ui,'Visible','on')
set(handles.p1,'Enable','off')
set(handles.p1,'Visible','off')
set(handles.uipanel4,'Visible','off')
function e_Callback(hObject, eventdata, handles)
% hObject handle to e (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of e as text
% str2double(get(hObject,'String')) returns contents of e as a double
uiwait
% --- Executes during object creation, after setting all properties.
function e_CreateFcn(hObject, eventdata, handles)
% hObject handle to e (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
uiresume
fff=get(handles.radiobuttonF,'Value');
sss=get(handles.radiobuttonS,'Value');
sn=get(handles.sn,'Value');
% fn=get(handles.fn,'Value');
fn=sn;
np=str2double(get(handles.e,'String'))
if fff==1
if fn==2
set(handles.ntx,'String','Gaussian Noise Variance')
end
if fn==3
set(handles.ntx,'String','Noise Density ((1 Maximum))')
end
if fn==4
set(handles.ntx,'String','Leave Blank')
end
end
if sss==1
if sn==2
set(handles.ntx,'String','Gaussian Noise Variance')
end
if sn==3
set(handles.ntx,'String','Noise Density ((1 Maximum))')
end
if sn==4
set(handles.ntx,'String','Leave Blank')
end
end
hk=get(handles.activex1,'FileName'); %%% STOP YOUR STUPID METHOD AND WORK ON THIS !!!!!!!!!
ff=get(handles.ff,'Value');
CF=str2double(get(handles.CF,'String'));
ss=get(handles.ss,'Value');
mm=imread(hk);
zz=size(mm);
if length(zz)>2
mm=rgb2gray(mm);
end
figure(1)
imshow(mm);
if fff==1
figure(2)
if fn==2
im=imnoise(mm,'gaussian');
end
if fn==3
im=imnoise(mm,'salt & pepper');
end
if fn==4
im=imnoise(mm,'poisson');
end
if fn==1 || fn==5
im=mm;
end
subplot(121)
imshow(im)
title('Image With Noise')
imf=fft2(double(im));
% imf=fftshift(imf);
if ff==2
% set(handles.order,'Visible','on')
order=1; %str2double(get(handles.order,'String'));
nsi=size(imf);
for k=1:nsi(1)
for r=1:nsi(2)
d=sqrt(((k-(nsi(1)/2)).^2+(r-(nsi(2)/2)).^2));
dd=(1/((d./CF).^(2*order)));
end
end
% dd=butter(order,(CF/max(max(imf))));
% imff=filter2(dd,imf)
imff=imf.*((dd));
imff=ifft2(imff);
subplot(122)
imshow(((real(imff))),[])
title(' Image after Butterworth Filter')
end
if ff==3
nsi=size(imf);
for k=1:nsi(1)
for r=1:nsi(2)
d=sqrt(((k-(nsi(1)/2)).^2+(r-(nsi(2)/2)).^2));
if d<=CF
dd(k,r)=1;
end
if d>CF
dd(k,r)=0;
end
end
end
imf=imf.*((dd));
subplot(122)
imshow((real(ifft2(imf))),[])
title(' Image after Ideal Filter')
end
if ff==4
Var=CF;
nsi=size(imf);
for k=1:nsi(1)
for r=1:nsi(2)
d=sqrt(((k-(nsi(1)/2)).^2+(r-(nsi(2)/2)).^2));
dd=exp(-(d.^2)/( 2*Var.^2));
end
end
save dd
imff=imf.*((dd));
subplot(122)
imshow((real(ifft2(imff))),[])
title(' Image after Gaussian Filter')
end
end
if sss==1
figure(3)
if sn==2
im=imnoise(mm,'gaussian');
end
if sn==3
im=imnoise(mm,'salt & pepper');
end
if sn==4
im=imnoise(mm,'poisson');
end
if sn==1 || sn==5
im=mm;
end
subplot(121)
imshow(im)
title('Image With Noise')
r=str2double(get(handles.r,'String'));
c=str2double(get(handles.c,'String'));
if ss==2
im=medfilt2(im,[r c]);
subplot(122)
imshow(im)
title(' Image after Median Filter')
end
if ss==3
gr=fspecial('average',[r c]);
im=imfilter(im,gr);
subplot(122)
imshow(im)
title(' Image after Average Filter')
end
if ss==4
r=str2double(get(handles.r,'String'));
c=str2double(get(handles.c,'String'));
im=wiener2(im,[r c]);
subplot(122)
imshow(im)
title(' Image after Wiener Filter')
end
if ss==5
r=str2double(get(handles.r,'String'));
c=str2double(get(handles.c,'String'));
im=ordfilt2(im,9,[r c]);
subplot(122)
imshow(im)
title(' Image after Maximum Filter')
end
if ss==6
r=str2double(get(handles.r,'String'));
c=str2double(get(handles.c,'String'));
im=ordfilt2(im,1,[r c]);
subplot(122)
imshow(im)
title(' Image after Minimum Filter')
end
end
set(handles.ui,'Visible','off')
set(handles.ses,'Visible','off')
set(handles.fes,'Visible','off')
set(handles.p1,'Visible','on')
set(handles.p1,'Enable','on')
set(handles.uipanel4,'Visible','on')