forked from andrewrong/FaceDect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntImage.h
More file actions
47 lines (41 loc) · 1.29 KB
/
IntImage.h
File metadata and controls
47 lines (41 loc) · 1.29 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
#ifndef IMAGE_H
#define IMAGE_H
#define USE_DOUBLE
#ifdef USE_DOUBLE
typedef double REAL;
#else
typedef float REAL;
#endif
#include <assert.h>
#include <string>
#include "MyStruct.h"
#include "ocv.h"
#define ASSERT(p) assert(p)
class IntImage
{
public:
IntImage();
~IntImage();
void Clear(void);
void SetSize(const MSize size);
IntImage& operator=(const IntImage& source);
void CalcSquareAndIntegral(IntImage& square,IntImage& image) const;
void CalculateVarianceAndIntegralImageInPlace(void);
void Resize(IntImage &result, REAL ratio) const;
void Copy(const IntImage& source);
void Load(const std::string& filename);
void IplImageToIntImage(IplImage* img);
void Save(const std::string& filename) const;
IplImage* IntImageToIplImage() const;
public:
int height; // height, or, number of rows of the image
int width; // width, or, number of columns of the image
REAL** data; // auxiliary pointers to accelerate the read/write of the image
// no memory is really allocated, use memory in (buf)
// data[i][j] is a pixel's gray value in (i)th row and (j)th column
REAL* buf; // pointer to a block of continuous memory containing the image
REAL variance;
int label;
};
void SwapIntImage(IntImage& i1,IntImage& i2);
#endif