Skip to content

Commit

Permalink
Update some panorama nodes to enable computation in ACEScg.
Browse files Browse the repository at this point in the history
  • Loading branch information
demoulinv committed Oct 4, 2022
1 parent 6340ede commit e38b85d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/dependencies/MeshSDFilter
1 change: 1 addition & 0 deletions src/software/pipeline/main_LdrToHdrMerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
9 changes: 8 additions & 1 deletion src/software/pipeline/main_panoramaCompositing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 6 additions & 1 deletion src/software/pipeline/main_panoramaMerging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ int aliceVision_main(int argc, char** argv)

bool first = true;
image::Image<image::RGBAfColor> panorama;
std::string colorSpace;

for (auto viewItem : sfmData.getViews())
{
Expand All @@ -136,6 +137,7 @@ int aliceVision_main(int argc, char** argv)
if (first)
{
panorama = image::Image<image::RGBAfColor>(panoramaWidth, panoramaHeight, true, image::RGBAfColor(0.0f, 0.0f, 0.f, 0.0f));
colorSpace = metadata.find("AliceVision:ColorSpace")->get_string();
first = false;
}

Expand All @@ -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;
}
2 changes: 1 addition & 1 deletion src/software/pipeline/main_panoramaWarping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<image::RGBfColor> 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);
Expand Down

0 comments on commit e38b85d

Please sign in to comment.