Skip to content

Commit bc8b261

Browse files
committed
relative light bug fixed
1 parent 91d30ae commit bc8b261

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

relight/normalstask.cpp

+7-9
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void NormalsWorker::solveL2()
194194
mPixel(m, 0) = m_Row[p][m].mean();
195195

196196
if(m_Imageset.light3d) {
197-
for(size_t i = 0; i < m_Lights.size(); i++) {
197+
for(size_t i = 0; i < m_Lights3d.size(); i++) {
198198
Vector3f light = m_Imageset.relativeLight(m_Lights3d[i], p, row);
199199
light.normalize();
200200
for (int j = 0; j < 3; j++)
@@ -203,17 +203,15 @@ void NormalsWorker::solveL2()
203203
}
204204

205205

206-
// Solve
207-
mNormals = (mLights.transpose() * mLights).ldlt().solve(mLights.transpose() * mPixel);
208-
mNormals.col(0).normalize();
209206

210-
// Save
211-
m_Normals[normalIdx+0] = mNormals(0,0);
212-
m_Normals[normalIdx+1] = mNormals(1,0);
213-
m_Normals[normalIdx+2] = mNormals(2,0);
207+
mNormals = (mLights.transpose() * mLights).ldlt().solve(mLights.transpose() * mPixel);
208+
mNormals.col(0).normalize();
209+
m_Normals[normalIdx+0] = mNormals(0,0);
210+
m_Normals[normalIdx+1] = mNormals(1,0);
211+
m_Normals[normalIdx+2] = mNormals(2,0);
214212

215213
normalIdx += 3;
216-
}
214+
}
217215
}
218216

219217
void NormalsWorker::solveSBL()

src/imageset.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ Vector3f ImageSet::relativeLight(const Vector3f &light3d, int x, int y){
277277
//relative position to the center in cm
278278
float dx = image_width_cm*(x - image_width/2.0f)/image_width;
279279
float dy = image_width_cm*(y - image_height/2.0f)/image_width;
280-
l[0] -= dx;
281-
l[1] -= dy;
280+
l[0] -= dx/2;
281+
l[1] -= dy/2;
282282
l[2] += vertical_offset;
283283
return l;
284284
}

src/project.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ void Project::computeDirections() {
533533
v = v.rotate(axis, angle);
534534

535535
if(dome.domeDiameter) {
536-
//find intersection between direAlignctions and sphere.
536+
//find intersection between directions and sphere.
537537
for(size_t i = 0; i < sphere->directions.size(); i++) {
538538
Vector3f &direction = sphere->directions[i];
539539
direction.normalize();

0 commit comments

Comments
 (0)