Skip to content

Commit

Permalink
Introduce regularization for global seam leveling nmoehrle#63
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoehrle authored and npcasler committed Aug 14, 2019
1 parent 38eca58 commit 9efe252
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libs/tex/global_seam_leveling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,13 @@ global_seam_leveling(UniGraph const & graph, mve::TriangleMesh::ConstPtr mesh,
SpMat A(A_rows, x_rows);
A.setFromTriplets(coefficients_A.begin(), coefficients_A.end());

SpMat Lhs = A.transpose() * A + Gamma.transpose() * Gamma;
/* Only keep lower triangle (CG only uses the lower), prune the rest and compress matrix. */
SpMat I(x_rows, x_rows);
I.setIdentity();

SpMat Lhs = A.transpose() * A + Gamma.transpose() * Gamma + I * 0.0001f;

/* Only keep lower triangle (CG only uses the lower),
* prune the rest and compress matrix. */
Lhs.prune([](const int& row, const int& col, const float& value) -> bool {
return col <= row && value != 0.0f;
}); // value != 0.0f is only to suppress a compiler warning
Expand Down

0 comments on commit 9efe252

Please sign in to comment.