Handle empty dirichlet mask filename.

This commit is contained in:
Timo Menzel 2023-09-14 11:46:06 +02:00
parent 8198416488
commit b566dffd6a
1 changed files with 19 additions and 5 deletions

View File

@ -30,7 +30,10 @@ int main (int argc, char** argv)
mesh.read(argv[1]); mesh.read(argv[1]);
std::cout << "Compute PIE" << std::endl; std::cout << "Compute PIE" << std::endl;
if(argc == 6)
start_texture_merge_pie(argv[2], argv[3], argv[4], argv[5], mesh); start_texture_merge_pie(argv[2], argv[3], argv[4], argv[5], mesh);
else if (argc == 5)
start_texture_merge_pie(argv[2], argv[3], argv[4], "", mesh);
std::cout << "Write result" << std::endl; std::cout << "Write result" << std::endl;
} }
@ -49,8 +52,14 @@ start_texture_merge_pie(std::string src_fn,
cv::Mat dst = cv::imread(dst_fn, cv::IMREAD_COLOR); cv::Mat dst = cv::imread(dst_fn, cv::IMREAD_COLOR);
std::cout << "Load " << mask_fn << std::endl; std::cout << "Load " << mask_fn << std::endl;
cv::Mat mask = cv::imread(mask_fn, cv::IMREAD_GRAYSCALE); cv::Mat mask = cv::imread(mask_fn, cv::IMREAD_GRAYSCALE);
cv::Mat dirichlet_mask;
if (!dirichlet_mask_fn.empty()) {
std::cout << "Load " << dirichlet_mask_fn << std::endl; std::cout << "Load " << dirichlet_mask_fn << std::endl;
cv::Mat dirichlet_mask = cv::imread(dirichlet_mask_fn, cv::IMREAD_GRAYSCALE); dirichlet_mask = cv::imread(dirichlet_mask_fn, cv::IMREAD_GRAYSCALE);
} else {
std::cout << "No dirichlet mask specified " << std::endl;
}
std::cout << "Save " << src_fn << std::endl; std::cout << "Save " << src_fn << std::endl;
cv::imwrite("src.jpg", src); cv::imwrite("src.jpg", src);
@ -58,8 +67,13 @@ start_texture_merge_pie(std::string src_fn,
cv::imwrite("dst.jpg", dst); cv::imwrite("dst.jpg", dst);
std::cout << "Save " << mask_fn << std::endl; std::cout << "Save " << mask_fn << std::endl;
cv::imwrite("mask.jpg", mask); cv::imwrite("mask.jpg", mask);
if (!dirichlet_mask_fn.empty()) {
dirichlet_mask = cv::imread(dirichlet_mask_fn, cv::IMREAD_GRAYSCALE);
std::cout << "Save " << dirichlet_mask_fn << std::endl; std::cout << "Save " << dirichlet_mask_fn << std::endl;
cv::imwrite("dirichlet_mask.jpg", dirichlet_mask); cv::imwrite("dirichlet_mask.jpg", dirichlet_mask);
}
cv::Mat face_id_tex = cv::Mat::zeros(src.size(), CV_32SC1); cv::Mat face_id_tex = cv::Mat::zeros(src.size(), CV_32SC1);
face_id_map(mesh, face_id_tex); face_id_map(mesh, face_id_tex);