mm package¶
Subpackages¶
Submodules¶
mm.deprecated module¶
-
mm.deprecated.calcZBuffer(vertexCoord)¶ Assumes that the nose will have smaller z values
-
mm.deprecated.gaussNewton(P, model, target, targetLandmarks, sourceLandmarkInds, NN, jacobi=True, calcId=True)¶ Energy function to be minimized for fitting.
-
mm.deprecated.getTexture(dirName, pose=0)¶ Get the RGB values referenced by the texture vertices in the .obj file for each tester. There are 20 poses to choose from from 0 to 19.
-
mm.deprecated.shBasis(alb, n)¶ - SH basis functions lm
- 1/np.sqrt(4*np.pi) Y00 np.sqrt(3/(4*np.pi))*nz Y10 np.sqrt(3/(4*np.pi))*nx Y11e np.sqrt(3/(4*np.pi))*ny Y11o 1/2*np.sqrt(5/(4*np.pi))*(3*nz^2 - 1) Y20 3*np.sqrt(5/(12*np.pi))*nx*nz Y21e 3*np.sqrt(5/(12*np.pi))*ny*nz Y21o 3/2*np.sqrt(5/(12*np.pi))*(nx^2 - ny^2) Y22e 3*np.sqrt(5/(12*np.pi))*nx*ny Y22o
For a sphere, the Lambertian kernel has most of its energy in the first three bands of the spherical harmonic basis functions (above). This implies that Lambertian reflectance functions can be well-approximated by these low-order SH bases.
-
mm.deprecated.textureCostV(texCoef, x, mask, model, w=(1, 1))¶ Energy formulation for fitting texture
-
mm.deprecated.textureGradV(texCoef, x, mask, model, w=(1, 1))¶ Jacobian for texture energy
-
mm.deprecated.textureLightingCostV(texParam, x, mask, B, model, w=(1, 1), option='tl', constCoef=None)¶ Energy formulation for fitting texture and spherical harmonic lighting coefficients
-
mm.deprecated.textureLightingGradV(texParam, x, mask, B, model, w=(1, 1), option='tl', constCoef=None)¶ Jacobian for texture and spherical harmonic lighting coefficients
mm.models module¶
-
class
mm.models.MeshModel(modelFile, numIdEvecs=80, numExpEvecs=76, numTexEvecs=80)¶ Bases:
objectA 3D Morphable Model class object
Parameters: - modelFile (str) – Filename of .npz file containing 3DMM
- numIdEvecs (int) – Number of the shape identity eigenvectors with the highest eigenvalues from the 3DMM to keep
- numExpEvecs (int) – Number of the shape facial expression eigenvectors with the highest eigenvalues from the 3DMM to keep
- numTexEvecs (int) – Number of the texture eigenvectors with the highest eigenvalues from the 3DMM to keep
-
numId¶ int – number of shape identity eigenvectors
-
numExp¶ int – number of shape facial expression eigenvectors
-
numTex¶ int – number of texture eigenvectors
-
numVertices¶ int – number of vertices in the 3DMM
-
numFaces¶ int – number of triangular faces in the 3DMM
-
face¶ ndarray – array containing the vertex indices for each face, (numFaces, 3)
-
vertex2face¶ ndarray – array containing the face index of each vertex, (numVertices,)
-
idMean¶ ndarray – shape identity mean, (3, numVertices)
-
idEvec¶ ndarray – shape identity eigenvectors, (3, numVertices, numId)
-
idEval¶ ndarray – shape identity eigenvalues, (numId,)
-
expEvec¶ ndarray – shape facial expression eigenvectors, (3, numVertices, numExp)
-
expEval¶ ndarray – shape facial expression eigenvalues, (numExp)
-
texMean¶ ndarray – texture mean, (3, numVertices)
-
texEvec¶ ndarray – texture eigenvectors, (3, numVertices, numTex)
-
texEval¶ ndarray – texture eigenvalues, (numTex,)
-
targetLMInd¶ ndarray – landmark indices for OpenPose
-
sourceLMInd¶ ndarray – vertex indices of the 3DMM that correspond to
targetLMInd