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 hdri stitching software #678

Merged
merged 182 commits into from
Jan 14, 2020
Merged

New hdri stitching software #678

merged 182 commits into from
Jan 14, 2020

Conversation

ToukL
Copy link
Contributor

@ToukL ToukL commented Aug 7, 2019

Description

Stitch fisheye images into 360° panorama with simple geometric transformations, without undistortion or feature matching.

Features list

  • Take a folder or a list of fisheye images and return a 360° panorama image file.
  • Project fisheye into equirectangular space.
  • Stitch all images together with an "over" merge operation (Aa + B(1-a)).
  • User can correct each image rotation on all axes.

for(const std::string& format: supportedFormat)
{
std::vector<std::string> extensions;
std::string str = format.substr(format.find(":")+1);
Copy link
Member

Choose a reason for hiding this comment

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

const

@@ -93,7 +93,7 @@ float sigmoid(float x, float sigwidth, float sigMid)
* @param[out] buffer - to store input metadata in output image
* @param[out] imageAlpha - output RGBAf fisheye image correctly oriented
*/
void setFisheyeImage(image::Image<image::RGBfColor>& imageIn, oiio::ImageBuf& buffer, image::Image<image::RGBAfColor>& imageAlpha)
void setFisheyeImage(image::Image<image::RGBfColor>& imageIn, const float blurWidth_param, oiio::ImageBuf& buffer, image::Image<image::RGBAfColor>& imageAlpha)
Copy link
Member

Choose a reason for hiding this comment

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

const not necessary with primitive type

const float maxRadius = std::min(width, height) * 0.5 * 0.95;
const float blurWidth = maxRadius * 0.2;
const float blurMid = maxRadius * 0.95;
const float maxRadius = std::min(width, height) * 0.5;
Copy link
Member

Choose a reason for hiding this comment

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

.5f

@@ -188,7 +188,7 @@ void fisheyeToEquirectangular(image::Image<image::RGBAfColor>& imageIn, const in
* @param[in] rotations - contains adjustment rotations on each image set by user
* @param[out] outputFolder - output folder path to write panorama
*/
void stitchPanorama(const std::vector<std::string>& imagePaths, const std::vector<oiio::ParamValueList>& metadatas, const std::array<std::vector<double>, 3> rotations, std::string& outputPath)
void stitchPanorama(const std::vector<std::string>& imagePaths, const std::vector<oiio::ParamValueList>& metadatas, const float blurWidth, const std::array<std::vector<double>, 3> rotations, std::string& outputPath)
Copy link
Member

Choose a reason for hiding this comment

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

  • no const for float
  • missing & for rotations

@@ -362,7 +370,11 @@ namespace aliceVision
T( ( Z )( *this )( 3 ) * val ) );
}
};

/// Instantiation for unsigned char color component
Copy link
Member

Choose a reason for hiding this comment

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

using RGBAColor = Rgba<unsigned char>

{
imagePaths.push_back(path.string());

oiio::ParamValueList metadata = image::readImageMetadata(entry);
Copy link
Member

Choose a reason for hiding this comment

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

const

boost::smatch what;
if(boost::regex_search(dateTime, what, dateTimeExp))
{
times.push_back(24.0 * std::stof(what["h"]) + 60.0 * std::stof(what["m"]) + std::stof(what["s"]));
Copy link
Member

Choose a reason for hiding this comment

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

since this part is repeated here and in the previous if branch, maybe consider to refactor it into a function. the only difference is that here you are doing something with a single file, in the previous one you are doing the exact same thing for each file in the directory

return EXIT_FAILURE;
}

int nbImages = imagePaths.size();
Copy link
Member

Choose a reason for hiding this comment

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

const auto


// sort images according to their metadata "DateTime"
std::sort(times_sorted.begin(), times_sorted.end());
for(int i=0; i<nbImages; ++i)
Copy link
Member

Choose a reason for hiding this comment

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

std::size_t i

std::vector<float>::iterator it = std::find(times.begin(), times.end(), times_sorted[i]);
if(it != times.end())
{
std::size_t index = std::distance(times.begin(), it);
Copy link
Member

Choose a reason for hiding this comment

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

const

@simogasp simogasp added this to the 2019.3 milestone Aug 8, 2019
@fabiencastan fabiencastan merged commit 37ead81 into develop Jan 14, 2020
@fabiencastan fabiencastan deleted the dev_hdri_stitching branch January 14, 2020 15:15
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.

5 participants