Sigma.at<float>(i,i)=1.0f/std::sqrt(sigma_squared_2D);// the higher the sigma_squared_2D, the smaller the diagonal entries of Sigma will be
// Sigma(i, i) = sqrt(sigma_squared_2D), but then Omega is Sigma.t() * Sigma (squares the diagonal) - so we just assign 1/sigma_squared_2D to Omega here:
Omega.at<float>(i,i)=1.0f/sigma_squared_2D;// the higher the sigma_squared_2D, the smaller the diagonal entries of Sigma will be
}
MatOmega=Sigma.t()*Sigma;// just squares the diagonal
// The landmarks in matrix notation (in homogeneous coordinates), $3N\times 1$
assert(shape.rows==color.rows||color.empty());// The number of vertices (= model.getDataDimension() / 3) has to be equal for both models, or, alternatively, it has to be a shape-only model.
assert(shape_instance.rows==color_instance.rows||color_instance.empty());// The number of vertices (= model.getDataDimension() / 3) has to be equal for both models, or, alternatively, it has to be a shape-only model.
// Assign the vertex colour information if it's not a shape-only model:
if(!color.empty()){
if(!color_instance.empty()){
mesh.colors.resize(num_vertices);
for(autoi=0;i<num_vertices;++i){
mesh.colors[i]=glm::tvec3<float>(color.at<float>(i*3+0),color.at<float>(i*3+1),color.at<float>(i*3+2));// order in hdf5: RGB. Order in OCV: BGR. But order in vertex.color: RGB
mesh.colors[i]=glm::tvec3<float>(color_instance.at<float>(i*3+0),color_instance.at<float>(i*3+1),color_instance.at<float>(i*3+2));// order in hdf5: RGB. Order in OCV: BGR. But order in vertex.color: RGB