Skip to content

Commit

Permalink
Merge pull request #1502 from alicevision/dngFormatBugFix
Browse files Browse the repository at this point in the history
Bugfix on dng reading
  • Loading branch information
cbentejac authored Aug 3, 2023
2 parents 8408e2d + 77acf16 commit c75f77a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 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 @@ -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
{
Expand All @@ -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 c75f77a

Please sign in to comment.