📄 gestures.h
字号:
/* * ----------------------------------------------------------------------------- * Visual extraction of posture and motion features for gesture recognition * Copyright (C) <2004,2008> * Hector Hugo Aviles-Arriaga * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * ---------------------------------------------------------------------------- *//** * ---------------------------------------------------------------------------- * * gestures.h. Headers and variable declaration * * ---------------------------------------------------------------------------- */// constants#define NUM_BINS 32 // Number of histogram bins for each color channel #define SKIN 1#define NON_SKIN 0// fuction headersCvHistogram* alloc_histogram_mem(void);void load_color_model(char file[256], long int *frequency, int type);void face_detection( CvHaarClassifierCascade* face_classifier);void get_face_skin_color(void);void fit(void);void get_torso_color(void);void hand_detection(void);void body_dimensions(void);void hand_tracking(void);void queue_observations(void);void get_pixel_color(int x, int y, unsigned char *color);void back_projection (void);int is_at_init_pos (void);void update_roi_position(void);void draw(void);void record_hand_position(void);// Usagevoid get_options ( int argc, char** argv, char* cascade_name);void usage(char * prog);// variables// OpenCV imagesIplImage *frame; // the current imageIplImage *backproject; // required by Camshift algorithm // color histograms// 32 bins for each RGB color channelCvHistogram *skin_hist = NULL, // general skin color model *non_skin_hist = NULL, // general non-skin color model *torso_hist = NULL, // user's torso color model (personal non-skin color model) *face_hist = NULL, // face color model (personal skin color model) *combined_skin_hist = NULL; // hand color model // rectangular boundaries for the user's body parts // note: face and hand are used as flags in the main loopCvRect *face = NULL, *hand = NULL, torso, expected_hand_pos, // defines where to search the hand for the first time initial_hand_pos, // initial region where the right-hand has been detected the first time roi; // attention window for hand tracking long int num_skin_pixels; // Number of skin pixels sampled off-linelong int num_non_skin_pixels; // Number of non-skin pixels sampled off-line //static double skin_prob; // skin prior probability//static double nskin_prob; // non-skin prior probability char face_classifier_filename[256];char observations_filename[256];/* Variables usadas para observaciones en PLs */// Observation variables// struct to record a single observationtypedef struct observation {// (x,y) coordinate of the center of the face int x_fc; int y_fc;// (x,y) coordinates of the torso rectangle// upper-corner coordinateint x_tu;int y_tu; // lower-corner coordinateint x_tl; int y_tl; // (x,y) coordinates of the segmented hand (rectangle)// upper-corner coordinateint x_hu; int y_hu; // lower-corner coordinateint x_hl; int y_hl; } observation; observation O[1500]; // gesture samplesint T = 0; // number of observations for the current gesturestatic CvMemStorage* face_storage = cvCreateMemStorage(0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -