-
Notifications
You must be signed in to change notification settings - Fork 68
/
Facebase.h
66 lines (52 loc) · 1.84 KB
/
Facebase.h
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
58
59
60
61
62
63
64
65
66
/* Copyright (C) 2016 Kristian Sloth Lauszus. All rights reserved.
This software may be distributed and modified under the terms of the GNU
General Public License version 2 (GPL2) as published by the Free Software
Foundation and appearing in the file GPL2.TXT included in the packaging of
this file. Please note that GPL2 Section 2[b] requires that all works based
on this software must also be made publicly available under the terms of
the GPL2 ("Copyleft").
Contact information
-------------------
Kristian Sloth Lauszus
Web : http://www.lauszus.com
e-mail : [email protected]
*/
#ifndef __facebase_h__
#define __facebase_h__
#include <Eigen/Dense> // http://eigen.tuxfamily.org
#include "PCA.h"
using namespace Eigen;
class Facebase : public PCA {
public:
/**
* Project X onto subspace.
* @param X Input image.
* @return Returns the weight matrix.
*/
MatrixXf project(const MatrixXi &X);
/**
* Calculate distance between weight and the weights for the current method used.
* @param W Weights calculated by projecting images onto subspace.
* @return Return a vector containing all distances.
*/
VectorXf euclideanDist(const VectorXf &W);
/**
* Reconstruct a face from a weight.
* @param W Weight calculated by projecting image onto subspace.
* @return Returns the face vector.
*/
VectorXf reconstructFace(const VectorXf &W);
/**
* Calculate the distance to the face subspace.
* @param X Input image.
* @param face Face vector.
* @return Returns the distance to the face subspace.
*/
float euclideanDistFace(const VectorXi &X, const VectorXf &face);
MatrixXf V; // Eigenvector
int32_t numComponents; // Number of components
protected:
MatrixXf W_all; // Total weights
size_t n_pixels;
};
#endif