tenfex .h in correct folder

Originally committed to SVN as r40.
This commit is contained in:
tentacle 2006-01-28 20:26:27 +00:00
parent f34775d718
commit 3d0e91c29b
3 changed files with 207 additions and 0 deletions

115
core/FexTracker.h Normal file
View file

@ -0,0 +1,115 @@
// 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 FEXTRACKER_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
// FEXTRACKER_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef FEXTRACKER_EXPORTS
#define FEXTRACKER_API __declspec(dllexport)
#else
#define FEXTRACKER_API __declspec(dllimport)
#endif
class FEXTRACKER_API FexTrackerConfig
{
public:
inline FexTrackerConfig() :
EdgeDetectSigma(1.f),
WindowX(3), WindowY(3),
SearchRange(15),
MaxIterations(10),
MinDeterminant(0.01f),
MinDisplacement(0.1f),
MaxResidue(10.f),
IgnoreLightning(0),
DetectSmoothSigma(0.9f),
MinDistanceSquare(100.f)
{};
int WindowX, WindowY; //static const int window_size = 7;
int SearchRange;
float DetectSmoothSigma; //static const float pyramid_sigma_fact = 0.9f;
float EdgeDetectSigma; //static const float grad_sigma = 1.0f;
int MaxIterations; //static const int max_iterations = 10;
float MinDeterminant; //static const float min_determinant = 0.01f;
float MinDisplacement; //static const float min_displacement = 0.1f;
float MaxResidue; //static const float max_residue = 10.0f;
bool IgnoreLightning; //static const KLT_BOOL lighting_insensitive = FALSE;
float MinDistanceSquare; //static const int mindist = 10;
//static const int min_eigenvalue = 1;
//static const float smooth_sigma_fact = 0.1f;
//static const KLT_BOOL sequentialMode = FALSE;
///* for affine mapping*/
//static const int affineConsistencyCheck = -1;
//static const int affine_window_size = 15;
//static const int affine_max_iterations = 10;
//static const float affine_max_residue = 10.0;
//static const float affine_min_displacement = 0.02f;
//static const float affine_max_displacement_differ = 1.5f;
};
typedef struct{
float x, y;
}vec2;
class FexImgPyramid;
class FexTrackingFeature;
class FEXTRACKER_API FexTracker
{
public:
FexTracker( int sx, int sy, int nFeatures );
~FexTracker();
//config
FexTrackerConfig Cfg;
//work
void ProcessImage( float *Img, bool bFirst=0 ); //we assume grayscale image here
FexTrackingFeature* operator [] ( int i );
inline int GetCount(){ return nFeatures; };
inline int GetFrame(){ return CurFrame; };
bool bDebug;
int minFeatures;
private:
int SizX, SizY;
int PyramidSubsampling;
int PyramidMaxLevels;
FexImgPyramid* CurImg;
FexImgPyramid* NextImg;
void FindFeatures( int minFeatures );
void TrackFeatures();
bool TrackOneFeature( int lvl, vec2 op, vec2& np );
int GetEigenvalueForPoint( int px, int py );
void GetDiffForPointset( int lvl, vec2 op, vec2 np, float* diff );
void GetGradForPointset( int lvl, vec2 op, vec2 np, float* gradx, float* grady );
void CountActiveFeatures();
//result
FexTrackingFeature* lFeatures;
int nFeatures;
int nActiveFeatures;
int mFeatures;
int CurFrame;
};
FEXTRACKER_API void FexBaseResize( float* out, int newx, int newy, float* in, int sizx, int sizy );
FEXTRACKER_API void GaussKernelWidths( float sigma, int *gauss_width, int *gaussderiv_width );
FEXTRACKER_API void GaussEdgeDetect( float* Img, int sizx, int sizy, float sigma, float* GradX, float* GradY );
FEXTRACKER_API void GaussSmooth( float* Img, int sizx, int sizy, float sigma, float* Out );

27
core/FexTrackingFeature.h Normal file
View file

@ -0,0 +1,27 @@
// FexTrackingFeature.h: interface for the FexTrackingFeature class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FEXTRACKINGFEATURE_H__23B42013_9F11_467C_A0F6_F9E647D45CEB__INCLUDED_)
#define AFX_FEXTRACKINGFEATURE_H__23B42013_9F11_467C_A0F6_F9E647D45CEB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "tenlist.h"
class FexTrackingFeature
{
public:
FexTrackingFeature();
~FexTrackingFeature();
int Eigenvalue;
tenlist<vec2> Pos;
int StartTime;
float Influence;
};
#endif // !defined(AFX_FEXTRACKINGFEATURE_H__23B42013_9F11_467C_A0F6_F9E647D45CEB__INCLUDED_)

65
core/tenlist.h Normal file
View file

@ -0,0 +1,65 @@
#pragma once
template< class type >
class tenlist {
public:
int nVal;
int mVal;
type* lVal;
inline tenlist()
{
mVal = 0;
nVal = 0;
lVal = 0;
//zero everything since we well over-zero it anyway
}
inline ~tenlist()
{
free( lVal );
}
inline int size()
{
return nVal;
}
inline void Add( type t )
{
if( nVal+1 >= mVal )
{
mVal += 8;
lVal = (type*)realloc( lVal, sizeof(type)*mVal );
memset( lVal+nVal, 0x00, sizeof(type)*(mVal-nVal) ); //lVal+nVal, since it'll be multiplied by sizeof(type) due to lVal being a type*
}
lVal[nVal++] = t;
}
inline void AddStr( type t )
{
if( nVal+1 >= mVal )
{
mVal += 8;
lVal = (type*)realloc( lVal, sizeof(type)*mVal );
memset( lVal+nVal, 0x00, sizeof(type)*(mVal-nVal) ); //lVal+nVal, since it'll be multiplied by sizeof(type) due to lVal being a type*
}
strcpy( lVal[nVal++], t );
}
inline void Rem( int n )
{
if( n>=nVal )
{
nVal = 0;
return;
}
for( int i=0;i<nVal;i++ )
{
lVal[i] = lVal[i+n];
}
}
type& operator[]( int i ) const
{ return lVal[i]; }
};