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

Color checker detection and correction update #1532

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
93dac87
[colorCheckerCorrection]
demoulinv Sep 6, 2023
b7238ff
[colorCorrection] Add white balancing method in addition to luminance…
demoulinv Sep 7, 2023
28ac6c7
[colorCheckerCorrection] bugfix on sfmData forward.
demoulinv Sep 8, 2023
1bd7bbb
[colorCheckerDetection] Add option to launch the detection process on…
demoulinv Sep 9, 2023
077101a
[HDR merge] bugfix after rebase on view image update
demoulinv Sep 14, 2023
1bd407b
[colorCheckerCorrection] Add option to keep image name if different f…
demoulinv Sep 15, 2023
2d7dbf0
[colorCorrection] Add bypass option in correction method enumerator
demoulinv Sep 19, 2023
beeaa33
[colorCheckerCorrection]
demoulinv Sep 6, 2023
12a0c7f
[colorCorrection] Add white balancing method in addition to luminance…
demoulinv Sep 7, 2023
8c5bd87
[colorCheckerCorrection] bugfix on sfmData forward.
demoulinv Sep 8, 2023
886f2d5
[colorCheckerDetection] Add option to launch the detection process on…
demoulinv Sep 9, 2023
602bda5
[HDR merge] bugfix after rebase on view image update
demoulinv Sep 14, 2023
80716fe
[colorCheckerCorrection] Add option to keep image name if different f…
demoulinv Sep 15, 2023
518247d
[colorCorrection] Add bypass option in correction method enumerator
demoulinv Sep 19, 2023
2e88e75
[utils] ColorCheckerCorrection: Add a default value when retrieving c…
cbentejac Sep 21, 2023
6eedc7a
[utils] ColorCheckerDetection: Do not access out of range pixels
cbentejac Sep 21, 2023
ff90b3d
[utils] ColorCheckerDetection/Correction: Update software versions
cbentejac Sep 21, 2023
6d846d3
Merge branch 'dev/colorCheckerCorrection' of https://github.com/alice…
demoulinv Sep 22, 2023
5ed5323
[detection] Enable detection of all chart type supported by openCV an…
demoulinv Sep 27, 2023
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
28 changes: 21 additions & 7 deletions src/software/pipeline/main_LdrToHdrMerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ using namespace aliceVision;
namespace po = boost::program_options;
namespace fs = boost::filesystem;

std::string getHdrImagePath(const std::string& outputPath, std::size_t g, const std::string& rootname = "")
std::string getHdrImagePath(const std::string& outputPath, std::size_t g, const std::string& rootname = "", bool macbeth = false)
{
// Output image file path
std::stringstream sstream;
if (rootname == "")
{
sstream << "hdr_" << std::setfill('0') << std::setw(4) << g << ".exr";
sstream << "hdr_" << std::setfill('0') << std::setw(4) << g << (macbeth ? "_macbeth" : "") << ".exr";
}
else
{
sstream << rootname << ".exr";
sstream << rootname << (macbeth ? "_macbeth" : "") << ".exr";
}
const std::string hdrImagePath = (fs::path(outputPath) / sstream.str()).string();
return hdrImagePath;
Expand Down Expand Up @@ -354,7 +354,7 @@ int aliceVision_main(int argc, char** argv)
std::shared_ptr<sfmData::View> hdrView;

const auto & group = groups[g];

if (group.size() == 1)
{
hdrView = std::make_shared<sfmData::View>(*group.at(0));
Expand All @@ -370,8 +370,18 @@ int aliceVision_main(int argc, char** argv)
}
if (!byPass)
{
boost::filesystem::path p(targetViews[g]->getImage().getImagePath());
const std::string hdrImagePath = getHdrImagePath(outputPath, pos, keepSourceImageName ? p.stem().string() : "");
bool macbeth = false;
for(int k = 0; k < group.size(); k++)
{
const std::string fname = group[k]->getImage().getImagePath();
boost::filesystem::path p(fname);
macbeth = macbeth || (p.stem().string().find("_macbeth") != std::string::npos);
}
const std::string tgt_name = targetViews[g]->getImage().getImagePath();
macbeth = macbeth && ((tgt_name.find("_macbeth") == std::string::npos) || !keepSourceImageName);

boost::filesystem::path p(tgt_name);
const std::string hdrImagePath = getHdrImagePath(outputPath, pos, keepSourceImageName ? p.stem().string() : "", macbeth);
hdrView->getImage().setImagePath(hdrImagePath);
}
hdrView->getImage().addMetadata("AliceVision:ColorSpace", image::EImageColorSpace_enumToString(mergedColorSpace));
Expand Down Expand Up @@ -427,11 +437,14 @@ int aliceVision_main(int argc, char** argv)
std::shared_ptr<sfmData::View> targetView = targetViews[g];
std::vector<sfmData::ExposureSetting> exposuresSetting(group.size());

bool macbeth = false;
// Load all images of the group
for(std::size_t i = 0; i < group.size(); ++i)
{
const std::string filepath = group[i]->getImage().getImagePath();
ALICEVISION_LOG_INFO("Load " << filepath);
boost::filesystem::path p(filepath);
macbeth = macbeth || (p.stem().string().find("_macbeth") != std::string::npos);

image::ImageReadOptions options;
options.workingColorSpace = workingColorSpace;
Expand Down Expand Up @@ -493,7 +506,8 @@ int aliceVision_main(int argc, char** argv)
}

boost::filesystem::path p(targetView->getImage().getImagePath());
const std::string hdrImagePath = getHdrImagePath(outputPath, pos, keepSourceImageName ? p.stem().string() : "");
macbeth = macbeth && ((p.stem().string().find("_macbeth") == std::string::npos) || !keepSourceImageName);
const std::string hdrImagePath = getHdrImagePath(outputPath, pos, keepSourceImageName ? p.stem().string() : "", macbeth);

// Write an image with parameters from the target view
std::map<std::string, std::string> viewMetadata = targetView->getImage().getMetadata();
Expand Down
Loading