JD2022-TU1/main/extern/Camcam/DLLInc/HeadDetector.h

89 lines
No EOL
2.3 KiB
C++

// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the HEADDETECTOR_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// HEADDETECTOR_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifndef ___HEADDETECT_H___
#define ___HEADDETECT_H___
//#define HEADDETECTOR_DLL_MODE
#ifdef HEADDETECTOR_DLL_MODE
#ifdef HEADDETECTOR_EXPORTS
#define HEADDETECTOR_API __declspec(dllexport)
#else
#define HEADDETECTOR_API __declspec(dllimport)
#endif
#else
#define HEADDETECTOR_API
#endif
/***********************************************/
/******* Need Math Library *********************/
#include "CCMath.h"
/******* Need MAP Library *********************/
#include "CCMap.h"
typedef struct MAP8_Quad_
{
float X1,Y1,X2,Y2,W;
u32 Age;
float Angle;
} MAP8_Quad;
typedef struct DETECTEDFace_
{
unsigned int DeadTime;
MAP8_Quad BaseHead;
Vector HeadPos; // X,Y,Angle;
Vector HeadSize; // SX,SY;
Vector RightEye; // X,Y,Validated != 0;
Vector LeftEye; // X,Y,Validated != 0;
Vector Nose; // X,Y,Validated != 0;
Vector RightMouse; // X,Y,Validated != 0;
Vector LeftMouse; // X,Y,Validated != 0;
Vector UpMouse; // X,Y,Validated != 0;
Vector DownMouse; // X,Y,Validated != 0;
} DETECTEDFace;
#define MAX_HEAD_DETECTED 16
#define MAX_MAP8_QUAD 128
// This class is exported from the HeadDetector.dll
class HEADDETECTOR_API HeadDetector {
public:
HeadDetector(void);
int ProcessImage(MAP *pImg);
void SetDrawImage(MAP *pImgDraw);
void CopyAsync();
u32 GetNumberOfFace();
void DrawDetectedFaces(u32 Enable);
u32 GetFace(u32 INdex, Vector *Center,Vector *Size);
u32 GetFaceFeature(u32 i, u32 FeatureIndexn, Vector *Center);
private:
MAP *pSrc;
MAP *pSrcDRAW;
u32 HeadTrackerRequested;
u32 HeadTrackerRequested_DRAW;
struct HAAR_Classifier_ *pHFF;
struct HAAR_Classifier_ *pHFFOptimized;
MAP8_Quad MAP8_QuadStack[MAX_MAP8_QUAD +1 ];
u32 MAP8_QuadStackNumber;
DETECTEDFace ASM_AllDF[MAX_HEAD_DETECTED];
DETECTEDFace ASYNC_ASM_AllDF[MAX_HEAD_DETECTED];
u32 ASYNC_ulNumberOfHeads;
u32 ulNumberOfHeads;
u32 ulOldNumberOfHeads;
};
#endif