-
-
Notifications
You must be signed in to change notification settings - Fork 829
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
New LDR2HDR software #613
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
616a990
[hdr] New HDR module with Robertson calibration
ToukL f5b58d7
[software] New software for fusion of LDR images into HDR
ToukL 66ab190
[hdr] add some arguments for HDR software
ToukL ca10227
[WIP] add Debevec algorithm
ToukL 1bc7cc2
[hdr] add Grossberg algorithm
ToukL 9996e35
[hdr] Add some parameters
ToukL ff885e8
[hdr] Fix Grossberg algorithm
ToukL 850ed41
[hdr] Adapt weight curves to method
ToukL eeaf1c4
[hdr] Visual Studio build fixes
fabiencastan b9b0c7c
[cmake] new option ALICEVISION_BUILD_HDR
fabiencastan f808396
[image] clean log + remove unused code
ToukL 44402a3
[hdr] rename arguments and add options
ToukL 40a9ba2
[raw] bug fix: can now read several images in folder
ToukL 45e1865
[hdr] add log infos and raw extensions
ToukL dacdbc6
[hdr] bug fix: can take input camera response instead of calibration
ToukL eb19a70
[hdr] add doxygen doc and correct some parameters
ToukL b1c7a2c
[hdr] add argument to recover the target source image
ToukL c2742eb
[hdr] correct some infos
ToukL 9ce0481
[hdr] delete old file
ToukL 7f4db7d
[hdr] correct codacy issues
ToukL cc41fa0
[hdr] correct codacy issue
ToukL 050de85
[hdr] change cout to log info
ToukL f006315
[hdr] separate calibration method argument and input response file
ToukL a37b54c
[hdr] add log info and remove goto
ToukL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,6 @@ namespace fs = boost::filesystem; | |
|
||
enum class ECalibrationMethod | ||
{ | ||
NONE, | ||
LINEAR, | ||
ROBERTSON, | ||
DEBEVEC, | ||
|
@@ -51,7 +50,6 @@ inline std::string ECalibrationMethod_enumToString(const ECalibrationMethod cali | |
{ | ||
switch(calibrationMethod) | ||
{ | ||
case ECalibrationMethod::NONE: return "none"; | ||
case ECalibrationMethod::LINEAR: return "linear"; | ||
case ECalibrationMethod::ROBERTSON: return "robertson"; | ||
case ECalibrationMethod::DEBEVEC: return "debevec"; | ||
|
@@ -140,7 +138,8 @@ int main(int argc, char** argv) | |
std::vector<std::string> imagesFolder; | ||
std::string outputHDRImagePath; | ||
std::string outputResponsePath; | ||
std::string responseCalibrationName = ECalibrationMethod_enumToString(ECalibrationMethod::LINEAR); | ||
ECalibrationMethod calibrationMethod = ECalibrationMethod::LINEAR; | ||
std::string inputResponsePath; | ||
std::string calibrationWeightFunction = "default"; | ||
hdr::EFunctionType fusionWeightFunction = hdr::EFunctionType::GAUSSIAN; | ||
std::string target; | ||
|
@@ -160,8 +159,10 @@ int main(int argc, char** argv) | |
optionalParams.add_options() | ||
("outputResponse", po::value<std::string>(&outputResponsePath), | ||
"output response function path.") | ||
("responseCalibration,r", po::value<std::string>(&responseCalibrationName )->default_value(responseCalibrationName ), | ||
"method used for camera calibration (linear, robertson, debevec) or provide an external response file directly.") | ||
("calibrationMethod,m", po::value<ECalibrationMethod>(&calibrationMethod )->default_value(calibrationMethod ), | ||
"method used for camera calibration (linear, robertson, debevec).") | ||
("inputResponse,r", po::value<std::string>(&inputResponsePath ), | ||
"external camera response file path to fuse all LDR images together.") | ||
("calibrationWeight,w", po::value<std::string>(&calibrationWeightFunction)->default_value(calibrationWeightFunction), | ||
"weight function type (default, gaussian, triangle, plateau).") | ||
("fusionWeight,W", po::value<hdr::EFunctionType>(&fusionWeightFunction)->default_value(fusionWeightFunction), | ||
|
@@ -217,17 +218,15 @@ int main(int argc, char** argv) | |
std::vector<float> &ldrTimes = times.at(0); | ||
// std::vector<float> &ldrEv = ev.at(0); | ||
|
||
// set the correct calibration method corresponding to the string parameter | ||
ECalibrationMethod calibrationMethod; | ||
// read teh input response fiel or set the correct channel quantization according to the calibration method used | ||
std::size_t channelQuantization; | ||
if(fs::is_regular_file(fs::path(responseCalibrationName))) | ||
if(!inputResponsePath.empty()) | ||
{ | ||
response = hdr::rgbCurve(responseCalibrationName); // use the camera response function set in "responseCalibration", calibrationMethod is set to "none" | ||
response = hdr::rgbCurve(inputResponsePath); // use the camera response function set in "responseCalibration", calibrationMethod is set to "none" | ||
channelQuantization = response.getSize(); | ||
} | ||
else | ||
{ | ||
calibrationMethod = ECalibrationMethod_stringToEnum(responseCalibrationName); | ||
if(calibrationMethod == ECalibrationMethod::GROSSBERG) | ||
channelQuantization = std::pow(2, 10); //RAW 10 bit precision, 2^10 values between black and white point | ||
else | ||
|
@@ -248,7 +247,6 @@ int main(int argc, char** argv) | |
{ | ||
switch(calibrationMethod) | ||
{ | ||
case ECalibrationMethod::NONE: break; | ||
case ECalibrationMethod::LINEAR: break; | ||
case ECalibrationMethod::DEBEVEC: calibrationWeight.setTriangular(); | ||
case ECalibrationMethod::ROBERTSON: calibrationWeight.setRobertsonWeight(); | ||
|
@@ -399,52 +397,56 @@ int main(int argc, char** argv) | |
image::Image<image::RGBfColor> image(ldrImages.at(0).Width(), ldrImages.at(0).Height(), false); | ||
|
||
// calculate the response function according to the method given in argument or take the response provided by the user | ||
switch(calibrationMethod) | ||
if(!inputResponsePath.empty()) | ||
{ | ||
goto MERGE; | ||
} | ||
else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
case ECalibrationMethod::NONE: | ||
switch(calibrationMethod) | ||
{ | ||
case ECalibrationMethod::LINEAR: | ||
{ | ||
// set the response function to linear | ||
response.setLinear(); | ||
} | ||
break; | ||
} | ||
case ECalibrationMethod::LINEAR: | ||
{ | ||
// set the response function to linear | ||
response.setLinear(); | ||
} | ||
break; | ||
|
||
case ECalibrationMethod::DEBEVEC: | ||
{ | ||
case ECalibrationMethod::DEBEVEC: | ||
{ | ||
ALICEVISION_LOG_INFO("Debevec calibration"); | ||
const float lambda = channelQuantization * 1.f; | ||
const int nbPoints = 1000; | ||
hdr::DebevecCalibrate calibration; | ||
calibration.process(ldrImageGroups, channelQuantization, times, nbPoints, calibrationWeight, lambda, response); | ||
const float lambda = channelQuantization * 1.f; | ||
const int nbPoints = 1000; | ||
hdr::DebevecCalibrate calibration; | ||
calibration.process(ldrImageGroups, channelQuantization, times, nbPoints, calibrationWeight, lambda, response); | ||
|
||
response.exponential(); | ||
response.scale(); | ||
} | ||
break; | ||
response.exponential(); | ||
response.scale(); | ||
} | ||
break; | ||
|
||
case ECalibrationMethod::ROBERTSON: | ||
{ | ||
case ECalibrationMethod::ROBERTSON: | ||
{ | ||
ALICEVISION_LOG_INFO("Robertson calibration"); | ||
hdr::RobertsonCalibrate calibration(40); | ||
const int nbPoints = 1000000; | ||
calibration.process(ldrImageGroups_sorted, channelQuantization, times_sorted, nbPoints, calibrationWeight, targetTime, response); | ||
response.scale(); | ||
} | ||
break; | ||
hdr::RobertsonCalibrate calibration(40); | ||
const int nbPoints = 1000000; | ||
calibration.process(ldrImageGroups_sorted, channelQuantization, times_sorted, nbPoints, calibrationWeight, targetTime, response); | ||
response.scale(); | ||
} | ||
break; | ||
|
||
case ECalibrationMethod::GROSSBERG: | ||
{ | ||
case ECalibrationMethod::GROSSBERG: | ||
{ | ||
ALICEVISION_LOG_INFO("Grossberg calibration"); | ||
const int nbPoints = 1000000; | ||
hdr::GrossbergCalibrate calibration(5); | ||
calibration.process(ldrImageGroups_sorted, channelQuantization, times_sorted, nbPoints, calibrationWeight, response); | ||
const int nbPoints = 1000000; | ||
hdr::GrossbergCalibrate calibration(5); | ||
calibration.process(ldrImageGroups_sorted, channelQuantization, times_sorted, nbPoints, calibrationWeight, response); | ||
} | ||
break; | ||
} | ||
break; | ||
} | ||
|
||
MERGE: | ||
ALICEVISION_LOG_INFO("hdr fusion"); | ||
hdr::hdrMerge merge; | ||
merge.process(ldrImageGroups_sorted.at(0), ldrTimes_sorted, fusionWeight, response, image, targetTime, false, clampedValueCorrection); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use goto.