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

New LDR2HDR software #613

Merged
merged 24 commits into from
Jun 17, 2019
Merged

New LDR2HDR software #613

merged 24 commits into from
Jun 17, 2019

Conversation

ToukL
Copy link
Contributor

@ToukL ToukL commented Mar 12, 2019

Features list

  • Add Robertson HDR algorithm
  • Add HDR command line
  • Add Debevec HDR algorithm
  • Add Grossberg HDR algorithm
  • Add parameters to control target exposure and extreme radiance values in HDR image

("targetExposureTime,e", po::value<std::string>(&target),
"target exposure time for the output HDR image to be centered")
("threshold,t", po::value<float>(&threshold)->default_value(threshold),
"threshold for clamped value (0 for no correction, 0.5 for inside lights and 1 for outside lights");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxLightingWeight for pixels saturated in all images: use 0 for no correction, 0.5 for interior lighting and 1 for outdoor lighting.



image::writeImage(outputHDRImagePath, image, image::EImageColorSpace::NO_CONVERSION);
if(!outputResponsePath.empty()) response.write(outputResponsePath);


// test of recovery of source target image from HDR
// recoverSourceImage(image, response, channelQuantization, "/s/prods/mvg/_source_global/samples/HDR_selection/MPC/0/Mikros/recovered_test.exr", meanVal);
recoverSourceImage(image, response, channelQuantization, "/s/prods/mvg/_source_global/samples/HDR_selection/terrasse_2/Mikros/Centrage_expos/recovered_from_Gros_bonsCoeff_meanCurve.exr", meanVal);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a debug option for that, if the optional argument is empty skip the export.

return _radiance[group];
}

private:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add doxygen doc on member variables

* @brief
* @param[in] groups
* @param[out] response
* @param[in] times
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params doc

//initialize radiance
for(std::size_t g = 0; g < ldrImageGroups.size(); ++g)
{
merge.process(ldrImageGroups[g], times[g], weight, response, _radiance[g], targetTime, threshold, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it makes sense to expose the threshold parameter used here.

@fabiencastan fabiencastan changed the title [WIP] add high dynamic range algorithm [WIP] New LDR2HDR software Jun 10, 2019
for(auto& entry: fs::directory_iterator(fs::path(imageFolder)))

// const std::vector<std::string> validExtensions = {".jpg", ".jpeg", ".png", ".cr2", ".tiff", ".tif", ".rw2"};
const std::regex validExtensions("\\.(?:jpg|jpeg|png|cr2|tiff|tif|rw2)");
Copy link
Member

@fabiencastan fabiencastan Jun 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const std::regex validExtensions("\\.(?:"
// Basic image file extensions
"jpg|jpeg|png|tiff|tif|"
// RAW image file extensions:
"3fr|" // Hasselblad
"arw|" // Sony
"crw|cr2|cr3|" // Canon
"dng|" // Adobe
"kdc|" // Kodak
"mrw|" // Minolta
"nef|nrw|" // Nikon
"orf|" // Olympus
"ptx|pef|" // Pentax
"raf|" // Fuji
"R3D|" // RED
"rw2|" // Panasonic
"srw|" // Samsung
"x3f" // Sigma
")"
);

@@ -101,10 +101,10 @@ void DebevecCalibrate::process(const std::vector< std::vector< image::Image<imag
Vec x = solver.solve(b);
if(solver.info() != Eigen::Success) return; // solving failed

std::cout << "system solved" << std::endl;
// std::cout << "system solved" << std::endl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ALICEVISION_LOG_TRACE("DebevecCalibrate: system solved");
And same for all other cout.

@fabiencastan fabiencastan changed the title [WIP] New LDR2HDR software New LDR2HDR software Jun 14, 2019
std::vector<std::string> stemImages;
std::vector<std::string> nameImages;

const std::regex validExtensions("\\.(?:"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const std::string validExtensions(
  // Basic image file extensions
  "jpg|jpeg|png|tiff|tif|"
  // RAW image file extensions:
  "3fr|" // Hasselblad
  "arw|" // Sony
....
);
const std::regex validExtensionsExp("\\.(?:" + extensions + ")");

}
if(inputImagesNames.empty())
{
ALICEVISION_LOG_ERROR("No valid input images. Please give a list of LDR images or a folder path containing them (accepted formats are: .jpg .jpeg .png .tif .tiff .cr2 .rw2");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ALICEVISION_LOG_ERROR("No valid input images. Please give a list of LDR images or a folder path containing them (accepted formats are: " << validExtensions << ")")

image::readImage(imagePath, ldrImages.at(i), image::EImageColorSpace::SRGB);

// test image conversion to sRGB
// image::writeImage(std::string("/s/prods/mvg/_source_global/samples/HDR_selection/terrasse_2/Mikros/sources/JPG/" + nameImages.at(i) + ".jpg"), ldrImages.at(i), image::EImageColorSpace::NO_CONVERSION);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

// Debevec and Robertson algorithms use shutter speed as ev value
float shutter;
try
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// TODO: in the future, we should use EVs instead of just shutter speed.

switch(calibrationMethod)
if(!inputResponsePath.empty())
{
goto MERGE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use goto.

{
goto MERGE;
}
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(inputResponsePath.empty())

@fabiencastan fabiencastan merged commit 774904f into develop Jun 17, 2019
@fabiencastan fabiencastan deleted the dev_hdr branch June 17, 2019 17:42
@fabiencastan fabiencastan added this to the 2019.2 milestone Jun 17, 2019
merge.process(ldrImageGroups_sorted.at(0), ldrTimes_sorted, fusionWeight, response, image, targetTime, false, clampedValueCorrection);


image::writeImage(outputHDRImagePath, image, image::EImageColorSpace::NO_CONVERSION);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ToukL Add metadata from the input image used as target exposure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants