function varargout = inicio(varargin)
% INICIO MATLAB code for inicio.fig
% INICIO, by itself, creates a new INICIO or raises the existing
% singleton*.
%
% H = INICIO returns the handle to a new INICIO or the handle to
% the existing singleton*.
%
% INICIO('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in INICIO.M with the given input arguments.
%
% INICIO('Property','Value',...) creates a new INICIO or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before inicio_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to inicio_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 inicio
% Last Modified by GUIDE v2.5 25-Sep-2013 16:39:55
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @inicio_OpeningFcn, ...
'gui_OutputFcn', @inicio_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 inicio is made visible.
function inicio_OpeningFcn(hObject, eventdata, handles, varargin)
scrsz=get(0,'ScreenSize');
pos_act=get(gcf,'position');
xr=scrsz(3)-pos_act(3);
xp=round(xr/2);
yr=scrsz(4)-pos_act(4);
yp=round(yr/2);
set(gcf,'Position',[xp yp pos_act(3) pos_act(4)]);
A=imread('fondo.jpg');
set(handles.axes1,'Visible','off');
image(A,'Parent',handles.axes1)
set(handles.cameraAxes,'Visible','off');
set(handles.axes3,'Visible','off')
handles.output = hObject;
guidata(hObject, handles);
% 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 inicio (see VARARGIN)
% Choose default command line output for inicio
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes inicio wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = inicio_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;
%%%%
function entrada_Callback(hObject, eventdata, handles)
function entrada_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'),...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
%%%%
% --- Executes on button press in ActCam.
function ActCam_Callback(hObject, eventdata, handles)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%javo%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global vid
vid = videoinput('winvideo', 1,'YUY2_320x240')
set(vid,'TriggerRepeat',Inf);
%vid.FrameGrabInterval=Inf;
vidRes = get(vid, 'VideoResolution');
imWidth = vidRes(1);
imHeight = vidRes(2);
nBands = get(vid, 'NumberOfBands');
%cla;
hImage = image( zeros(imHeight, imWidth, nBands),'Parent',handles.cameraAxes );
preview(vid,hImage);
start(vid);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%javo%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% hObject handle to ActCam (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in Start.
function Start_Callback(hObject, eventdata, handles)
% hObject handle to Start (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%%%%%%%%%%%%%%%%% j a v o %%%%%%%%%%%%%%%%%%%%%%%%%%%
global vid
global s
%%%%%%%%%%%%%%% Declaración del puerto serial %%%%%%%%%%%%%%%%%
s=serial('COM100'); % Puerto serial a utilizar
set(s,'BaudRate',9600)
set(s,'DataBits',8)
set(s,'Parity','none')
set(s,'StopBits',1)
set(s,'Terminator','LF')
set(s,'Timeout',100)
set(s,'OutputBufferSize',6)
set(s,'InputBufferSize',2)
fopen(s); % Abrimos puerto
A=fgetl(s); % Leemos puerto, esperando la señal para tomar foto
IM=getsnapshot(vid); % Obtenemos la imagen a analizar
axes(handles.axes3);
axis off;
imshow(IM);
%%%%%%%%%%%%%%%%%javo%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in DesacCam.
function DesacCam_Callback(hObject, eventdata, handles)
global vid
global s
stop(vid)
delete(vid)
cla(handles.cameraAxes)
cla(handles.axes3)
fclose(s)
delete(s)
clear s
% hObject handle to DesacCam (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 DesacCam