From 1ba688c353602eba7a2a6f8f7b7a56938c0f04fb Mon Sep 17 00:00:00 2001 From: demoulinv Date: Wed, 2 Aug 2023 10:54:06 +0200 Subject: [PATCH 1/2] [imageProcessing] Enable color temperature processing only if a dcp color profile is available. --- src/software/utils/main_imageProcessing.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/software/utils/main_imageProcessing.cpp b/src/software/utils/main_imageProcessing.cpp index d405b73917..0dd96d6076 100644 --- a/src/software/utils/main_imageProcessing.cpp +++ b/src/software/utils/main_imageProcessing.cpp @@ -320,7 +320,7 @@ struct ProcessingParams bool fixNonFinite = false; bool applyDcpMetadata = false; bool useDCPColorMatrixOnly = false; - bool sourceIsRaw = false; + bool enableColorTempProcessing = false; double correlatedColorTemperature = -1.0; LensCorrectionParams lensCorrection = @@ -600,7 +600,7 @@ void processImage(image::Image& image, const ProcessingParams #endif } - if (pParams.applyDcpMetadata || (pParams.sourceIsRaw && pParams.correlatedColorTemperature <= 0.0)) + if (pParams.applyDcpMetadata || (pParams.enableColorTempProcessing && pParams.correlatedColorTemperature <= 0.0)) { bool dcpMetadataOK = map_has_non_empty_value(imageMetadata, "AliceVision:DCP:Temp1") && map_has_non_empty_value(imageMetadata, "AliceVision:DCP:Temp2") && @@ -678,7 +678,7 @@ void processImage(image::Image& image, const ProcessingParams double cct = pParams.correlatedColorTemperature; double tint; - if (pParams.sourceIsRaw) + if (pParams.enableColorTempProcessing) { dcpProf.getColorTemperatureAndTintFromNeutral(neutral, cct, tint); } @@ -690,7 +690,7 @@ void processImage(image::Image& image, const ProcessingParams imageMetadata["AliceVision:ColorTemperature"] = std::to_string(cct); } - else if (pParams.sourceIsRaw && pParams.correlatedColorTemperature > 0.0) + else if (pParams.enableColorTempProcessing && pParams.correlatedColorTemperature > 0.0) { imageMetadata["AliceVision:ColorTemperature"] = std::to_string(pParams.correlatedColorTemperature); } @@ -1108,7 +1108,7 @@ int aliceVision_main(int argc, char * argv[]) options.rawAutoBright = pParams.rawAutoBright; options.correlatedColorTemperature = correlatedColorTemperature; pParams.correlatedColorTemperature = correlatedColorTemperature; - pParams.sourceIsRaw = true; + pParams.enableColorTempProcessing = options.rawColorInterpretation == image::ERawColorInterpretation::DcpLinearProcessing; } if (pParams.lensCorrection.enabled && pParams.lensCorrection.vignetting) @@ -1351,7 +1351,7 @@ int aliceVision_main(int argc, char * argv[]) readOptions.rawAutoBright = pParams.rawAutoBright; readOptions.correlatedColorTemperature = correlatedColorTemperature; pParams.correlatedColorTemperature = correlatedColorTemperature; - pParams.sourceIsRaw = true; + pParams.enableColorTempProcessing = readOptions.rawColorInterpretation == image::ERawColorInterpretation::DcpLinearProcessing; pParams.useDCPColorMatrixOnly = useDCPColorMatrixOnly; if (pParams.applyDcpMetadata) From 77acf16dff905fb0e9b6b33f1a019c05419ee5f4 Mon Sep 17 00:00:00 2001 From: demoulinv Date: Thu, 3 Aug 2023 11:14:33 +0200 Subject: [PATCH 2/2] [imageProcessing] Change fallback to libRawWhiteBalancing if a dcp color profile cannot be found in the database. --- src/software/utils/main_imageProcessing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/software/utils/main_imageProcessing.cpp b/src/software/utils/main_imageProcessing.cpp index 0dd96d6076..92ae83c731 100644 --- a/src/software/utils/main_imageProcessing.cpp +++ b/src/software/utils/main_imageProcessing.cpp @@ -1331,7 +1331,7 @@ int aliceVision_main(int argc, char * argv[]) (rawColorInterpretation == image::ERawColorInterpretation::DcpMetadata))) { // Fallback case of missing profile but no error requested - readOptions.rawColorInterpretation = image::ERawColorInterpretation::LibRawNoWhiteBalancing; + readOptions.rawColorInterpretation = image::ERawColorInterpretation::LibRawWhiteBalancing; } else {