Skip to content

Commit

Permalink
Merge pull request #1317 from alicevision/dev/rawUpdate
Browse files Browse the repository at this point in the history
Raw Update
  • Loading branch information
fabiencastan authored Dec 15, 2022
2 parents b2abc45 + 1f861a0 commit 1eff04c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
4 changes: 1 addition & 3 deletions src/aliceVision/image/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,13 @@ struct ImageReadOptions
ImageReadOptions(EImageColorSpace colorSpace = EImageColorSpace::AUTO,
ERawColorInterpretation rawColorInterpretation = ERawColorInterpretation::Auto,
const std::string& colorProfile = "", const oiio::ROI& roi = oiio::ROI()) :
workingColorSpace(colorSpace), rawColorInterpretation(rawColorInterpretation), colorProfileFileName(colorProfile), applyToneCurve(false), subROI(roi)
workingColorSpace(colorSpace), rawColorInterpretation(rawColorInterpretation), colorProfileFileName(colorProfile), subROI(roi)
{
}


EImageColorSpace workingColorSpace;
ERawColorInterpretation rawColorInterpretation;
std::string colorProfileFileName;
bool applyToneCurve;

//ROI for this image.
//If the image contains an roi, this is the roi INSIDE the roi.
Expand Down
Binary file modified src/aliceVision/sfmDataIO/compatibilityData/scene_v1.2.3.abc
Binary file not shown.
37 changes: 20 additions & 17 deletions src/software/pipeline/main_cameraInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,32 +452,35 @@ int aliceVision_main(int argc, char **argv)

std::string imgFormat = in->format_name();

if (dcpDatabase.empty() && (imgFormat.compare("raw") == 0) && errorOnMissingColorProfile)
{
ALICEVISION_LOG_ERROR("The specified DCP database for color profiles does not exist or is empty.");
// No color profile available
boost::atomic_ref<char>{allColorProfilesFound} = 0;
}

// if a color profile is required check if a dcp database exists and if one is available inside
// if yes and if metadata exist and image format is raw then update metadata with DCP info
if((rawColorInterpretation == image::ERawColorInterpretation::DcpLinearProcessing ||
rawColorInterpretation == image::ERawColorInterpretation::DcpMetadata) &&
hasCameraMetadata && !dcpDatabase.empty() && (imgFormat.compare("raw") == 0))
hasCameraMetadata && (imgFormat.compare("raw") == 0))
{
image::DCPProfile dcpProf;

if(dcpDatabase.getDcpForCamera(make, model, dcpProf))
if (dcpDatabase.empty() && errorOnMissingColorProfile)
{
view.addDCPMetadata(dcpProf);

#pragma omp critical
viewsWithDCPMetadata++;
ALICEVISION_LOG_ERROR("The specified DCP database for color profiles does not exist or is empty.");
// No color profile available
boost::atomic_ref<char>{allColorProfilesFound} = 0;
}
else if(allColorProfilesFound)
else if (!dcpDatabase.empty())
{
// there is a missing color profile for one image or more
boost::atomic_ref<char>{allColorProfilesFound} = 0;
image::DCPProfile dcpProf;

if (dcpDatabase.getDcpForCamera(make, model, dcpProf))
{
view.addDCPMetadata(dcpProf);

#pragma omp critical
viewsWithDCPMetadata++;
}
else if (allColorProfilesFound)
{
// there is a missing color profile for one image or more
boost::atomic_ref<char>{allColorProfilesFound} = 0;
}
}
}

Expand Down
5 changes: 0 additions & 5 deletions src/software/utils/main_imageProcessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ int aliceVision_main(int argc, char * argv[])
image::EImageColorSpace outputColorSpace = image::EImageColorSpace::LINEAR;
image::EStorageDataType storageDataType = image::EStorageDataType::Float;
std::string extension;
bool applyToneCurve = false;
image::ERawColorInterpretation rawColorInterpretation = image::ERawColorInterpretation::LibRawNoWhiteBalancing;
std::string colorProfileDatabaseDirPath = "";
bool errorOnMissingColorProfile = true;
Expand Down Expand Up @@ -678,9 +677,6 @@ int aliceVision_main(int argc, char * argv[])
("errorOnMissingColorProfile", po::value<bool>(&errorOnMissingColorProfile)->default_value(errorOnMissingColorProfile),
"Rise an error if a DCP color profiles database is specified but no DCP file matches with the camera model (maker+name) extracted from metadata (Only for raw images)")

("applyToneCurve", po::value<bool>(&applyToneCurve)->default_value(applyToneCurve),
"Apply color profile embedded tone curve if any.")

("storageDataType", po::value<image::EStorageDataType>(&storageDataType)->default_value(storageDataType),
("Storage data type: " + image::EStorageDataType_informations()).c_str())

Expand Down Expand Up @@ -801,7 +797,6 @@ int aliceVision_main(int argc, char * argv[])
options.rawColorInterpretation = rawColorInterpretation;
}
options.colorProfileFileName = view.getColorProfileFileName();
options.applyToneCurve = applyToneCurve;

// Read original image
image::Image<image::RGBAfColor> image;
Expand Down

0 comments on commit 1eff04c

Please sign in to comment.