assert(shape_model.get_data_dimension()==color_model.get_data_dimension());// The number of vertices (= model.getDataDimension() / 3) has to be equal for both models.
assert(shape_model.get_data_dimension()==color_model.get_data_dimension()||!has_color_model());// The number of vertices (= model.getDataDimension() / 3) has to be equal for both models, or, alternatively, it has to be a shape-only model.
cv::Matshape_sample;
cv::Matshape_sample;
cv::Matcolor_sample;
cv::Matcolor_sample;
...
@@ -178,6 +180,19 @@ public:
...
@@ -178,6 +180,19 @@ public:
returnmesh;
returnmesh;
};
};
/**
* Returns true if this Morphable Model contains a colour
* model. Returns false if it is a shape-only model.
*
* @return True if the Morphable Model has a colour model (i.e. is not a shape-only model).
assert(shape.rows==color.rows);// The number of vertices (= model.getDataDimension() / 3) has to be equal for both models.
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.
autonum_vertices=shape.rows/3;
autonum_vertices=shape.rows/3;
eos::render::Meshmesh;
eos::render::Meshmesh;
// Construct the mesh vertices and vertex color information:
// Assign the vertex color information if it's not a shape-only model:
if(!color.empty()){
mesh.colors.resize(num_vertices);
for(autoi=0;i<num_vertices;++i){
mesh.colors[i]=cv::Vec3f(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]=cv::Vec3f(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