Skip to content

Commit

Permalink
[imageProcessing] Enable color temperature processing only if a dcp c…
Browse files Browse the repository at this point in the history
…olor profile is available.
  • Loading branch information
demoulinv committed Aug 2, 2023
1 parent 8408e2d commit 1ba688c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/software/utils/main_imageProcessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -600,7 +600,7 @@ void processImage(image::Image<image::RGBAfColor>& 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") &&
Expand Down Expand Up @@ -678,7 +678,7 @@ void processImage(image::Image<image::RGBAfColor>& image, const ProcessingParams
double cct = pParams.correlatedColorTemperature;
double tint;

if (pParams.sourceIsRaw)
if (pParams.enableColorTempProcessing)
{
dcpProf.getColorTemperatureAndTintFromNeutral(neutral, cct, tint);
}
Expand All @@ -690,7 +690,7 @@ void processImage(image::Image<image::RGBAfColor>& 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);
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1ba688c

Please sign in to comment.