20
20
#include < boost/program_options.hpp>
21
21
#include < boost/property_tree/ptree.hpp>
22
22
#include < boost/property_tree/json_parser.hpp>
23
+ #include < boost/regex.hpp>
23
24
24
25
#include < opencv2/core.hpp>
25
26
#include < opencv2/imgproc/imgproc.hpp>
@@ -406,6 +407,8 @@ int aliceVision_main(int argc, char** argv)
406
407
// user optional parameters
407
408
bool debug = false ;
408
409
unsigned int maxCountByImage = 1 ;
410
+ bool processAllImages = true ;
411
+ std::string filter = " *_macbeth.*" ;
409
412
410
413
po::options_description inputParams (" Required parameters" );
411
414
inputParams.add_options ()
@@ -416,8 +419,11 @@ int aliceVision_main(int argc, char** argv)
416
419
417
420
po::options_description optionalParams (" Optional parameters" );
418
421
optionalParams.add_options ()
419
- (" debug" , po::value<bool >(&debug),
420
- " Output debug data." )
422
+ (" debug" , po::value<bool >(&debug), " Output debug data." )
423
+ (" processAllImages" , po::value<bool >(&processAllImages)->default_value (processAllImages),
424
+ " If True, process all available images." )
425
+ (" filter" , po::value<std::string>(&filter)->default_value (filter),
426
+ " Regular expression to select images to be processed." )
421
427
(" maxCount" , po::value<unsigned int >(&maxCountByImage),
422
428
" Maximum color charts count to detect in a single image." );
423
429
@@ -458,17 +464,20 @@ int aliceVision_main(int argc, char** argv)
458
464
{
459
465
const sfmData::View& view = *(viewIt.second );
460
466
461
- ALICEVISION_LOG_INFO (++counter << " /" << sfmData.getViews ().size () << " - Process image at: '" << view.getImagePath () << " '." );
462
- ImageOptions imgOpt = {
463
- view.getImagePath (),
464
- std::to_string (view.getViewId ()),
465
- view.getMetadataBodySerialNumber (),
466
- view.getMetadataLensSerialNumber () };
467
- imgOpt.readOptions .workingColorSpace = image::EImageColorSpace::SRGB;
468
- imgOpt.readOptions .rawColorInterpretation = image::ERawColorInterpretation_stringToEnum (view.getRawColorInterpretation ());
469
- detectColorChecker (detectedCCheckers, imgOpt, settings);
467
+ boost::filesystem::path p (view.getImagePath ());
468
+ const std::regex regex = utils::filterToRegex (filter);
469
+ if (processAllImages || std::regex_match (p.generic_string (), regex))
470
+ {
471
+ ALICEVISION_LOG_INFO (++counter << " /" << sfmData.getViews ().size () << " - Process image at: '"
472
+ << view.getImagePath () << " '." );
473
+ ImageOptions imgOpt = {view.getImagePath (), std::to_string (view.getViewId ()),
474
+ view.getMetadataBodySerialNumber (), view.getMetadataLensSerialNumber ()};
475
+ imgOpt.readOptions .workingColorSpace = image::EImageColorSpace::SRGB;
476
+ imgOpt.readOptions .rawColorInterpretation =
477
+ image::ERawColorInterpretation_stringToEnum (view.getRawColorInterpretation ());
478
+ detectColorChecker (detectedCCheckers, imgOpt, settings);
479
+ }
470
480
}
471
-
472
481
}
473
482
else
474
483
{
@@ -509,11 +518,16 @@ int aliceVision_main(int argc, char** argv)
509
518
int counter = 0 ;
510
519
for (const std::string& imgSrcPath : filesStrPaths)
511
520
{
512
- ALICEVISION_LOG_INFO (++counter << " /" << size << " - Process image at: '" << imgSrcPath << " '." );
513
- ImageOptions imgOpt;
514
- imgOpt.imgFsPath = imgSrcPath;
515
- imgOpt.readOptions .workingColorSpace = image::EImageColorSpace::SRGB;
516
- detectColorChecker (detectedCCheckers, imgOpt, settings);
521
+ boost::filesystem::path p (imgSrcPath);
522
+ const std::regex regex = utils::filterToRegex (filter);
523
+ if (processAllImages || std::regex_match (p.generic_string (), regex))
524
+ {
525
+ ALICEVISION_LOG_INFO (++counter << " /" << size << " - Process image at: '" << imgSrcPath << " '." );
526
+ ImageOptions imgOpt;
527
+ imgOpt.imgFsPath = imgSrcPath;
528
+ imgOpt.readOptions .workingColorSpace = image::EImageColorSpace::SRGB;
529
+ detectColorChecker (detectedCCheckers, imgOpt, settings);
530
+ }
517
531
}
518
532
519
533
}
0 commit comments