Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw Images: minor adjustments #1320

Merged
merged 3 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/aliceVision/image/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,10 @@ void readImage(const std::string& path,
configSpec.attribute("raw:ColorSpace", "raw"); // use raw data
configSpec.attribute("raw:HighlightMode", 1); // unclip
}
else
{
ALICEVISION_THROW_ERROR("[image] readImage: invalid rawColorInterpretation " << ERawColorInterpretation_enumToString(imageReadOptions.rawColorInterpretation) << ".");
}
}

oiio::ImageBuf inBuf(path, 0, 0, NULL, &configSpec);
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/image/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ std::istream& operator>>(std::istream& in, EImageQuality& imageQuality);
struct ImageReadOptions
{
ImageReadOptions(EImageColorSpace colorSpace = EImageColorSpace::AUTO,
ERawColorInterpretation rawColorInterpretation = ERawColorInterpretation::Auto,
ERawColorInterpretation rawColorInterpretation = ERawColorInterpretation::LibRawWhiteBalancing,
const std::string& colorProfile = "", const oiio::ROI& roi = oiio::ROI()) :
workingColorSpace(colorSpace), rawColorInterpretation(rawColorInterpretation), colorProfileFileName(colorProfile), subROI(roi)
{
Expand Down
13 changes: 4 additions & 9 deletions src/software/pipeline/main_cameraInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@ int aliceVision_main(int argc, char **argv)
}
}

// Store the color interpretation mode choosed for raw images in metadata,
// so all future loads of this image will be interpreted in the same way.
view.addMetadata("AliceVision:rawColorInterpretation", image::ERawColorInterpretation_enumToString(rawColorInterpretation));

// check if the view intrinsic is already defined
if(intrinsicId != UndefinedIndexT)
{
Expand Down Expand Up @@ -847,15 +851,6 @@ int aliceVision_main(int argc, char **argv)
return EXIT_FAILURE;
}

// Add the white balance option to the image metadata
for (auto vitem : sfmData.getViews())
{
if (vitem.second)
{
vitem.second->addMetadata("AliceVision:rawColorInterpretation", image::ERawColorInterpretation_enumToString(rawColorInterpretation));
}
}

// store SfMData views & intrinsic data
if(!Save(sfmData, outputFilePath, ESfMData(VIEWS|INTRINSICS|EXTRINSICS)))
{
Expand Down