ShapeGradientDomain: [SGP 2009]
This code performs gradient domain processing on signals defined on a mesh, where the signal can be either a color-field represented as a color per vertex or is the position of the vertices themselves..
The code supports both sharpening and smoothing of the signals through the solution of a screened-Poisson equation.
Specifically, given an input signal F, it solves for the signal G minimizing:
E(G) = α⋅||F-G||2 + ||β⋅∇F - ∇G||2
where α is the value-fitting weight, and β is the gradient scale factor.
The code supports inhomogenous processing by allowing the user to replace the Riemannian metric, g, given by the embedding, with a metric that adjusts to the curvature of the surface in two ways.
The curvature is estimated using the surface normals. If none are provided, the vertex normals are estimated as the area-weighted sum of adjacent triangle normals.
- Anisotropic Processing: Given orthonormal principal curvature directions, the (idenity) metric is replaced with:
Id. + ε⋅Κ2
where Id. is the identity matrix and Κ2 is the diagonal matrix whose entries are the squares of the principal curature values and ε is the curvature weight.
- Isotropic Processing: Given orthonormal principal curvature directions, the (identity) metric is replaced with:
( 1 + ε⋅tr(Κ2)/2)⋅Id.
where tr(Κ2) is the total curvature (the sum of the squares of the principal curvatures) and ε is the curvature weight.