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
Show file tree
Hide file tree
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 Mar 28, 2019
f5b58d7
[software] New software for fusion of LDR images into HDR
ToukL Mar 28, 2019
66ab190
[hdr] add some arguments for HDR software
ToukL Mar 29, 2019
ca10227
[WIP] add Debevec algorithm
ToukL Apr 5, 2019
1bc7cc2
[hdr] add Grossberg algorithm
ToukL May 24, 2019
9996e35
[hdr] Add some parameters
ToukL Jun 3, 2019
ff885e8
[hdr] Fix Grossberg algorithm
ToukL Jun 3, 2019
850ed41
[hdr] Adapt weight curves to method
ToukL Jun 7, 2019
eeaf1c4
[hdr] Visual Studio build fixes
fabiencastan Jun 10, 2019
b9b0c7c
[cmake] new option ALICEVISION_BUILD_HDR
fabiencastan Jun 10, 2019
f808396
[image] clean log + remove unused code
ToukL Jun 11, 2019
44402a3
[hdr] rename arguments and add options
ToukL Jun 12, 2019
40a9ba2
[raw] bug fix: can now read several images in folder
ToukL Jun 12, 2019
45e1865
[hdr] add log infos and raw extensions
ToukL Jun 13, 2019
dacdbc6
[hdr] bug fix: can take input camera response instead of calibration
ToukL Jun 13, 2019
eb19a70
[hdr] add doxygen doc and correct some parameters
ToukL Jun 13, 2019
b1c7a2c
[hdr] add argument to recover the target source image
ToukL Jun 13, 2019
c2742eb
[hdr] correct some infos
ToukL Jun 14, 2019
9ce0481
[hdr] delete old file
ToukL Jun 14, 2019
7f4db7d
[hdr] correct codacy issues
ToukL Jun 14, 2019
cc41fa0
[hdr] correct codacy issue
ToukL Jun 14, 2019
050de85
[hdr] change cout to log info
ToukL Jun 14, 2019
f006315
[hdr] separate calibration method argument and input response file
ToukL Jun 14, 2019
a37b54c
[hdr] add log info and remove goto
ToukL Jun 14, 2019
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
8 changes: 4 additions & 4 deletions src/aliceVision/hdr/DebevecCalibrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void DebevecCalibrate::process(const std::vector< std::vector< image::Image<imag
std::vector<T> tripletList;
tripletList.reserve(2 * nbPoints*nbImages + 1 + 3 * channelQuantization);

std::cout << "filling A and b matrices" << std::endl;
// std::cout << "filling A and b matrices" << std::endl;

// include the data-fitting equations
for(unsigned int j=0; j<nbImages; ++j)
Expand Down Expand Up @@ -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.


double relative_error = (A*x - b).norm() / b.norm();
std::cout << "relative error is : " << relative_error << std::endl;
// double relative_error = (A*x - b).norm() / b.norm();
// std::cout << "relative error is : " << relative_error << std::endl;

for(std::size_t k=0; k<channelQuantization; ++k)
response.setValue(k, channel, x(k));
Expand Down
12 changes: 6 additions & 6 deletions src/aliceVision/hdr/GrossbergCalibrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void GrossbergCalibrate::process(const std::vector< std::vector< image::Image<im
Mat A = Mat::Zero(nbPoints*(nbImages-1), _dimension);
Vec b = Vec::Zero(nbPoints*(nbImages-1));

std::cout << "filling A and b matrices" << std::endl;
// std::cout << "filling A and b matrices" << std::endl;

for(unsigned int j=0; j<nbImages-1; ++j)
{
Expand Down Expand Up @@ -107,24 +107,24 @@ void GrossbergCalibrate::process(const std::vector< std::vector< image::Image<im
}
}

std::cout << "solving Ax=b system" << std::endl;
// std::cout << "solving Ax=b system" << std::endl;

// solve the system using QR decomposition
Eigen::HouseholderQR<Mat> solver(A);
Vec c = solver.solve(b);

std::cout << "system solved" << std::endl;
// std::cout << "system solved" << std::endl;

double relative_error = (A*c - b).norm() / b.norm();
std::cout << "relative error is : " << relative_error << std::endl;
// double relative_error = (A*c - b).norm() / b.norm();
// std::cout << "relative error is : " << relative_error << std::endl;

for(unsigned int i=0; i<_dimension; ++i)
{
std::vector<double> temp_hCurve = hCurves[i];
for(auto &value : temp_hCurve)
value *= c(i);

std::cout << c(i) << std::endl;
// std::cout << c(i) << std::endl;

std::transform(response.getCurve(channel).begin(), response.getCurve(channel).end(), temp_hCurve.begin(), response.getCurve(channel).begin(), std::plus<float>());
}
Expand Down
16 changes: 8 additions & 8 deletions src/aliceVision/hdr/RobertsonCalibrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,21 @@ void RobertsonCalibrate::process(const std::vector< std::vector< image::Image<im

for(std::size_t iter = 0; iter < _maxIteration; ++iter)
{
std::cout << "--> iteration : "<< iter << std::endl;
// std::cout << "--> iteration : "<< iter << std::endl;

std::cout << "1) compute radiance "<< std::endl;
// std::cout << "1) compute radiance "<< std::endl;
//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.

}

std::cout << "2) initialization new response "<< std::endl;
// std::cout << "2) initialization new response "<< std::endl;
//initialize new response
rgbCurve newResponse = rgbCurve(channelQuantization);
newResponse.setZero();

std::cout << "3) compute new response "<< std::endl;
// std::cout << "3) compute new response "<< std::endl;
//compute new response
for(unsigned int g = 0; g < ldrImageGroups.size(); ++g)
{
Expand Down Expand Up @@ -133,11 +133,11 @@ void RobertsonCalibrate::process(const std::vector< std::vector< image::Image<im
//dividing the response by the cardinal curve
newResponse *= card;

std::cout << "4) normalize response"<< std::endl;
// std::cout << "4) normalize response"<< std::endl;
//normalization
newResponse.normalize();

std::cout << "5) compute difference"<< std::endl;
// std::cout << "5) compute difference"<< std::endl;
//calculate difference between the old response and the new one
rgbCurve responseDiff = newResponse - response;
responseDiff.setAllAbsolute();
Expand All @@ -147,14 +147,14 @@ void RobertsonCalibrate::process(const std::vector< std::vector< image::Image<im
//update the response
response = newResponse;

std::cout << "6) check end condition"<< std::endl;
// std::cout << "6) check end condition"<< std::endl;
//check end condition
if(diff < _threshold)
{
std::cout << "[BREAK] difference < threshold " << std::endl;
break;
}
std::cout << "-> difference is " << diff << std::endl;
// std::cout << "-> difference is " << diff << std::endl;
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/aliceVision/hdr/hdrMerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ void hdrMerge::process(const std::vector< image::Image<image::RGBfColor> > &imag
const float threshold,
bool robCalibrate)
{
std::cout << "hdr merge" << std::endl;

//checks
assert(!response.isEmpty());
assert(!images.empty());
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/hdr/rgbCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void rgbCurve::normalize()
midValue = curve[middle];
}

std::cout << "-> middle [" << middle << "]: " << midValue <<std::endl;
// std::cout << "-> middle [" << middle << "]: " << midValue <<std::endl;
const float coefficient = 1 / midValue;

for(auto &value : curve)
Expand Down
7 changes: 7 additions & 0 deletions src/aliceVision/hdr/rgbCurve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ class rgbCurve
*/
rgbCurve(const std::string &path);

void resize(std::size_t newSize)
{
for(auto &curve : _data)
curve.resize(newSize);
assert(getSize() == newSize);
}

/**
* @brief set curves to zero
*/
Expand Down
Loading