PedestrainCounting
HoGIntegralImage.h
1 
6 #ifndef HOG_INTEGRAL_IMAGE_HEADER
7 #define HOG_INTEGRAL_IMAGE_HEADER
8 
9 #define NUM_HOG_BINS 9
10 
11 #include "IntegralImage.h"
12 
14 public:
15  // img should be CV_8UC1.
16  HoGIntegralImage(const cv::Mat &img);
17  HoGIntegralImage(int w, int h);
19 
20  // Calculate the integral image.
21  // Should be called if the img changed.
22  virtual void CalculateInt(const cv::Mat &img);
23 
24  virtual void Dump(const char *filename) const;
25 
26  virtual void GetSum(const Rect &roi, float *result) const;
27 
28 private:
29  // Data.
30  float *intImage;
31 
32  // Step.
33  int m_step;
34 
35  static const float xVector[9];
36  static const float yVector[9];
37 
38  // Some helper function.
39  inline int Direct(float x, float y) {
40  float max = 0.0;
41  int ret = 0;
42 
43  // Try to avoid float problem.
44  if (y == 0.0f)
45  y = 0.01f;
46  for (int i = 0; i < 9; i++) {
47  float proj = fabsf(x * xVector[i] + y * yVector[i]);
48  if (proj > max) {
49  max = proj;
50  ret = i;
51  }
52  }
53  return ret;
54  }
55 };
56 
57 #endif
58 
Definition: Geometry.h:34
Definition: HoGIntegralImage.h:13
Definition: IntegralImage.h:11