classicdesc.h
1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// classicdesc.h: model for classic ASM descriptors
//
// Copyright (C) 2005-2013, Stephen Milborrow
#ifndef STASM_CLASSICDESC_H
#define STASM_CLASSICDESC_H
#include "stasmhash.h"
namespace stasm
{
static const int CLASSIC_MAX_OFFSET = 2; // search +-2 pixels along the whisker
static const int CLASSIC_SEARCH_RESOL = 2; // search resolution, every 2nd pix
extern void ClassicDescSearch( // search along whisker for best profile match
double& x, // io: (in: current posn of the point, out: new posn)
double& y, // io:
const Image& img, // in: the image scaled to this pyramid level
const Shape& inshape, // in: current posn of landmarks (for whisker directions)
int ipoint, // in: index of the current landmark
const MAT& meanprof, // in: mean of the training profiles for this point
const MAT& covi); // in: inverse of the covar of the training profiles
class ClassicDescMod: public BaseDescMod
{
public:
virtual void DescSearch_(double& x, double& y, // io
const Image& img, const Shape& shape, // in
int, int ipoint, const Hat &hat, StasmHash &hash) const // in
{
(void) hat;
(void) hash;
ClassicDescSearch(x, y, img, shape, ipoint, meanprof_, covi_);
}
ClassicDescMod( // constructor
int profwidth,
const double* const meanprof_data,
const double* const covi_data)
: meanprof_(ArrayAsMat(1, profwidth, meanprof_data)),
covi_(ArrayAsMat(profwidth, profwidth, covi_data))
{
}
private:
const MAT meanprof_; // mean of the training profiles for this point
const MAT covi_; // inverse of the covariance of the training profiles
DISALLOW_COPY_AND_ASSIGN(ClassicDescMod);
}; // end class ClassicDescMod
} // namespace stasm
#endif // STASM_CLASSICDESC_H