Code covered by the BSD License  

Highlights from
image effect

image thumbnail

image effect

by

 

06 Oct 2011 (Updated )

lets you take a picture or browse for it and put some effects on it

CameraSettings(varargin)
function varargout = CameraSettings(varargin)
% CAMERASETTINGS M-file for CameraSettings.fig
%      CAMERASETTINGS, by itself, creates a new CAMERASETTINGS or raises the existing
%      singleton*.
%
%      H = CAMERASETTINGS returns the handle to a new CAMERASETTINGS or the handle to
%      the existing singleton*.
%
%      CAMERASETTINGS('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in CAMERASETTINGS.M with the given input arguments.
%
%      CAMERASETTINGS('Property','Value',...) creates a new CAMERASETTINGS or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before CameraSettings_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to CameraSettings_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

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help CameraSettings

% Last Modified by GUIDE v2.5 12-Jul-2012 18:25:33

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @CameraSettings_OpeningFcn, ...
                   'gui_OutputFcn',  @CameraSettings_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 CameraSettings is made visible.
function CameraSettings_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 CameraSettings (see VARARGIN)
try
    if ~strcmp(varargin{1},'no camera')
    set(handles.edit1,'String',varargin{1})
    set(handles.checkbox1,'Value',1)
    else
        set(handles.edit1,'enable','off')
    end
catch
    set(handles.edit1,'enable','off')
end
% Choose default command line output for CameraSettings
%handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes CameraSettings wait for user response (see UIRESUME)
uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = CameraSettings_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;
guidata(hObject,handles)
delete(handles.figure1)

% --- Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox1 (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 checkbox1
if get(hObject,'Value')==1
    set(handles.edit1,'enable','on')
else
    set(handles.edit1,'enable','off')
end
guidata(hObject,handles)

function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if get(handles.checkbox1,'Value')==0
    handles.output='no camera';
else
handles.output=get(handles.edit1,'String');
end
guidata(hObject,handles)
uiresume




% --- Executes during object deletion, before destroying properties.
function figure1_DeleteFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.output=get(handles.edit1,'String');

Contact us