Help on Gesture recognition code?
Mostra commenti meno recenti
I'm doing a project on gesture recognition using Neural Networks. The training Network is RBF net, and the net is saved as gesture1net in an m-file train.m . However, when I load the network, I get an error message that says "undefined variable or function gesture1net". Can anyone tell me why that is? Here's part of the code:
1) train.m
% This program is used to make the neural network for the identification of the gesture1.
clc;
clear all;
% Load the sample images (of different poses) to make net for gesture1
img1=imread('firsgesture1.jpg');
img2=imread('firsgesture2.jpg');
img3=imread('firsgesture3.jpg');
% Crop the sample images
imgcpd1=imcrop(img1);
imgcpd2=imcrop(img2);
imgcpd3=imcrop(img3);
% Train the network. p is the input vector and t is the target vector
p=[imgcpd1,imgcpd2,imgcpd3];
t=[imgcpd1,imgcpd1,imgcpd1];
p=double(p);
t=double(t);
net=newrb(p,t,.001,.1,1000,25); %train using RBF net
save('gesture1net','net'); %save the network
2) trackrecog.m
% MATLAB program for real time hand tracking and gesture identification
clc;
clear all;
close all;
train;
closepreview;
vid = videoinput('winvideo', 1, 'YUY2_640x480'); %specify the video adaptor
src = getselectedsource(vid);
vid.ReturnedColorspace = 'grayscale'; %define the color format to GRAYSCALE
vid.FramesPerTrigger = 1;
preview(vid); %preview the video object
load gesture1net; %load the network for each gesture
imgref1=imread('refimg1.jpg'); %loading the reference image for each gesture
imgcrpd1=imcrop(imgref1); %crop the reference images
imgcrpd1=double(imgcrpd1);
imgtrained1=sim(gesture1net,imgcrpd1) ; %train the cropped reference images_
Thank You!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Deep Learning Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!