| 383 | } |
| 384 | |
| 385 | void PatchMatchController::ProcessProblem(const PatchMatchOptions& options, |
| 386 | const size_t problem_idx) { |
| 387 | if (CheckIfStopped()) { |
| 388 | return; |
| 389 | } |
| 390 | |
| 391 | const auto& model = workspace_->GetModel(); |
| 392 | |
| 393 | auto& problem = problems_.at(problem_idx); |
| 394 | const int gpu_index = gpu_indices_.at(thread_pool_->GetThreadIndex()); |
| 395 | THROW_CHECK_GE(gpu_index, -1); |
| 396 | |
| 397 | const std::string& stereo_folder = workspace_->GetOptions().stereo_folder; |
| 398 | const std::string output_type = |
| 399 | options.geom_consistency ? "geometric" : "photometric"; |
| 400 | const std::string image_name = model.GetImageName(problem.ref_image_idx); |
| 401 | const std::string file_name = |
| 402 | StringPrintf("%s.%s.bin", image_name.c_str(), output_type.c_str()); |
| 403 | const auto depth_map_path = |
| 404 | workspace_path_ / stereo_folder / "depth_maps" / file_name; |
| 405 | const auto normal_map_path = |
| 406 | workspace_path_ / stereo_folder / "normal_maps" / file_name; |
| 407 | const auto consistency_graph_path = |
| 408 | workspace_path_ / stereo_folder / "consistency_graphs" / file_name; |
| 409 | |
| 410 | if (ExistsFile(depth_map_path) && ExistsFile(normal_map_path) && |
| 411 | (!options.write_consistency_graph || |
| 412 | ExistsFile(consistency_graph_path))) { |
| 413 | return; |
| 414 | } |
| 415 | |
| 416 | LOG_HEADING1(StringPrintf("Processing view %d / %d for %s", |
| 417 | problem_idx + 1, |
| 418 | problems_.size(), |
| 419 | image_name.c_str())); |
| 420 | |
| 421 | auto patch_match_options = options; |
| 422 | |
| 423 | if (patch_match_options.depth_min < 0 || patch_match_options.depth_max < 0) { |
| 424 | patch_match_options.depth_min = |
| 425 | depth_ranges_.at(problem.ref_image_idx).first; |
| 426 | patch_match_options.depth_max = |
| 427 | depth_ranges_.at(problem.ref_image_idx).second; |
| 428 | THROW_CHECK(patch_match_options.depth_min > 0 && |
| 429 | patch_match_options.depth_max > 0) |
| 430 | << " - You must manually set the minimum and maximum depth, since no " |
| 431 | "sparse model is provided in the workspace."; |
| 432 | } |
| 433 | |
| 434 | patch_match_options.gpu_index = std::to_string(gpu_index); |
| 435 | |
| 436 | if (patch_match_options.sigma_spatial <= 0.0f) { |
| 437 | patch_match_options.sigma_spatial = patch_match_options.window_radius; |
| 438 | } |
| 439 | |
| 440 | std::vector<Image> images = model.images; |
| 441 | std::vector<DepthMap> depth_maps; |
| 442 | std::vector<NormalMap> normal_maps; |
nothing calls this directly
no test coverage detected