v2_ test_lab setup
[The-Artvertiser.git] / garfeild / lightcalib / lightcollector.h
blobaff307d12638431c5fbb3173d6be7ae7890f0d8f
1 #ifndef _LIGHTCOLLECTOR_H
2 #define _LIGHTCOLLECTOR_H
4 #include <cv.h>
6 class LightMap;
8 /*!
9 * \ingroup photocalib
10 * Collects lighting clues. This class apply an homography to a planar mesh and
11 * average colors within triangles. The LightMap class can use these measures
12 * to estimate a radiance map.
14 class LightCollector {
15 public:
16 LightCollector();
17 LightCollector(const LightCollector &lc);
18 ~LightCollector();
19 const LightCollector &operator=(LightCollector &lc);
20 void copy(const LightCollector &lc);
22 //! Generate a regular grid given its 4 corners.
23 bool genGrid(float corners[4][2], int nx, int ny);
25 void averageImage(IplImage *im, CvMat *_homography);
27 int serializeSize();
28 void serialize(char *buffer);
29 void load(const char *buffer, int size);
30 void invalidate();
32 // for debugging
33 void drawGrid(IplImage *im, CvMat *_homography);
34 void drawAvg(IplImage *im);
36 CvMat *worldRT;
38 bool cmpWithRef(const LightCollector &ref, float *val, const float *scale=0, const float *shift=0);
40 //friend LightMap;
41 //private:
42 float *avg;
43 CvMat *vertices, *transformed;
44 int *triangles;
45 int nbTri;
46 int nx, ny;
47 int avgChannels;
48 int nbPix;
51 #endif