手势检测源码
/*
----------------------------------------------------------------------------------------------------------------------------
Hand Gesture Detection
Done By
Mohafiz Raz.M.A
Febin Jose
C.Sanjay Arvind
----------------------------------------------------------------------------------------------------------------------------
*/
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <float.h>
#include <limits.h>
#include <time.h>
#include <ctype.h>
// Create a string that contains the exact cascade name
// Contains the trained classifer for detecting hand
const char *cascade_name="hand.xml";
//The function detects the hand from input frame and draws a rectangle around the detected portion of the frame
void detect_and_draw( IplImage* img )
{
// Create memory for calculations
static CvMemStorage* storage = 0;
// Create a new Haar classifier
static CvHaarClassifierCascade* cascade = 0;
// Sets the scale with which the rectangle is drawn with
int scale = 1;
// Create two points to represent the hand locations
CvPoint pt1, pt2;
// Looping variable
int i;
// Load the HaarClassifierCascade
cascade = (CvHaarClassifierCascade*)cvLoad( cascade_name, 0, 0, 0 );
// Check whether the cascade has loaded successfully. Else report and error and quit
if( !cascade )
{
fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
return;
}
// Allocate the memory storage
storage = cvCreateMemStorage(0);
// Create a new named window with title: result
cvNamedWindow( "result", 1 );
// Clear the memory storage which was used before
cvClearMemStorage( storage );
// Find whether the cascade is loaded, to find the hands. If yes, then:
if( cascade )
{
// There can be more than one hand in an image. So create a growable sequence of hands.
// Detect the objects and store them in the sequence
CvSeq* hands = cvHaarDetectObjects( img, cascade, storage,
1.1, 2, CV_HAAR_DO_CANNY_PRUNING,
cvSize(40, 40) );
// Loop the number of hands found.
for( i = 0; i < (hands ? hands->total : 0); i++ )
{
// Create a new rectangle for drawing the hand
CvRect* r = (CvRect*)cvGetSeqElem( hands, i );
// Find the dimensions of the hand,and scale it if necessary
pt1.x = r->x*scale;
pt2.x = (r->x+r->width)*scale;
pt1.y = r->y*scale;
pt2.y = (r->y+r->height)*scale;
// Draw the rectangle in the input image
cvRectangle( img, pt1, pt2, CV_RGB(230,20,232), 3, 8, 0 );
}
}
// Show the image in the window name
Key words: hand gesture detection; gesture recognition; thermal camera; interactive presentation Introduction Interactive presentation systems use advanced Human ...
We used a detector for the best suited posture in a vision-based hand gesture interface, where robust hand detection is of utmost importance. This ...
Hand Detection with a Cascade of Boosted Classifiers Using Haar-like ...How to select the hand gesture configurations which can be detected more ...
Design and implementation of a flexible hand gesture command interface for games based on computer vision Hand Gesture hand-gesture-detection 1 http://code...
rst attempt in real-life hand gesture recognition using Kinect sensor. Finger-Earth Mover’s Distance 2. HAND DETECTION We use Kinect sensor as the ...
Hand Gesture Controlled 3D Mouse Zsolt Mathe March 6, 2001 Introduction In...Rehg, “Statistical Color Models with Application to Skin Detection”, ...
Simulating a Smartboard by Real-Time Gesture Detection in Lecture Videos ...hand gesture and laser pen with simple setup without involving expensive ...
(still under construction), (v) a new face recognition module, and (vi) a robust and real-time hand gesture detection and recognition module for ...
2003, Sydney 8 Conclusion This paper presents a hand gesture detection and recognition system using an HMM approach. An efficient method for extracting the...
A real time hand gesture recognition system using motion history image_互联...Keywords-hand gesture recognition; adaptive skin color model; motion detection...
热门文档