void Optimizer::ShowSegmentPoints(InputPtr input, ModelPtr model, Parameter* para) const { int num = 0; model->EnableIterator(ModelImage::NOSE); num = model->Size(ModelImage::NOSE); for (int i = 0; i < num; ++i) { ivec2 pos = para->ComputePosition(i); vec3 rgb = para->ComputeColor(i); //vec3 rgb = input_image->GetColor(Point(pos[0], pos[1])); //Vec3b color(static_cast<uchar>(rgb[2]), static_cast<uchar>(rgb[1]), static_cast<uchar>(rgb[0])); Vec3b color(0, 0, 255); model->WriteColor(pos[0], pos[1], color); } model->EnableIterator(ModelImage::EYE); num = model->Size(ModelImage::EYE); for (int i = 0; i < num; ++i) { ivec2 pos = para->ComputePosition(i); vec3 rgb = para->ComputeColor(i); //vec3 rgb = input_image->GetColor(Point(pos[0], pos[1])); //Vec3b color(static_cast<uchar>(rgb[2]), static_cast<uchar>(rgb[1]), static_cast<uchar>(rgb[0])); Vec3b color(0, 255, 0); model->WriteColor(pos[0], pos[1], color); } model->EnableIterator(ModelImage::MOUTH); num = model->Size(ModelImage::MOUTH); for (int i = 0; i < num; ++i) { ivec2 pos = para->ComputePosition(i); vec3 rgb = para->ComputeColor(i); //vec3 rgb = input_image->GetColor(Point(pos[0], pos[1])); //Vec3b color(static_cast<uchar>(rgb[2]), static_cast<uchar>(rgb[1]), static_cast<uchar>(rgb[0])); Vec3b color(0, 255, 255); model->WriteColor(pos[0], pos[1], color); } model->EnableIterator(ModelImage::REST); num = model->Size(ModelImage::REST); for (int i = 0; i < num; ++i) { ivec2 pos = para->ComputePosition(i); vec3 rgb = para->ComputeColor(i); //vec3 rgb = input_image->GetColor(Point(pos[0], pos[1])); //Vec3b color(static_cast<uchar>(rgb[2]), static_cast<uchar>(rgb[1]), static_cast<uchar>(rgb[0])); Vec3b color(255, 0, 0); model->WriteColor(pos[0], pos[1], color); } }
void Optimizer::ShowVisiblePoints(InputPtr input, ModelPtr model, Parameter* para) const { int num = model->Size(); for (int i = 0; i<num;++i) { ivec2 pos = para->ComputePosition(i); vec3 rgb = para->ComputeColor(i); //vec3 rgb = input_image->GetColor(Point(pos[0], pos[1])); //Vec3b color(static_cast<uchar>(rgb[2]), static_cast<uchar>(rgb[1]), static_cast<uchar>(rgb[0])); Vec3b color(0, 0, 255); model->WriteColor(pos[0], pos[1], color); } cout << "visible triangle number = " << num << endl; }
void Optimizer::ShowRandomPoints(InputPtr input, ModelPtr model, Parameter* para) const { int num = random_points_.size(); for (int t = 0; t < num; ++t) { int id = random_points_[t]; ivec2 pos = para->ComputePosition(id); //vec3 rgb = input_image->GetColor(Point(pos[0], pos[1])); //Vec3b color(static_cast<uchar>(rgb[2]), static_cast<uchar>(rgb[1]), static_cast<uchar>(rgb[0])); Vec3b color(0, 0, 0); model->WriteColor(pos[0], pos[1], color); } }
void Optimizer::ShowShadowPoints(InputPtr input, ModelPtr model, Parameter* para) const { int num = model->Size(); int shadow_counter = 0; for (int i = 0; i< num; ++i) { if (model->visible_triangles_[i].cast_shadow) { ++shadow_counter; ivec2 pos = para->ComputePosition(i); vec3 rgb = para->ComputeColor(i); //vec3 rgb = input_image->GetColor(Point(pos[0], pos[1])); // Vec3b color(static_cast<uchar>(rgb[2]), static_cast<uchar>(rgb[1]), static_cast<uchar>(rgb[0])); Vec3b color(0, 0, 255); model->WriteColor(pos[0], pos[1], color); } } cout << "shadow triangle number = " << shadow_counter << endl; }