【OpenCV学习】HandVu API分析

作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/

HandVu是UCSB的Mathias Kolsch, matz@cs.ucsb.edu所写的一个开源计算机视觉库,它以C++为基本实现语言,以OpenCV为图像处理和部分算法实现的基础,并以C语言的形式将接口呈现了出来以方便Linux C程序员。一下是对这个接口的注释型分析:
typedef struct _hvState {
  int        obj_id;//fixed to a value of zero,indentify the right hand.
  /* whether the object is successfully tracked and whether one of the key postures was recognized */
  bool       tracked;
  bool       recognized;
  /* The location of the tracked object is reported in relative image coordinates,the image origin is in the left upper corner of the image */
  double     center_xpos, center_ypos;//The location of the result of tracking
  double     scale;
  string     posture;//posture that is recognized
  RefTime    tstamp;//time stamp
} hvState;
/*finite state machines  */
enum hvAction {         // specify recommendations to application:
  HV_INVALID_ACTION = 0,// Invalid Action
  HV_PROCESS_FRAME = 1, // fully process and display the frame
  HV_SKIP_FRAME = 2,    // display but do not further process
  HV_DROP_FRAME = 3     // do not display the frame
};
/*Initialize or Uninitialize the interface  */
void hvInitialize(int width, int height);
void hvUninitialize();
/* Load the config file or judge whether or not it is loaded correctly*/
void hvLoadConductor(const string& filename);
bool hvConductorLoaded();
/* start or stop recongnition,default obj_id is 0 (indicates the right hand) */
void hvStartRecognition(int obj_id=0);
void hvStopRecognition(int obj_id=0);
/* Process the frame,the type IplImage is belong to the OpenCV library */
hvAction hvProcessFrame(IplImage* inOutImage, IplImage* rightImage=NULL);
bool hvIsActive();//Judge whether the hv is active
/* Asynchronize method of processing the frame */
void hvAsyncSetup(int num_buffers, void (*cb)(IplImage* img, hvAction action));
void hvAsyncGetImageBuffer(IplImage** pImage, int* pBufferID);
void hvAsyncProcessFrame(int bufferID);
/* Get the State of the hand which is being tracked */
void hvGetState(int obj_id, hvState& state);
/* set the area of the hand being detected */
void hvSetDetectionArea(int left, int top, int right, int bottom);
/* Get the area of the hand being detected */
void hvGetDetectionArea(int* pLeft, int* pTop, int* pRight, int* pBottom);
/* recompute the latency of normal */
void hvRecomputeNormalLatency();
/* Set or Get the amount and verbosity of the overlay */
/* Please refer to the page 90 of the paper  */
void hvSetOverlayLevel(int level);
int hvGetOverlayLevel();
/* some operation on correcting the distortion of camrea .
* This operation takes a considerable amount of time */
void hvCorrectDistortion(bool enable=true);
bool hvIsCorrectingDistortion();
bool hvCanCorrectDistortion();
/* some operation on adjusting the exposure of camrea .
For the exposure adjustment to be possible(turned on via SetAdjustExposure),
HandVu must have been initialized with the CameraController!=NULL.*/
void hvSetAdjustExposure(bool enable=true);
bool hvCanAdjustExposure();
bool hvIsAdjustingExposure();
/* Set the log file */
void hvSetLogfile(const string& filename);
/* Save the related picture  */
void hvSaveScannedArea(IplImage* pImg, string& picfile);
void hvSaveImageArea(IplImage* pImg, int left, int top, int right, int bottom, string& picfile);
void hvSetSaveFilenameRoot(const string& fname_root);
void hvSetDoTrack(bool do_track);
/* Set or Start the Open Sound Control (OSC) Server or Gesture Server defined by the author */
/* For Open Sound Control (OSC), Please refer to the page 93 of the paper */
/* For the Gesture Server, Please erfer to the page 94 of the paper */
void hvStartGestureServer(int port, int max_num_clients=10);
void hvStartOSCServer(const string& desthost, int destport);
void hvStopGestureServer(int port);
void hvStopOSCServer(const string& desthost, int destport);
/** verbosity: 0 minimal, 3 maximal
*/
void hvGetVersion(string& version, int verbosity);

作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/

posted @ 2012-12-07 13:47  gnuhpc  阅读(1662)  评论(0编辑  收藏  举报