From e38b85da4c58db41963b7cbd75ce9e5c5d0b14e8 Mon Sep 17 00:00:00 2001 From: demoulinv Date: Tue, 4 Oct 2022 20:54:09 +0200 Subject: [PATCH] Update some panorama nodes to enable computation in ACEScg. --- src/dependencies/MeshSDFilter | 2 +- src/software/pipeline/main_LdrToHdrMerge.cpp | 1 + src/software/pipeline/main_panoramaCompositing.cpp | 9 ++++++++- src/software/pipeline/main_panoramaMerging.cpp | 7 ++++++- src/software/pipeline/main_panoramaWarping.cpp | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/dependencies/MeshSDFilter b/src/dependencies/MeshSDFilter index e0e0bcdc0a..b7dfeed64b 160000 --- a/src/dependencies/MeshSDFilter +++ b/src/dependencies/MeshSDFilter @@ -1 +1 @@ -Subproject commit e0e0bcdc0aa1b6c5c6e60960b2b754e9ac262958 +Subproject commit b7dfeed64be90f2eff49345cf65451b700d3a417 diff --git a/src/software/pipeline/main_LdrToHdrMerge.cpp b/src/software/pipeline/main_LdrToHdrMerge.cpp index 2136f408be..1d6c8187d8 100644 --- a/src/software/pipeline/main_LdrToHdrMerge.cpp +++ b/src/software/pipeline/main_LdrToHdrMerge.cpp @@ -316,6 +316,7 @@ int aliceVision_main(int argc, char** argv) // Write an image with parameters from the target view oiio::ParamValueList targetMetadata = image::readImageMetadata(targetView->getImagePath()); targetMetadata.push_back(oiio::ParamValue("AliceVision:storageDataType", image::EStorageDataType_enumToString(storageDataType))); + targetMetadata.add_or_replace(oiio::ParamValue("AliceVision:ColorSpace", image::EImageColorSpace_enumToString(image::EImageColorSpace::LINEAR))); image::writeImage(hdrImagePath, HDRimage, image::EImageColorSpace::AUTO, targetMetadata); } diff --git a/src/software/pipeline/main_panoramaCompositing.cpp b/src/software/pipeline/main_panoramaCompositing.cpp index 6ac016cd5a..de5ebaea36 100644 --- a/src/software/pipeline/main_panoramaCompositing.cpp +++ b/src/software/pipeline/main_panoramaCompositing.cpp @@ -348,6 +348,12 @@ bool processImage(const PanoramaMap & panoramaMap, const std::string & composite bool hasFailed = false; + // Load metadata to get image color space + std::string colorSpace; + const std::string firstImagePath = (fs::path(warpingFolder) / (std::to_string(overlappingViews[0]) + ".exr")).string(); + oiio::ParamValueList srcMetadata = image::readImageMetadata(firstImagePath); + colorSpace = srcMetadata.get_string("AliceVision:ColorSpace", "Linear"); + #pragma omp parallel for for (int posCurrent = 0; posCurrent < overlappingViews.size(); posCurrent++) { @@ -538,8 +544,9 @@ bool processImage(const PanoramaMap & panoramaMap, const std::string & composite metadata.push_back(oiio::ParamValue("AliceVision:offsetY", int(referenceBoundingBox.top))); metadata.push_back(oiio::ParamValue("AliceVision:panoramaWidth", int(panoramaMap.getWidth()))); metadata.push_back(oiio::ParamValue("AliceVision:panoramaHeight", int(panoramaMap.getHeight()))); + metadata.push_back(oiio::ParamValue("AliceVision:ColorSpace", colorSpace)); - image::writeImage(outputFilePath, output, image::EImageColorSpace::LINEAR, metadata); + image::writeImage(outputFilePath, output, image::EImageColorSpace_stringToEnum(colorSpace), metadata); return true; } diff --git a/src/software/pipeline/main_panoramaMerging.cpp b/src/software/pipeline/main_panoramaMerging.cpp index e636105174..9c0a205cba 100644 --- a/src/software/pipeline/main_panoramaMerging.cpp +++ b/src/software/pipeline/main_panoramaMerging.cpp @@ -116,6 +116,7 @@ int aliceVision_main(int argc, char** argv) bool first = true; image::Image panorama; + std::string colorSpace; for (auto viewItem : sfmData.getViews()) { @@ -136,6 +137,7 @@ int aliceVision_main(int argc, char** argv) if (first) { panorama = image::Image(panoramaWidth, panoramaHeight, true, image::RGBAfColor(0.0f, 0.0f, 0.f, 0.0f)); + colorSpace = metadata.find("AliceVision:ColorSpace")->get_string(); first = false; } @@ -162,9 +164,12 @@ int aliceVision_main(int argc, char** argv) } } + image::EImageColorSpace outputColorSpace = colorSpace.empty() ? image::EImageColorSpace::AUTO : image::EImageColorSpace_stringToEnum(colorSpace); + oiio::ParamValueList targetMetadata; targetMetadata.push_back(oiio::ParamValue("AliceVision:storageDataType", image::EStorageDataType_enumToString(storageDataType))); - image::writeImage(outputPanoramaPath, panorama, image::EImageColorSpace::AUTO, targetMetadata); + targetMetadata.add_or_replace(oiio::ParamValue("AliceVision:ColorSpace", colorSpace = colorSpace.empty() ? "Linear" : colorSpace)); + image::writeImage(outputPanoramaPath, panorama, outputColorSpace, targetMetadata); return EXIT_SUCCESS; } diff --git a/src/software/pipeline/main_panoramaWarping.cpp b/src/software/pipeline/main_panoramaWarping.cpp index 43877331c5..3d036464b1 100644 --- a/src/software/pipeline/main_panoramaWarping.cpp +++ b/src/software/pipeline/main_panoramaWarping.cpp @@ -356,7 +356,7 @@ int aliceVision_main(int argc, char** argv) std::string imagePath = view.getImagePath(); ALICEVISION_LOG_INFO("Load image with path " << imagePath); image::Image source; - image::readImage(imagePath, source, image::EImageColorSpace::LINEAR); + image::readImage(imagePath, source, image::EImageColorSpace::NO_CONVERSION); // Load metadata and update for output oiio::ParamValueList metadata = image::readImageMetadata(imagePath);