in source/depth_estimation/DerpCLI.cpp [67:116]
void verifyInputs() {
CHECK_NE(FLAGS_input_root, "");
CHECK_NE(FLAGS_output_root, "");
if (FLAGS_level_start >= 0 && FLAGS_level_end >= 0) {
CHECK_GE(FLAGS_level_start, FLAGS_level_end);
}
if (FLAGS_rig.empty()) {
FLAGS_rig = FLAGS_input_root + "/rigs/rig_calibrated.json";
}
if (FLAGS_color.empty()) {
FLAGS_color = getImageDir(FLAGS_input_root, ImageType::color_levels).string();
}
if (FLAGS_background_disp.empty()) {
FLAGS_background_disp =
getImageDir(FLAGS_input_root, ImageType::background_disp_levels).string();
}
if (FLAGS_foreground_masks.empty()) {
FLAGS_foreground_masks =
getImageDir(FLAGS_input_root, ImageType::foreground_masks_levels).string();
}
// Check flag values
CHECK_GE(FLAGS_random_proposals, 0);
CHECK_LE(FLAGS_first, FLAGS_last);
const bool hasColorImages = filesystem::is_directory(FLAGS_color);
CHECK(hasColorImages) << "No images in " << FLAGS_color;
if (FLAGS_use_foreground_masks) {
const bool hasBackgroundDisps = filesystem::is_directory(FLAGS_background_disp);
CHECK(hasBackgroundDisps) << "Asked to use background but no background disparities found in "
<< FLAGS_background_disp;
const bool hasDstForegroundMasks = filesystem::is_directory(FLAGS_foreground_masks);
CHECK(hasDstForegroundMasks)
<< "Asked to use foreground masks but no foreground masks found in "
<< FLAGS_foreground_masks;
}
std::vector<std::string> outputFormats;
folly::split(",", FLAGS_output_formats, outputFormats);
for (std::string& outputFormat : outputFormats) {
// We allow size 0 inputs to ensure stray commas are ignored, i.e. exr,,png is fine
CHECK(
outputFormat.size() == 0 || outputFormat == "exr" || outputFormat == "png" ||
outputFormat == "pfm")
<< "Invalid output format specified: " << outputFormat;
}
}