+++ /dev/null
-/*M///////////////////////////////////////////////////////////////////////////////////////\r
-//\r
-// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
-//\r
-// By downloading, copying, installing or using the software you agree to this license.\r
-// If you do not agree to this license, do not download, install,\r
-// copy or use the software.\r
-//\r
-//\r
-// Intel License Agreement\r
-// For Open Source Computer Vision Library\r
-//\r
-// Copyright (C) 2000, Intel Corporation, all rights reserved.\r
-// Third party copyrights are property of their respective owners.\r
-//\r
-// Redistribution and use in source and binary forms, with or without modification,\r
-// are permitted provided that the following conditions are met:\r
-//\r
-// * Redistribution's of source code must retain the above copyright notice,\r
-// this list of conditions and the following disclaimer.\r
-//\r
-// * Redistribution's in binary form must reproduce the above copyright notice,\r
-// this list of conditions and the following disclaimer in the documentation\r
-// and/or other materials provided with the distribution.\r
-//\r
-// * The name of Intel Corporation may not be used to endorse or promote products\r
-// derived from this software without specific prior written permission.\r
-//\r
-// This software is provided by the copyright holders and contributors "as is" and\r
-// any express or implied warranties, including, but not limited to, the implied\r
-// warranties of merchantability and fitness for a particular purpose are disclaimed.\r
-// In no event shall the Intel Corporation or contributors be liable for any direct,\r
-// indirect, incidental, special, exemplary, or consequential damages\r
-// (including, but not limited to, procurement of substitute goods or services;\r
-// loss of use, data, or profits; or business interruption) however caused\r
-// and on any theory of liability, whether in contract, strict liability,\r
-// or tort (including negligence or otherwise) arising in any way out of\r
-// the use of this software, even if advised of the possibility of such damage.\r
-//\r
-//M*/#if !defined(_GESTURE_RECOGNIZER_H_)\r
-#define _GESTURE_RECOGNIZER_H_\r
-\r
-#if _MSC_VER > 1000\r
-#pragma once\r
-#endif // _MSC_VER > 1000\r
-\r
-#pragma warning(disable:4786)\r
-\r
-\r
-#if defined(GESTREC_EXPORTS)\r
-#define DLL_EXPORT __declspec(dllexport)\r
-#else\r
-#define DLL_EXPORT\r
-#endif\r
-\r
-// FindHandCtl.h : Declaration of the CFindHandCtrl ActiveX Control class.\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// CFindHandCtrl : See FindHandCtl.cpp for implementation.\r
-\r
-#define GR_NOTHING 0\r
-#define GR_TRAIN 1\r
-#define GR_RECOGNIZE 2\r
-#define GR_RESEACH 1\r
-#define GR_LINE\r
-//#define GR_CONTOUR\r
-//#define GR_IMPROVING // improving of the initial hand mask by the using previous result hand mask\r
-\r
-#include "cv.h"\r
-\r
-#include <vector>\r
-using namespace std;\r
-\r
-typedef vector<CvHuMoments> feature_vector;\r
-typedef vector<float> fvector;\r
-typedef struct _gr_pose : public fvector\r
-{\r
- __int64 time;\r
- CvHuMoments pose;\r
-} gr_pose;\r
-\r
-class DLL_EXPORT CFindHandCtrl\r
-{\r
-// Constructor\r
-public:\r
- CFindHandCtrl();\r
- ~CFindHandCtrl();\r
-\r
-// Overrides\r
- // ClassWizard generated virtual function overrides\r
- //{{AFX_VIRTUAL(CFindHandCtrl)\r
- public:\r
-/* virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);*/\r
- //}}AFX_VIRTUAL\r
-\r
-// Implementation\r
-public:\r
-\r
- /* Some user stuff*/\r
- vector<feature_vector> m_features;\r
- feature_vector m_avgs;\r
- vector<string> m_gestureNames;\r
- vector<fvector> m_covMatrices;\r
- vector<bool> m_isCovMatCalculated;\r
- long m_gestureCode;\r
-\r
- vector<IplImage*> m_dgMasks;\r
- vector<gr_pose> m_geomParams;\r
-\r
- long m_minPointCount;\r
- CvPoint3D32f* m_pointCloudBuffer;\r
- long m_pointCount;\r
- long m_handImage;\r
- long m_errNo;\r
- string m_errString;\r
- long m_rawImage;\r
- long m_task;\r
- string m_path;\r
- BOOL m_dynamicGesture;\r
- string m_dGestureName;\r
- string GetGestureName();\r
- void SetGestureName(std::string name);\r
- BOOL m_dynGestureFixed;\r
- BOOL m_saveDynGest;\r
- \r
- long GetGestureCode();\r
- void SetGestureCode(long nNewValue);\r
- long GetRecognizedCode();\r
- void SetRecognizedCode(long nNewValue);\r
- BOOL FitLine();\r
- BOOL FindHand(_int64 _time, BOOL ForCenterOnly);\r
- BOOL LoadGestures(LPCTSTR FileName);\r
- BOOL SaveGestures(LPCTSTR FileName);\r
- void UpdateDynGest();\r
-\r
-public:\r
- CvMemStorage* m_storage;\r
- void StoreDynGesture(IplImage* mask_rez, __int64 _time);\r
- string GetRecognizedName();\r
- string m_recognizedGesture;\r
- int m_segThresh;\r
- int m_trainFrameCount;\r
- IplImage* m_mask;\r
- void ClearGesture(string name);\r
- BOOL IsGestureFixed() {return m_dynGestureFixed; }\r
- void ReleaseFixedGesture() { m_dynGestureFixed = FALSE; ClearDynGest(); }\r
- \r
- void SetTask(long task);\r
- BOOL m_staticGesture;\r
- float m_center[3];\r
- IplImage* m_disparityImage;\r
- IplImage* m_outputImage;\r
- IplImage* m_inputImage;\r
- float m_line[6];\r
- void SetPointBuffer(CvPoint3D32f* buffer);\r
- //int m_dgFrameCount;\r
- BOOL m_dgFrameFound;\r
- BOOL _FindHand(_int64 _time, BOOL ForCenterOnly);\r
- BOOL _RectifyInputMask(BOOL ForCenterOnly);\r
- void CalculateCovarianceMatrix();\r
-\r
- int m_maskImprovigFlag; // flag for the initial mask improving (0 for default) \r
- int m_convexDefCount; // counter of the convexity defects \r
- vector<float> m_DefectsDepth; \r
-\r
-private:\r
- long m_time;\r
- void ClearDynGest();\r
- int m_dgFrameThreshold;\r
- string m_num;\r
- BOOL InitModulePath();\r
- FILE* m_dgHandle;\r
- void SaveDynGestures();\r
-\r
- float* m_linePre;\r
- IplImage* m_maskPre; // pointer to the previous initial hand mask \r
- IplImage* m_resPre; // pointer to the previous result hand mask \r
- \r
- int m_gestureIndex;\r
- string Recognize(IplImage* image);\r
-\r
- string LogClassification(); // logical classification of the static gestures\r
-\r
- long m_recognizedCode;\r
- CvHuMoments CalculateHuMoments(IplImage* image);\r
-};\r
-\r
-//{{AFX_INSERT_LOCATION}}\r
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.\r
-\r
-#endif // !defined(_GESTURE_RECOGNIZER_H_)\r