From 1da075e1aedc482366677d3543bae335d4073529 Mon Sep 17 00:00:00 2001 From: demoulinv Date: Tue, 13 Dec 2022 21:06:02 +0100 Subject: [PATCH 1/2] [imageProcessing & cameraInit] Remove applyToneCurve parameter in imageProcessing cameraInit: Test empty dcpDatabase only if dcp is required --- .../compatibilityData/scene_v1.2.3.abc | Bin 412693 -> 412693 bytes src/software/pipeline/main_cameraInit.cpp | 37 ++++++++++-------- src/software/utils/main_imageProcessing.cpp | 5 --- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/aliceVision/sfmDataIO/compatibilityData/scene_v1.2.3.abc b/src/aliceVision/sfmDataIO/compatibilityData/scene_v1.2.3.abc index e31654fa6c583bb96a5cb11bbf67a09a88041e6e..0f7c5ca9d808c9fea16ba7f8c847e7d17ecb418d 100644 GIT binary patch delta 47 zcmbO_Lvrd2$%Yoj7N!>F7M2#)Eo_@Sh5ho&6b#K2j0}v76bvk^Kxq3>PqqLi0BN)h A$p8QV delta 47 zcmbO_Lvrd2$%Yoj7N!>F7M2#)Eo_@Sg@aQI6pYLjj0}v76bvk^42`TzwjcFm3t$2O DXwVJ6 diff --git a/src/software/pipeline/main_cameraInit.cpp b/src/software/pipeline/main_cameraInit.cpp index 32910b5592..283962485c 100644 --- a/src/software/pipeline/main_cameraInit.cpp +++ b/src/software/pipeline/main_cameraInit.cpp @@ -452,32 +452,35 @@ int aliceVision_main(int argc, char **argv) std::string imgFormat = in->format_name(); - if (dcpDatabase.empty() && (imgFormat.compare("raw") == 0) && errorOnMissingColorProfile) - { - ALICEVISION_LOG_ERROR("The specified DCP database for color profiles does not exist or is empty."); - // No color profile available - boost::atomic_ref{allColorProfilesFound} = 0; - } - // if a color profile is required check if a dcp database exists and if one is available inside // if yes and if metadata exist and image format is raw then update metadata with DCP info if((rawColorInterpretation == image::ERawColorInterpretation::DcpLinearProcessing || rawColorInterpretation == image::ERawColorInterpretation::DcpMetadata) && - hasCameraMetadata && !dcpDatabase.empty() && (imgFormat.compare("raw") == 0)) + hasCameraMetadata && (imgFormat.compare("raw") == 0)) { - image::DCPProfile dcpProf; - if(dcpDatabase.getDcpForCamera(make, model, dcpProf)) + if (dcpDatabase.empty() && errorOnMissingColorProfile) { - view.addDCPMetadata(dcpProf); - - #pragma omp critical - viewsWithDCPMetadata++; + ALICEVISION_LOG_ERROR("The specified DCP database for color profiles does not exist or is empty."); + // No color profile available + boost::atomic_ref{allColorProfilesFound} = 0; } - else if(allColorProfilesFound) + else if (!dcpDatabase.empty()) { - // there is a missing color profile for one image or more - boost::atomic_ref{allColorProfilesFound} = 0; + image::DCPProfile dcpProf; + + if (dcpDatabase.getDcpForCamera(make, model, dcpProf)) + { + view.addDCPMetadata(dcpProf); + + #pragma omp critical + viewsWithDCPMetadata++; + } + else if (allColorProfilesFound) + { + // there is a missing color profile for one image or more + boost::atomic_ref{allColorProfilesFound} = 0; + } } } diff --git a/src/software/utils/main_imageProcessing.cpp b/src/software/utils/main_imageProcessing.cpp index 3e0af00abe..06fb4e7b34 100644 --- a/src/software/utils/main_imageProcessing.cpp +++ b/src/software/utils/main_imageProcessing.cpp @@ -577,7 +577,6 @@ int aliceVision_main(int argc, char * argv[]) image::EImageColorSpace outputColorSpace = image::EImageColorSpace::LINEAR; image::EStorageDataType storageDataType = image::EStorageDataType::Float; std::string extension; - bool applyToneCurve = false; image::ERawColorInterpretation rawColorInterpretation = image::ERawColorInterpretation::LibRawNoWhiteBalancing; std::string colorProfileDatabaseDirPath = ""; bool errorOnMissingColorProfile = true; @@ -678,9 +677,6 @@ int aliceVision_main(int argc, char * argv[]) ("errorOnMissingColorProfile", po::value(&errorOnMissingColorProfile)->default_value(errorOnMissingColorProfile), "Rise an error if a DCP color profiles database is specified but no DCP file matches with the camera model (maker+name) extracted from metadata (Only for raw images)") - ("applyToneCurve", po::value(&applyToneCurve)->default_value(applyToneCurve), - "Apply color profile embedded tone curve if any.") - ("storageDataType", po::value(&storageDataType)->default_value(storageDataType), ("Storage data type: " + image::EStorageDataType_informations()).c_str()) @@ -801,7 +797,6 @@ int aliceVision_main(int argc, char * argv[]) options.rawColorInterpretation = rawColorInterpretation; } options.colorProfileFileName = view.getColorProfileFileName(); - options.applyToneCurve = applyToneCurve; // Read original image image::Image image; From 1f861a03fffcb1b477f7c6c3b522fddc49019a63 Mon Sep 17 00:00:00 2001 From: demoulinv Date: Thu, 15 Dec 2022 09:04:40 +0100 Subject: [PATCH 2/2] [io] Remove applyToneCurve from ImageReadOptions. --- src/aliceVision/image/io.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/aliceVision/image/io.hpp b/src/aliceVision/image/io.hpp index cde4eb0c5a..6523e197d1 100644 --- a/src/aliceVision/image/io.hpp +++ b/src/aliceVision/image/io.hpp @@ -184,15 +184,13 @@ struct ImageReadOptions ImageReadOptions(EImageColorSpace colorSpace = EImageColorSpace::AUTO, ERawColorInterpretation rawColorInterpretation = ERawColorInterpretation::Auto, const std::string& colorProfile = "", const oiio::ROI& roi = oiio::ROI()) : - workingColorSpace(colorSpace), rawColorInterpretation(rawColorInterpretation), colorProfileFileName(colorProfile), applyToneCurve(false), subROI(roi) + workingColorSpace(colorSpace), rawColorInterpretation(rawColorInterpretation), colorProfileFileName(colorProfile), subROI(roi) { } - EImageColorSpace workingColorSpace; ERawColorInterpretation rawColorInterpretation; std::string colorProfileFileName; - bool applyToneCurve; //ROI for this image. //If the image contains an roi, this is the roi INSIDE the roi.