Skip to content

Commit

Permalink
[HDRmerge & default demosaicing]
Browse files Browse the repository at this point in the history
Adjust output color to 'Linear' space when working color space is 'sRGB'.
Set back AHD as default demosaicing algo.
  • Loading branch information
demoulinv committed Mar 8, 2023
1 parent bea1a2b commit 3bb3504
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/aliceVision/image/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ struct ImageReadOptions
ERawColorInterpretation rawColorInterpretation = ERawColorInterpretation::LibRawWhiteBalancing,
const std::string& colorProfile = "", const bool useDCPColorMatrixOnly = true, const oiio::ROI& roi = oiio::ROI()) :
workingColorSpace(colorSpace), rawColorInterpretation(rawColorInterpretation), colorProfileFileName(colorProfile), useDCPColorMatrixOnly(useDCPColorMatrixOnly),
doWBAfterDemosaicing(false), demosaicingAlgo("DHT"), highlightMode(0), subROI(roi)
doWBAfterDemosaicing(false), demosaicingAlgo("AHD"), highlightMode(0), subROI(roi)
{
}

Expand Down
10 changes: 7 additions & 3 deletions src/software/pipeline/main_LdrToHdrMerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,15 @@ int aliceVision_main(int argc, char** argv)
targetMetadata.add_or_replace(oiio::ParamValue(meta.first, meta.second));
}
}
targetMetadata.add_or_replace(oiio::ParamValue("AliceVision:ColorSpace", image::EImageColorSpace_enumToString(workingColorSpace)));

// Fusion always produces linear image. sRGB is the only non linear color space that must be changed to linear (sRGB linear).
image::EImageColorSpace mergedColorSpace = (workingColorSpace == image::EImageColorSpace::SRGB) ? image::EImageColorSpace::LINEAR : workingColorSpace;

targetMetadata.add_or_replace(oiio::ParamValue("AliceVision:ColorSpace", image::EImageColorSpace_enumToString(mergedColorSpace)));

image::ImageWriteOptions writeOptions;
writeOptions.fromColorSpace(workingColorSpace);
writeOptions.toColorSpace(workingColorSpace);
writeOptions.fromColorSpace(mergedColorSpace);
writeOptions.toColorSpace(mergedColorSpace);
writeOptions.storageDataType(storageDataType);

image::writeImage(hdrImagePath, HDRimage, writeOptions, targetMetadata);
Expand Down
4 changes: 2 additions & 2 deletions src/software/utils/main_imageProcessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ int aliceVision_main(int argc, char * argv[])
bool errorOnMissingColorProfile = true;
bool useDCPColorMatrixOnly = true;
bool doWBAfterDemosaicing = false;
std::string demosaicingAlgo = "DHT";
std::string demosaicingAlgo = "AHD";
int highlightMode = 0;

ProcessingParams pParams;
Expand Down Expand Up @@ -774,7 +774,7 @@ int aliceVision_main(int argc, char * argv[])

("demosaicingAlgo", po::value<std::string>(&demosaicingAlgo)->default_value(demosaicingAlgo),
"Demosaicing algorithm (see libRaw documentation).\n"
"Possible algos are: linear, VNG, PPG, AHD, DCB, AHD-Mod, AFD, VCD, Mixed, LMMSE, AMaZE, DHT (default), AAHD, none.")
"Possible algos are: linear, VNG, PPG, AHD (default), DCB, AHD-Mod, AFD, VCD, Mixed, LMMSE, AMaZE, DHT, AAHD, none.")

("highlightMode", po::value<int>(&highlightMode)->default_value(highlightMode),
"Highlight management (see libRaw documentation).\n"
Expand Down

0 comments on commit 3bb3504

Please sign in to comment.