-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathFHOG.hpp
49 lines (38 loc) · 1.37 KB
/
FHOG.hpp
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
/*
C++ Felzenszwalb HOG extractor
This repository is meant to provide an easy-to-use implementation of the Felzenszwalb HOG features extractor.
This approach followed the one presented by Felzenszwalb, Pedro F., et al. "Object detection with discriminatively trained part-based models." Pattern Analysis and Machine Intelligence, IEEE Transactions on 32.9 (2010): 1627-1645.
The OpenCV library have only the original HOG, proposed by Dalal and Triggs. However, the Latent SVM OpenCV implementation have its own FHOG extractor. This code allows you to use it without having do deal with Latent SVM objects.
To run the code you need OpenCV library.
Author: Joao Faro
Contacts: joaopfaro@gmail.com
*/
#ifndef FHOG_H
#define FHOG_H
#include <opencv2/opencv.hpp>
typedef struct{
int sizeX;
int sizeY;
int numFeatures;
float *map;
} CvLSVMFeatureMap;
int getFeatureMaps(const IplImage*, const int , CvLSVMFeatureMap **);
int normalizeAndTruncate(CvLSVMFeatureMap *, const float );
int PCAFeatureMaps(CvLSVMFeatureMap *);
int freeFeatureMapObject (CvLSVMFeatureMap **);
class HogFeature {
public:
HogFeature();
HogFeature(uint, uint);
virtual ~HogFeature();
virtual HogFeature* clone() const;
virtual cv::Mat getFeature(cv::Mat);
private:
uint _cell_size;
uint _scale;
cv::Size _tmpl_sz;
cv::Mat _featuresMap;
cv::Mat _featurePaddingMat;
CvLSVMFeatureMap *_map;
};
#endif