Reconocimiento De La Palma De La Mano
function varargout = Captura_de_video(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Captura_de_video_OpeningFcn, ...
'gui_OutputFcn', @Captura_de_video_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 Captura_de_video is made visible.
functionCaptura_de_video_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
% Update handles structure
handles.rgb = [];
handles.noback = [];
guidata(hObject, handles);
% This sets up the video camera and starts the preview
% Only do this when it's invisible
if strcmp(get(hObject,'Visible'),'off')
try
handles.vidobj = videoinput('winvideo',1,'YUY2_320x240');handles.vidobj.ReturnedColorSpace='RGB';
% Update handles structure
start(handles.vidobj);
guidata(hObject, handles);
vidRes = get(handles.vidobj, 'VideoResolution');
nBands = get(handles.vidobj, 'NumberOfBands');
hImage = image(zeros(vidRes(2), vidRes(1), nBands), 'Parent',...
handles.video_cam);
preview(handles.vidobj,hImage);catch
msgbox('NO HAY CÁMARA CONECTADA. Cargando Profile.jpg.')
hImage = image(imread('profile.jpg'), 'Parent',handles.video_cam);
end
end
% Choose default command line output for Captura_de_video
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% --- Outputs from this function are returned to the command line.
functionvarargout = Captura_de_video_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
% --- Executes on button press in capturar.
function capturar_Callback(hObject, eventdata, handles)
try
handles.rgb = getsnapshot(handles.vidobj);
catch
handles.rgb = imread('profile.jpg');
end
% Update handles structure
guidata(hObject, handles);image(handles.rgb,'Parent',handles.fotografia);
axes(handles.fotografia)
axis off
% --- Executes on button press in guardar.
function guardar_Callback(hObject, eventdata, handles)
rgb = getimage(handles.fotografia);
if isempty(rgb), return, end
%guardar como archivo
fileTypes = supportedImageTypes; % Función auxiliar.
[f,p] = uiputfile(fileTypes);
if f==0, return, end
fName = fullfile(p,f);
imwrite(rgb,fName);msgbox(['Imagen guardada en ' fName]);
function fileTypes = supportedImageTypes
% Función auxiliar: formatos de imágenes.
fileTypes = {'*.jpg','JPEG (*.jpg)';'*.tif','TIFF (*.tif)';...
'*.bmp','Bitmap (*.bmp)';'*.*','All files (*.*)'};
RECONOCIMIENTO DE PUNTOS
clc;
E=imread('e8.jpg');figure(1);imshow(E)
E=rgb2gray(E);figure(2);imshow(E)
p=95;
bw=im2bw(E,p/255);figure(3);imshow(~bw)E=imfill(~bw,'holes');
figure(4);imshow(E)
E=~bw;
E=edge (E,'canny');
figure(5);imshow(E)
%%
[nf,nc]=size(E);
clc
x1=0;
y1=0;
pos=0;
for i=1:nc
for j=1:nf
if (E(j,i)==1)
pos=pos+1;
x1(pos)=i;
y1(pos)=j;
break
end
end
end
ax=x1(1);
ay=y1(1);
x3=0;
y3=0;
pos=0;
for j=nf:-1:1
for i=nc:-1:1if (E(j,i)==1)
pos=pos+1;
x3(pos)=i;
y3(pos)=j;
break
end
end
end
x3x=(x3(1));
y3y=(y3(1));
x2=0;
y2=0;
pos=0;
for j=nf:-1:1
for i=1:nc
if (E(j,i)==1)
pos=pos+1;
x2(pos)=i;
y2(pos)=j;
break
end
end
end
bx=(x2(1));
by=(y2(1));
%longj=lenght(vectorj)...
Regístrate para leer el documento completo.