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
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
8f4a0b0
[software] New software for stithing fisheye images in 360° panorama
ToukL Jul 25, 2019
737ed20
[cmake] add ILMBASE_INCLUDE_PATH to FindOpenImageIO
ToukL Jul 25, 2019
d21c101
[image] add instantiation for float RGBA pixel type
ToukL Jul 25, 2019
5077007
[image] add RGBA default constructor with all channels set to zero
ToukL Jul 25, 2019
bdd2b91
[image][Sampler] bug fix : call to default constructor
ToukL Jul 25, 2019
c7e842c
[software] add doxygen doc
ToukL Jul 26, 2019
4f733fa
[software] modify default rotation angles
ToukL Jul 26, 2019
b4c5454
[software] add option to give complete output path insted of folder
ToukL Jul 26, 2019
110be8d
Merge branch 'develop' into dev_hdri_stitching
ToukL Aug 7, 2019
6a02f93
[software] stitching: move buffer initialization
ToukL Aug 7, 2019
e577670
[software] stitching: bug fix on buffer copy
ToukL Aug 7, 2019
0d76793
[software] stitching: change log info description
ToukL Aug 7, 2019
4e49836
[imageIO] add isSuported function to check input image extension
ToukL Aug 8, 2019
0c69255
[software] stitchin: add log error message
ToukL Aug 8, 2019
363a664
[software] stitching: get only valid image files from input folder
ToukL Aug 8, 2019
670b54d
[software] stitching: add parameter to adjust blur width in alpha mask
ToukL Aug 8, 2019
9cf0d1d
[image] pixelTypes: replace all typedef by using
ToukL Aug 9, 2019
25cffd4
[imageIO] add const
ToukL Aug 9, 2019
b2aec22
[software] Stitching: add or remove const and clean code
ToukL Aug 9, 2019
78b8041
[software] Stitching: change class SphericalMaping to namespace
ToukL Aug 9, 2019
0e03fc1
[software] Stitching: add function to sort images by time
ToukL Aug 9, 2019
8edd995
[globalSfM] Add enum methods for rotations and translations
ToukL Aug 12, 2019
6de58b6
[sfm] Add panorama reconstruction engine based on global sfm
ToukL Aug 19, 2019
237b542
[software] New software for stitching panorama with feature matching
ToukL Aug 19, 2019
bb929c1
[globalSfM] Add max_angular_error for triplet rotation rejection
ToukL Aug 19, 2019
be120eb
[sfm] Add log infos
ToukL Aug 19, 2019
9cdfb96
[panorama] remove aliceVision namespace
ToukL Aug 26, 2019
e2fcd33
[panorama] move maxIterations as default parameter
ToukL Aug 28, 2019
d9df8fa
[panorama] move structure RelativeRotation from .cpp to .hpp
ToukL Aug 28, 2019
c18c79a
[sfm] include ReconstructionEngine_panorama.hpp
ToukL Aug 28, 2019
3a50728
[panorama] Add unit test for panorama SfM
ToukL Aug 28, 2019
e474a82
[software] panoramaEstimation: rename panorama into panoramaEstimatio…
fabiencastan Sep 18, 2019
191c1ac
[software] add WIP panoramaStitching
fabiencastan Sep 18, 2019
99f871b
[sfm] utils: minor change in alignment and add log
fabiencastan Sep 18, 2019
a231d7a
[camera] add backproject utility function
fabiencastan Sep 18, 2019
cbb4ed9
[sfm] alignment: fix orientation read from metadata
fabiencastan Sep 18, 2019
258e104
[software] panoramaStitching: use image metadata orientation in the h…
fabiencastan Sep 18, 2019
39a7783
[software] panoramaStitching: fix masking and contributions
fabiencastan Sep 18, 2019
b604455
[software] panoramaStitching: ad debugging param to compute only a su…
fabiencastan Sep 18, 2019
a9d51d1
[software] panoramaEstimation: remove colorize and change some log
fabiencastan Sep 18, 2019
4562124
[software] panoramaEstimation: change debug param code values
fabiencastan Sep 18, 2019
5f7f08e
[software] panoramaStitching: change debug option to stitch only a su…
fabiencastan Sep 18, 2019
55b73a8
[software] panoramaEstimation: add WIP option to refine
fabiencastan Sep 18, 2019
5bcf34d
modify pretty print such that it is not used for Eigen types.
servantftechnicolor Sep 24, 2019
a35fc75
Function transforming equirectangular coordinates to spherical coordi…
servantftechnicolor Sep 24, 2019
6fea9d1
Doing a cout on a static array doesn't work on my compiler. I just di…
servantftechnicolor Sep 24, 2019
87b63a7
DLT input coordinates have to be normalized before use.
servantftechnicolor Sep 24, 2019
4a6c18e
Remove concept of landmarks from panorama estimation
servantftechnicolor Sep 24, 2019
956fd99
Add the constraint2D concept. Describe explicitely a match between 2 …
servantftechnicolor Sep 24, 2019
9a87635
add some override keywords to remove warnings
servantftechnicolor Sep 25, 2019
030f79f
create some skeleton for ceres cost function for 2D constraints
servantftechnicolor Sep 25, 2019
7673f28
Adding panorama 2D constraints for bundle adjustment
servantftechnicolor Sep 25, 2019
fdeb437
remove useless code
servantftechnicolor Sep 25, 2019
382ce56
add panorama size estimation algorithm
servantftechnicolor Sep 25, 2019
7f5df6c
Adding distortion estimation in radial1
servantftechnicolor Sep 26, 2019
804a4af
adding check on reprojection
servantftechnicolor Sep 26, 2019
664e2c7
Add fisheye cost function for constraint ...
servantftechnicolor Sep 26, 2019
fce1909
Adding a skeleton for equidistant camera
servantftechnicolor Sep 27, 2019
f927ee3
Reader for ninja xml file
servantftechnicolor Sep 30, 2019
db13568
prior on rotation
servantftechnicolor Oct 1, 2019
8517dd4
amman working
servantftechnicolor Oct 1, 2019
e999483
corrections for xml read
servantftechnicolor Oct 2, 2019
1ed1753
Sign error in spherical mapping from equirectangular
servantftechnicolor Oct 3, 2019
a1c832e
Currently applying laplacian blending (WIP)
servantftechnicolor Oct 4, 2019
2d7c36c
Trying to make hdr work on stitching
servantftechnicolor Oct 7, 2019
cdab531
At least remove unused images ...
servantftechnicolor Oct 7, 2019
e223770
make sure output can be sorted alphabetically correctly
servantftechnicolor Oct 7, 2019
9099d78
backup
servantftechnicolor Oct 7, 2019
4bacac0
laplacian results
servantftechnicolor Oct 8, 2019
b8c299c
Still working on laplacian blending (wip)
servantftechnicolor Oct 9, 2019
6179a43
rescratch laplacian
servantftechnicolor Oct 11, 2019
84e86c0
Restart stitching for cleaner code
servantftechnicolor Oct 14, 2019
a74a294
laplacian
servantftechnicolor Oct 14, 2019
11c2c1f
some laplacian changes
servantftechnicolor Oct 15, 2019
fc86b28
fuly working laplacian
servantftechnicolor Oct 15, 2019
7745ae3
multi level warping
servantftechnicolor Oct 16, 2019
a5f3d0e
adding alphacompositer
servantftechnicolor Oct 17, 2019
640731f
wip borders
servantftechnicolor Oct 18, 2019
e5173ff
panorama
servantftechnicolor Oct 21, 2019
0629071
temporary hack for hdr rotation problem
servantftechnicolor Oct 21, 2019
1b3150e
Heuristics to lower memory usage for coordinates evaluation
servantftechnicolor Oct 22, 2019
75c1e9d
add heuristics for camera with fov>180
servantftechnicolor Oct 23, 2019
f6cf207
add new heuristics for large fov
servantftechnicolor Oct 23, 2019
a0020f7
Border bug
servantftechnicolor Oct 23, 2019
85112a4
Eigen modifications
servantftechnicolor Oct 23, 2019
457e72e
Bug in borders
servantftechnicolor Oct 23, 2019
98f1d1f
Parameter for panorama size
servantftechnicolor Oct 24, 2019
17b5d86
remove recover source image... it is not useful in the current pipeline
servantftechnicolor Oct 24, 2019
ecb6804
Rescratch LDR to HDR main to integrate into pipeline
servantftechnicolor Oct 25, 2019
fd99ee2
less memory usage
servantftechnicolor Oct 25, 2019
633f046
update to hdr
servantftechnicolor Oct 25, 2019
e68fa67
Revert "update to hdr"
servantftechnicolor Oct 25, 2019
1870454
Correct an error with the output sfm
servantftechnicolor Oct 25, 2019
95bb845
Some bug in stitching
servantftechnicolor Oct 25, 2019
802571c
remove commented code
servantftechnicolor Oct 25, 2019
a028475
Replace laplacian
servantftechnicolor Oct 25, 2019
fd795d1
Handle rotated images for unknown reason
servantftechnicolor Oct 25, 2019
5d748a1
forgot to update image size after rotation
servantftechnicolor Oct 25, 2019
3547e83
[software] stitching: minor change for openimageio 1.8.12
fabiencastan Nov 1, 2019
0f6ee90
[software] stitching: windows build compatibility (disable openmp on …
fabiencastan Nov 1, 2019
b2444a4
remove colorspace error when rotating
servantftechnicolor Nov 4, 2019
197a341
add rotation prior on sfmdata
servantftechnicolor Nov 6, 2019
861c1af
rotation constraints
servantftechnicolor Nov 7, 2019
8dbc7af
Ignore pose lock
servantftechnicolor Nov 7, 2019
d3a8181
A new node for camera downscale for faster stitching debug
servantftechnicolor Nov 7, 2019
0510a1d
rescale node
servantftechnicolor Nov 7, 2019
7ed0e60
Bounding box algorithm to be replaced
servantftechnicolor Nov 8, 2019
783d4ab
bugs with hdr
servantftechnicolor Nov 8, 2019
76598cf
add new constraints for bounding box
servantftechnicolor Nov 8, 2019
3c77d5d
[hdr] formatting changes
fabiencastan Nov 12, 2019
684d073
[hdr] add option to export RGB response function as html chart
fabiencastan Nov 12, 2019
c2b66f4
[hdr] clean hdr fusion
fabiencastan Nov 12, 2019
cb97617
[hdr] grossberg: use images paths in input (instead of all images)
fabiencastan Nov 12, 2019
020c427
[software] LDRToHDR: re-expose important options
fabiencastan Nov 12, 2019
3da66b7
Merge branch 'dev_hdri_stitching' of https://github.com/alicevision/A…
fabiencastan Nov 12, 2019
a53b414
Merge branch 'dev_hdri_stitching' of github.com:alicevision/AliceVisi…
servantftechnicolor Nov 12, 2019
b4f7dd1
splitting compositing with warping
servantftechnicolor Nov 13, 2019
426bf32
merge
servantftechnicolor Nov 14, 2019
8788e53
updates to pipeline on compositing
servantftechnicolor Nov 14, 2019
f3d5f8d
laplacian pyramid
servantftechnicolor Nov 15, 2019
0f3f161
currently working on laplacian pyramid
servantftechnicolor Nov 18, 2019
87777fc
WIP laplacian
servantftechnicolor Nov 19, 2019
6a729e6
[hdr] fix image size of the output hdr fusion
fabiencastan Nov 20, 2019
9c1cb2e
add radial4 for stitching
servantftechnicolor Nov 20, 2019
b65cc30
correct laplacian
servantftechnicolor Nov 20, 2019
f776121
Merge branch 'dev_hdri_stitching' of github.com:alicevision/AliceVisi…
servantftechnicolor Nov 21, 2019
168d6f3
some tests
servantftechnicolor Nov 22, 2019
c2696ea
add option for multiband
servantftechnicolor Nov 25, 2019
fdce092
trials without gaussians
servantftechnicolor Nov 26, 2019
6faa7b2
[hdr] wip changing highlight correction
fabiencastan Nov 26, 2019
bbcd5e0
[hdr] use general camera exposure instead of shutter speed
fabiencastan Nov 28, 2019
21a4f03
[software] LDRToHDR formatting
fabiencastan Nov 28, 2019
9ee8b30
[hdr] highlight correction is now a post-processing step
fabiencastan Nov 29, 2019
368ab28
[hdr] formatting
fabiencastan Nov 29, 2019
4e7ca46
[software] ldr2hdr: minor fix on calibrationNbPoints==0
fabiencastan Dec 2, 2019
d0f4d65
[hdr] fix identation
fabiencastan Dec 2, 2019
8303d14
sync with paris
servantftechnicolor Dec 3, 2019
4dddb5f
sync
servantftechnicolor Dec 3, 2019
cc37725
[hdr] fix triangular function
fabiencastan Dec 5, 2019
a5378aa
[hdr] specific case for longest exposure hdr merge
fabiencastan Dec 5, 2019
1d54f90
[hdr] export weight functions
fabiencastan Dec 5, 2019
3f99913
[hdr] replace plateau with plateauSigmoid
fabiencastan Dec 5, 2019
1f298ce
[hdr] rgbCurve: add gamma functions
fabiencastan Dec 5, 2019
42debb5
wip laplacian
servantftechnicolor Dec 6, 2019
c56cc20
[hdr] add new HDR calibration method named "Laguerre"
fabiencastan Dec 6, 2019
4af5ffc
[hdr] Laguerre: supports multiple images with the same exposure
fabiencastan Dec 9, 2019
a8d5d51
[hdr] move sampling in a dedicated file
fabiencastan Dec 9, 2019
a2330eb
[hdr] rename BundleAdjustmentCalibration into LaguerreBACalibration
fabiencastan Dec 9, 2019
00f8ae0
Bug on image border for sampler
servantftechnicolor Dec 9, 2019
a601611
WIP memory reduction
servantftechnicolor Dec 9, 2019
b86b7f5
[hdr] laguerre: update input exposures if refined
fabiencastan Dec 9, 2019
6bf245a
[hdr] laguerre: lock exposures if not refined
fabiencastan Dec 9, 2019
39744c1
[hdr] add weighting function in Laguerre and add image downscale in c…
fabiencastan Dec 9, 2019
ee19530
bug in pixel additions
servantftechnicolor Dec 10, 2019
7754b81
memory footprint reduction
servantftechnicolor Dec 10, 2019
0a6d674
memory reduction
servantftechnicolor Dec 10, 2019
5096d47
Merge branch 'dev_hdri_stitching' of https://github.com/alicevision/A…
fabiencastan Dec 10, 2019
d967fb8
add offsets to rotation for panorama
servantftechnicolor Dec 11, 2019
900def1
add bypass to HDR
servantftechnicolor Dec 11, 2019
e5c8877
some correction on alpha blending
servantftechnicolor Dec 11, 2019
c23879a
[hdr] laguerre: remove weighting
fabiencastan Dec 11, 2019
0002d13
[build] Eigen compatibility: use Matrix instead of Vector
fabiencastan Dec 11, 2019
339fcb5
Merge branch 'dev_hdri_stitching' of github.com:alicevision/AliceVisi…
servantftechnicolor Dec 12, 2019
cbb3e86
[software] LdrToHdr: rename parameters for highlight postprocessing
fabiencastan Dec 12, 2019
38e469a
[software] LdrToHdr: remove export of debug files
fabiencastan Dec 12, 2019
2aff5ae
[software] panoramaWarping: export images in AUTO (no impact as the o…
fabiencastan Dec 12, 2019
a712450
Hack to make things work for laplacian on borders ...
servantftechnicolor Dec 13, 2019
12689a1
[hdri] laguerre: fix incorrect Laguerre formula
fabiencastan Dec 13, 2019
a8fdf6f
[nodes] LDRToHDR: rename param to nbBrackets
fabiencastan Dec 13, 2019
c274b68
[sfmDataIO] disable resize heuristic as RAW images have a different s…
fabiencastan Dec 13, 2019
414ef86
Add option for compositer Type
servantftechnicolor Dec 16, 2019
df44721
compute seams globally and not iteratively
servantftechnicolor Dec 16, 2019
b41730d
forgot a debug output
servantftechnicolor Dec 16, 2019
587aacf
remove user file
fabiencastan Dec 16, 2019
2e7d7ac
[software] panoramaExternalInfo: update log
fabiencastan Dec 16, 2019
c0cd659
Change upscale function
servantftechnicolor Dec 18, 2019
ba8082b
numerical problem for bounding box when we exactly cross the loop
servantftechnicolor Dec 18, 2019
420d74f
add loop on upscale gaussian
servantftechnicolor Dec 18, 2019
a0a1d64
Merge branch 'dev_hdri_stitching' of https://github.com/alicevision/A…
fabiencastan Dec 18, 2019
0698c38
[software] PanoramaWarping: fix potential out-of-range access to arra…
fabiencastan Jan 3, 2020
66a2bec
[image] RGBA constructor: avoid auto alpha
fabiencastan Jan 3, 2020
790af00
minor code clean
fabiencastan Jan 3, 2020
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
3 changes: 2 additions & 1 deletion src/aliceVision/image/Sampler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ struct Sampler2d
_sampler( dx , coefs_x ) ;
_sampler( dy , coefs_y ) ;

typename RealPixel<T>::real_type res(0) ;
// Default color constructor init all channels to zero
typename RealPixel<T>::real_type res;

// integer position of sample (x,y)
const int grid_x = static_cast<int>( floor( x ) );
Expand Down
36 changes: 36 additions & 0 deletions src/aliceVision/image/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,27 @@ std::istream& operator>>(std::istream& in, EImageFileType& imageFileType)
return in;
}

bool isSupported(const std::string &ext)
{
static const std::string extensionList = oiio::get_string_attribute("extension_list");
std::vector<std::string> supportedExtensions;

std::vector<std::string> supportedFormat;
boost::split(supportedFormat, extensionList, boost::is_any_of(";"), boost::token_compress_on);
for(const std::string& format: supportedFormat)
{
std::vector<std::string> extensions;
const std::string str = format.substr(format.find(":")+1);
boost::split(extensions, str, boost::is_any_of(","), boost::token_compress_on);
for(std::string& extension: extensions)
supportedExtensions.push_back(extension.insert(0, "."));
}

const auto start = supportedExtensions.begin();
const auto end = supportedExtensions.end();
return (std::find(start, end, boost::to_lower_copy(ext)) != end);
}

// Warning: type conversion problems from string to param value, we may lose some metadata with string maps
oiio::ParamValueList getMetadataFromMap(const std::map<std::string, std::string>& metadataMap)
{
Expand Down Expand Up @@ -147,6 +168,11 @@ void getBufferFromImage(Image<unsigned char>& image, oiio::ImageBuf& buffer)
getBufferFromImage(image, oiio::TypeDesc::UINT8, 1, buffer);
}

void getBufferFromImage(Image<RGBAfColor>& image, oiio::ImageBuf& buffer)
{
getBufferFromImage(image, oiio::TypeDesc::FLOAT, 4, buffer);
}

void getBufferFromImage(Image<RGBAColor>& image, oiio::ImageBuf& buffer)
{
getBufferFromImage(image, oiio::TypeDesc::UINT8, 4, buffer);
Expand Down Expand Up @@ -348,6 +374,11 @@ void readImage(const std::string& path, Image<unsigned char>& image, EImageColor
readImage(path, oiio::TypeDesc::UINT8, 1, image, imageColorSpace);
}

void readImage(const std::string& path, Image<RGBAfColor>& image, EImageColorSpace imageColorSpace)
{
readImage(path, oiio::TypeDesc::FLOAT, 4, image, imageColorSpace);
}

void readImage(const std::string& path, Image<RGBAColor>& image, EImageColorSpace imageColorSpace)
{
readImage(path, oiio::TypeDesc::UINT8, 4, image, imageColorSpace);
Expand All @@ -368,6 +399,11 @@ void writeImage(const std::string& path, const Image<unsigned char>& image, EIma
writeImage(path, oiio::TypeDesc::UINT8, 1, image, imageColorSpace, metadata);
}

void writeImage(const std::string& path, const Image<RGBAfColor>& image, EImageColorSpace imageColorSpace, const oiio::ParamValueList& metadata)
{
writeImage(path, oiio::TypeDesc::FLOAT, 4, image, imageColorSpace, metadata);
}

void writeImage(const std::string& path, const Image<RGBAColor>& image, EImageColorSpace imageColorSpace, const oiio::ParamValueList& metadata)
{
writeImage(path, oiio::TypeDesc::UINT8, 4, image, imageColorSpace, metadata);
Expand Down
11 changes: 11 additions & 0 deletions src/aliceVision/image/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <OpenImageIO/paramlist.h>
#include <OpenImageIO/imagebuf.h>

#include <boost/algorithm/string.hpp>
#include <string>

namespace oiio = OIIO;
Expand Down Expand Up @@ -78,6 +79,13 @@ std::ostream& operator<<(std::ostream& os, EImageFileType imageFileType);
*/
std::istream& operator>>(std::istream& in, EImageFileType& imageFileType);

/**
* @brief Check if input image extension is supported by openImageIO ie exists in extension_list from imageio.h
* @param[in] ext - image extension
* @return true if valid extension
*/
bool isSupported(const std::string &ext);

/**
* @brief convert a metadata string map into an oiio::ParamValueList
* @param[in] metadataMap string map
Expand Down Expand Up @@ -117,6 +125,7 @@ void readImageMetadata(const std::string& path, int& width, int& height, std::ma
*/
void getBufferFromImage(Image<float>& image, oiio::ImageBuf& buffer);
void getBufferFromImage(Image<unsigned char>& image, oiio::ImageBuf& buffer);
void getBufferFromImage(Image<RGBAfColor>& image, oiio::ImageBuf& buffer);
void getBufferFromImage(Image<RGBAColor>& image, oiio::ImageBuf& buffer);
void getBufferFromImage(Image<RGBfColor>& image, oiio::ImageBuf& buffer);
void getBufferFromImage(Image<RGBColor>& image, oiio::ImageBuf& buffer);
Expand All @@ -129,6 +138,7 @@ void getBufferFromImage(Image<RGBColor>& image, oiio::ImageBuf& buffer);
*/
void readImage(const std::string& path, Image<float>& image, EImageColorSpace imageColorSpace);
void readImage(const std::string& path, Image<unsigned char>& image, EImageColorSpace imageColorSpace);
void readImage(const std::string& path, Image<RGBAfColor>& image, EImageColorSpace imageColorSpace);
void readImage(const std::string& path, Image<RGBAColor>& image, EImageColorSpace imageColorSpace);
void readImage(const std::string& path, Image<RGBfColor>& image, EImageColorSpace imageColorSpace);
void readImage(const std::string& path, Image<RGBColor>& image, EImageColorSpace imageColorSpace);
Expand All @@ -139,6 +149,7 @@ void readImage(const std::string& path, Image<RGBColor>& image, EImageColorSpace
* @param[in] image The output image buffer
*/
void writeImage(const std::string& path, const Image<unsigned char>& image, EImageColorSpace imageColorSpace, const oiio::ParamValueList& metadata = oiio::ParamValueList());
void writeImage(const std::string& path, const Image<RGBAfColor>& image, EImageColorSpace imageColorSpace, const oiio::ParamValueList& metadata = oiio::ParamValueList());
void writeImage(const std::string& path, const Image<RGBAColor>& image, EImageColorSpace imageColorSpace, const oiio::ParamValueList& metadata = oiio::ParamValueList());
void writeImage(const std::string& path, const Image<RGBfColor>& image, EImageColorSpace imageColorSpace, const oiio::ParamValueList& metadata = oiio::ParamValueList());
void writeImage(const std::string& path, const Image<RGBColor>& image, EImageColorSpace imageColorSpace, const oiio::ParamValueList& metadata = oiio::ParamValueList());
Expand Down
42 changes: 27 additions & 15 deletions src/aliceVision/image/pixelTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace aliceVision
template <typename T>
class Rgb : public Eigen::Matrix<T, 3, 1, 0, 3, 1>
{
typedef Eigen::Matrix<T, 3, 1, 0, 3, 1> Base;
typedef T TBase;
using Base = Eigen::Matrix<T, 3, 1, 0, 3, 1>;
using TBase = T;
public:

//------------------------------
Expand Down Expand Up @@ -177,17 +177,17 @@ namespace aliceVision
};

/// Instantiation for unsigned char color component
typedef Rgb<unsigned char> RGBColor;
using RGBColor = Rgb<unsigned char>;
/// Instantiation for float color component
typedef Rgb<float> RGBfColor;
using RGBfColor = Rgb<float>;

/**
* @brief RGBA templated pixel type
*/
template <typename T>
class Rgba : public Eigen::Matrix<T, 4, 1, 0, 4, 1>
{
typedef Eigen::Matrix<T, 4, 1, 0, 4, 1> Base;
using Base = Eigen::Matrix<T, 4, 1, 0, 4, 1>;
public:

//------------------------------
Expand All @@ -199,10 +199,9 @@ namespace aliceVision
* @param blue component value
* @param alpha component value
*/
inline Rgba( const T red, const T green, const T blue, const T alpha = static_cast<T>( 1 ) )
inline Rgba( const T red, const T green, const T blue, const T alpha = T(1) )
: Base( red, green, blue, alpha )
{

}

/**
Expand All @@ -212,29 +211,38 @@ namespace aliceVision
explicit inline Rgba( const Base& val )
: Base( val )
{

}

/**
* @brief RGB constructor with default alpha value
* @brief RGBA constructor with default alpha value to 1
* @param val Value to set in each RGB component
* @note This is equivalent to RGBA( val , val , val , 1 )
*/
explicit inline Rgba( const T val = 0 )
: Base( val, val, val, static_cast<T>( 1 ) )
explicit inline Rgba( const T val )
: Base( val, val, val, T(1) )
{
}

/**
* @brief Default RGBA constructor set all channels to zero (including the alpha channel)
* @warning The alpha channel is initialized to 0.
* It is used in generic/templated code like "sampler"
* which creates an empty color and accumulate color contributions.
*/
explicit inline Rgba()
: Base( T(0), T(0), T(0), T(0) )
{
}

/**
* @brief Copy constructor
* @param val Source RGBA value
*/
inline Rgba( const RGBColor & val )
: Base( val.r(), val.g(), val.b(), static_cast<T>( 1 ) )
inline Rgba( const RGBColor & val, const T alpha = 1 )
: Base( val.r(), val.g(), val.b(), alpha )
{

}

//-- construction method
//------------------------------

Expand Down Expand Up @@ -362,7 +370,11 @@ namespace aliceVision
T( ( Z )( *this )( 3 ) * val ) );
}
};
typedef Rgba<unsigned char> RGBAColor;

/// 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>

using RGBAColor = Rgba<unsigned char>;
/// Instantiation for float color component
using RGBAfColor = Rgba<float>;

const RGBColor WHITE( 255, 255, 255 );
const RGBColor BLACK( 0, 0, 0 );
Expand Down
2 changes: 2 additions & 0 deletions src/aliceVision/sfm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(sfm_files_headers
pipeline/pairwiseMatchesIO.hpp
pipeline/RelativePoseInfo.hpp
pipeline/structureFromKnownPoses/StructureEstimationFromKnownPoses.hpp
pipeline/panorama/ReconstructionEngine_panorama.hpp
pipeline/regionsIO.hpp
utils/alignment.hpp
utils/statistics.hpp
Expand Down Expand Up @@ -41,6 +42,7 @@ set(sfm_files_sources
pipeline/RigSequence.cpp
pipeline/RelativePoseInfo.cpp
pipeline/structureFromKnownPoses/StructureEstimationFromKnownPoses.cpp
pipeline/panorama/ReconstructionEngine_panorama.cpp
pipeline/regionsIO.cpp
utils/alignment.cpp
utils/statistics.cpp
Expand Down
1 change: 1 addition & 0 deletions src/aliceVision/sfm/pipeline/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
add_subdirectory(sequential)
add_subdirectory(global)
add_subdirectory(panorama)

8 changes: 7 additions & 1 deletion src/aliceVision/sfm/pipeline/RelativePoseInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,22 @@ bool robustRelativePose(
max_iteration_count, &relativePose_info.essential_matrix, relativePose_info.initial_residual_tolerance);
relativePose_info.found_residual_precision = acRansacOut.first;

if (relativePose_info.vec_inliers.size() < SolverType::MINIMUM_SAMPLES * ALICEVISION_MINIMUM_SAMPLES_COEF )
if (relativePose_info.vec_inliers.size() < SolverType::MINIMUM_SAMPLES * ALICEVISION_MINIMUM_SAMPLES_COEF )
{
ALICEVISION_LOG_INFO("robustRelativePose: no sufficient coverage (the model does not support enough samples): " << relativePose_info.vec_inliers.size());
return false; // no sufficient coverage (the model does not support enough samples)
}

// estimation of the relative poses
Mat3 R;
Vec3 t;
if (!estimate_Rt_fromE(
K1, K2, x1, x2,
relativePose_info.essential_matrix, relativePose_info.vec_inliers, &R, &t))
{
ALICEVISION_LOG_INFO("robustRelativePose: cannot find a valid [R|t] couple that makes the inliers in front of the camera.");
return false; // cannot find a valid [R|t] couple that makes the inliers in front of the camera.
}

// Store [R|C] for the second camera, since the first camera is [Id|0]
relativePose_info.relativePose = geometry::Pose3(R, -R.transpose() * t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ bool GlobalSfMRotationAveragingSolver::Run(
ERotationAveragingMethod eRotationAveragingMethod,
ERelativeRotationInferenceMethod eRelativeRotationInferenceMethod,
const RelativeRotations& relativeRot_In,
const double max_angular_error,
HashMap<IndexT, Mat3>& map_globalR
) const
{
RelativeRotations relativeRotations = relativeRot_In;
// We work on a copy, since inference can remove some relative motions

ALICEVISION_LOG_DEBUG("GlobalSfMRotationAveragingSolver: A) relativeRotations.size(): " << relativeRotations.size());

//-> Test there is only one graph and at least 3 camera?
switch(eRelativeRotationInferenceMethod)
{
Expand All @@ -42,9 +45,13 @@ bool GlobalSfMRotationAveragingSolver::Run(
// Triplet inference (test over the composition error)
//-------------------
PairSet pairs = getPairs(relativeRotations);
ALICEVISION_LOG_DEBUG("GlobalSfMRotationAveragingSolver: pairs.size(): " << pairs.size());

std::vector< graph::Triplet > vec_triplets = graph::tripletListing(pairs);
//-- Rejection triplet that are 'not' identity rotation (error to identity > 5°)
TripletRotationRejection(5.0f, vec_triplets, relativeRotations);
ALICEVISION_LOG_DEBUG("GlobalSfMRotationAveragingSolver: vec_triplets.size(): " << vec_triplets.size());

//-- Rejection triplet that are 'not' identity rotation (error to identity > max_angular_error)
TripletRotationRejection(max_angular_error, vec_triplets, relativeRotations);

pairs = getPairs(relativeRotations);
const std::set<IndexT> set_remainingIds = graph::CleanGraph_KeepLargestBiEdge_Nodes<PairSet, IndexT>(pairs);
Expand Down Expand Up @@ -75,6 +82,9 @@ bool GlobalSfMRotationAveragingSolver::Run(
//- B. solve global rotation computation
bool bSuccess = false;
std::vector<Mat3> vec_globalR(_reindexForward.size());

ALICEVISION_LOG_DEBUG("GlobalSfMRotationAveragingSolver: B) vec_globalR.size(): " << vec_globalR.size());

switch(eRotationAveragingMethod)
{
case ROTATION_AVERAGING_L2:
Expand All @@ -84,11 +94,16 @@ bool GlobalSfMRotationAveragingSolver::Run(
_reindexForward.size(),
relativeRotations,
vec_globalR);

ALICEVISION_LOG_DEBUG("rotationAveraging::l2::L2RotationAveraging: success: " << bSuccess);
//- Non linear refinement of the global rotations
if (bSuccess)
{
bSuccess = rotationAveraging::l2::L2RotationAveraging_Refine(
relativeRotations,
vec_globalR);
ALICEVISION_LOG_DEBUG("rotationAveraging::l2::L2RotationAveraging_Refine: success: " << bSuccess);
}

// save kept pairs (restore original pose indices using the backward reindexing)
for(RelativeRotations::iterator iter = relativeRotations.begin(); iter != relativeRotations.end(); ++iter)
Expand All @@ -110,6 +125,7 @@ bool GlobalSfMRotationAveragingSolver::Run(
bSuccess = rotationAveraging::l1::GlobalRotationsRobust(
relativeRotations, vec_globalR, nMainViewID, 0.0f, &vec_inliers);

ALICEVISION_LOG_DEBUG("rotationAveraging::l1::GlobalRotationsRobust: success: " << bSuccess);
ALICEVISION_LOG_DEBUG("inliers: " << vec_inliers);

// save kept pairs (restore original pose indices using the backward reindexing)
Expand Down Expand Up @@ -170,6 +186,8 @@ void GlobalSfMRotationAveragingSolver::TripletRotationRejection(
const graph::Triplet & triplet = vec_triplets[i];
const IndexT I = triplet.i, J = triplet.j , K = triplet.k;

ALICEVISION_LOG_DEBUG("GlobalSfMRotationAveragingSolver::TripletRotationRejection: i: " << i << ", (" << I << ", " << J << ", " << K << ").");

//-- Find the three relative rotations
const Pair ij(I,J), ji(J,I);
const Mat3 RIJ = (map_relatives.count(ij)) ?
Expand Down Expand Up @@ -206,6 +224,10 @@ void GlobalSfMRotationAveragingSolver::TripletRotationRejection(
else
map_relatives_validated[ik] = map_relatives.at(ik);
}
else
{
ALICEVISION_LOG_DEBUG("GlobalSfMRotationAveragingSolver::TripletRotationRejection: i: " << i << ", angularErrorDegree: " << angularErrorDegree << ", max_angular_error: " << max_angular_error);
}
}
map_relatives = std::move(map_relatives_validated);

Expand Down
Loading