bazar
1.3.1
Main Page
Modules
Classes
Files
Examples
File List
File Members
garfeild
lightcalib
lightmap.h
Go to the documentation of this file.
1
#ifndef _LIGHTMAP_H
2
#define _LIGHTMAP_H
3
4
#include <vector>
5
#include <
math/growmat.h
>
6
#include "
lightcollector.h
"
7
8
//also includes opengl
9
#include "
ipltexture.h
"
10
42
class
LightMap
{
43
public
:
44
LightMap
();
45
~LightMap
();
46
LightMap
(
const
LightMap
&a);
47
48
bool
init
(
int
nbCam, IplImage *model,
float
corners[4][2],
int
nx,
int
ny);
49
void
setCamNum
(
int
n);
50
51
bool
initGL
();
52
void
enableShader
(
int
cam, CvMat *obj2world);
53
void
disableShader
();
54
55
bool
load
(
const
char
*lightParamsFN=
"lightParams.mat"
,
const
char
*normalsFN=
"normals.mat"
);
56
bool
save
(
const
char
*lightParamsFN=
"lightParams.mat"
,
const
char
*normalsFN=
"normals.mat"
);
57
59
bool
addNormal
(
float
normal[3],
LightCollector
&lc,
int
cam);
60
62
bool
addNormalCalib
(
float
normal[3],
LightCollector
&lc,
int
cam);
63
65
bool
addNormalLightMap
(
float
normal[3],
LightCollector
&lc,
int
cam);
66
70
bool
computeLightParams
();
71
73
bool
isReady
() {
return
lightParams!=0; }
74
76
IplTexture
map
;
77
78
LightCollector
reflc
;
79
80
bool
saveImage
(
const
char
*filename);
81
83
const
float
*
getGain
(
int
cam);
85
const
float
*
getBias
(
int
cam);
86
88
CvScalar
readMap
(
const
float
normal[3]);
89
91
int
nbNormals
()
const
{
return
normals->rows; }
92
93
private
:
94
void
normal2uv(
const
float
n[3],
float
uv[2]);
95
void
uv2normal(
const
float
uv[2],
float
n[3]);
96
bool
updateLightMap(
float
n[3],
float
*val);
97
double
getObsMat(
int
i,
int
j,
int
c);
98
99
void
buildMapFromSamples();
100
101
// (g, b) for each cam, x for each frame
102
struct
Observation {
103
int
camCol;
104
float
camVal[3];
105
int
normalCol;
106
float
normalVal[3];
107
};
108
static
double
getObsElem(
const
std::vector<Observation>::iterator &it,
int
i,
int
c);
109
void
computeAtA(CvMat *AtA,
int
channel);
110
111
std::vector<Observation> obs;
112
CvMat *lightParams;
113
CvGrowMat
*normals;
114
int
nbCam;
115
116
bool
ARB;
117
bool
initialized;
118
unsigned
int
g_vertShader, g_fragShader, g_shaderProgram;
119
};
120
121
#endif
Generated on Tue Jan 15 2013 12:50:21 for bazar by
1.8.1.2