MCPcopy Create free account
hub / github.com/colmap/colmap / ProcessProblem

Method ProcessProblem

src/colmap/mvs/patch_match.cc:385–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385void 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;

Callers

nothing calls this directly

Calls 15

StringPrintfFunction · 0.85
ExistsFileFunction · 0.85
GetThreadIndexMethod · 0.80
sizeMethod · 0.80
GetBitmapPathMethod · 0.80
GetDepthMapPathMethod · 0.80
GetNormalMapPathMethod · 0.80
AddTaskMethod · 0.80
SetBitmapMethod · 0.80
GetDepthMapMethod · 0.80
GetNormalMapMethod · 0.80
GetConsistencyGraphMethod · 0.80

Tested by

no test coverage detected