You are on page 1of 6

2012

Submitted by: Zarnigar Altaf Course: Digital Image Processing

[FILTERS GUI ]

function varargout = sample(varargin) gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @sample_OpeningFcn, ... 'gui_OutputFcn', @sample_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 just before sample is made visible. function sample_OpeningFcn(hObject, eventdata, handles, varargin) % Choose default command line output for sample img=imread('bg11.jpg'); imshow(img,'parent',handles.bg); img=imread('bg.jpg'); imshow(img,'parent',handles.axes2); imshow(img,'parent',handles.pic); imgss=imread('btn.jpg'); imshow(imgss,'parent',handles.axes7);

handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes sample wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = sample_OutputFcn(hObject, eventdata, handles) % Get default command line output from handles structure varargout{1} = handles.output;

function location_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function location_CreateFcn(hObject, eventdata, handles)

% See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

% --- Executes on button press in button. function button_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); %path='cameraman.jpg'; x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end imshow(x,'parent',handles.axes2); %set(handles.initial_value,'String',num2str(handles.initial_parameter))

% --- Executes on button press in robert. function robert_Callback(hObject, eventdata, handles) % hObject handle to robert (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) path = get(handles.location, 'string'); x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end a=edge(x,'roberts'); imshow(a,'Parent', handles.pic); % --- Executes on button press in sobel. function sobel_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end im=edge(x,'sobel'); imshow(im,'Parent', handles.pic);

% --- Executes on button press in prewitt. function prewitt_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end

im=edge(x,'prewitt'); imshow(im,'Parent', handles.pic);

% --- Executes on button press in mask2. function mask2_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end mask2=[-1,-2,-1;-2,-12,-2;-1,-2,-1]; mask2_img=imfilter(x,mask2); imshow(mask2_img,'Parent', handles.pic); % --- Executes on button press in zerocross. function zerocross_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end im=edge(x,'zerocross'); imshow(im,'Parent', handles.pic);

% --- Executes on button press in mask1. function mask1_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end mask1=[-1,-2,-1;-2,12,-2;-1,-2,-1]; mask1_img=imfilter(x,mask1); imshow(mask1_img,'Parent', handles.pic); % --- Executes on button press in log. function log_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end im=edge(x,'log'); imshow(im,'Parent', handles.pic); % --- Executes on button press in gradient. function gradient_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); x=imread(path);

isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end mask2=[1;-1]; mask2_img=imfilter(x,mask2); imshow(mask2_img,'Parent', handles.pic);

% --- Executes on button press in canny. function canny_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end im=edge(x,'canny'); imshow(im,'Parent', handles.pic); % --- Executes on button press in laplacian. function laplacian_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); x=imread(path); isColor = size(x,3) > 1; if isColor x=rgb2gray(x); end h=fspecial ('laplacian'); I2=imfilter(x,h); imshow(I2,'Parent', handles.pic); % --- Executes on button press in highboost. function highboost_Callback(hObject, eventdata, handles) path = get(handles.location, 'string'); f=imread(path); isColor = size(f,3) > 1; if isColor f=rgb2gray(f); end f=double(f); f = filter2(fspecial('average',5),f); [m n]=size(f); A=1.5; for i=2:m-1 for j=2:n-1 b(i,j) = (A+4*f(i,j))+(-1*f(i-1,j))+(-1*f(i+1,j))+(-1*f(i,j-1))+(1*f(i,j+1)); end end imshow(uint8(b),'Parent', handles.pic);

% --- Executes on button press in Exit. function Exit_Callback(hObject, eventdata, handles)

quit(); % --- Executes during object creation, after setting all properties. function frame_CreateFcn(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function axes2_CreateFcn(hObject, eventdata, handles)

You might also like