Skip to content

Commit 7c01bca

Browse files
committed
Introduce regularization for global seam leveling nmoehrle#63
1 parent 4fb2414 commit 7c01bca

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libs/tex/global_seam_leveling.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,13 @@ global_seam_leveling(UniGraph const & graph, mve::TriangleMesh::ConstPtr mesh,
240240
SpMat A(A_rows, x_rows);
241241
A.setFromTriplets(coefficients_A.begin(), coefficients_A.end());
242242

243-
SpMat Lhs = A.transpose() * A + Gamma.transpose() * Gamma;
244-
/* Only keep lower triangle (CG only uses the lower), prune the rest and compress matrix. */
243+
SpMat I(x_rows, x_rows);
244+
I.setIdentity();
245+
246+
SpMat Lhs = A.transpose() * A + Gamma.transpose() * Gamma + I * 0.0001f;
247+
248+
/* Only keep lower triangle (CG only uses the lower),
249+
* prune the rest and compress matrix. */
245250
Lhs.prune([](const int& row, const int& col, const float& value) -> bool {
246251
return col <= row && value != 0.0f;
247252
}); // value != 0.0f is only to suppress a compiler warning

0 commit comments

Comments
 (0)