-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[GSoC] Add Submaps and PoseGraph optimization for Large Scale Depth Fusion #2619
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
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
4dbdee4
Merge pull request #1 from opencv/master
akashsharma02 dcbe5a8
Merge remote-tracking branch 'upstream/master'
akashsharma02 a7c3ab0
Merge remote-tracking branch 'upstream/master'
akashsharma02 3fa8a3c
- Add HashTSDF class
akashsharma02 98ce3d0
Integration seems to be working, raycasting does not
akashsharma02 01a172c
Update integration code
akashsharma02 5a3f537
Integration and Raycasting fixes, (both work now)
akashsharma02 9b5b0ce
- Format code
akashsharma02 bdbafd0
Add Kinect Fusion backup file
akashsharma02 70b1dfb
- Add interpolation for vertices and normals (slow and unreliable!)
akashsharma02 fcfd6dd
Bug fix for integration and noisy odometry
akashsharma02 ddf5c18
- Create volume abstract class
akashsharma02 a00d7eb
- Add getPoints and getNormals function
akashsharma02 75656bd
- Add tests for hashTSDF
akashsharma02 776c8f8
Merge branch 'master' of https://github.com/opencv/opencv_contrib
akashsharma02 d5ccfde
- Use CRTP based static polymorphism to choose between CPU and GPU for
akashsharma02 8eaa125
Create submap and submapMgr
akashsharma02 362ec1a
Early draft of posegraph and submaps (Doesn't even compile)
akashsharma02 7264be2
Minor cleanup (no compilation)
akashsharma02 a96cf66
Track all submaps (no posegraph update yet)
akashsharma02 02fd312
Return inliers from ICP for weighting the constraints
akashsharma02 034970a
Add updating constraints between submaps and retain same current map
akashsharma02 8553212
Fix constraints creation between submaps and allow for switching between
akashsharma02 05db54b
- Fix bug in allocate volumeUnits
akashsharma02 5085884
Remove inlier calculation in fast_icp (not required)
akashsharma02 de7ba96
Modify readFile to allow reading other datasets easily
akashsharma02 963b086
- Implement posegraph update, Gauss newton is unstable
akashsharma02 713cdef
Implement simplified levenberg marquardt
akashsharma02 64dca2f
Merge branch 'master' of https://github.com/opencv/opencv_contrib int…
akashsharma02 bac316b
Bug fixes for Levenberg Marquardt and minor changes
akashsharma02 bbe56b7
minor changes
akashsharma02 6c0cd5c
Fixes, but Optimizer is still not well behaved
akashsharma02 53b149d
Working Ceres optimizer
akashsharma02 5ede5b1
- Reorganize IO code for samples in a separate file
akashsharma02 386b2ac
- Reorganize IO code for samples in a separate file
akashsharma02 4099a0e
Merge branch 'submap' of https://github.com/akashsharma02/opencv_cont…
akashsharma02 60523b6
- Add Python bindings for volume struct
akashsharma02 aea037a
- Remove dynafu::Params() since it is identical to kinfu::Params()
akashsharma02 fe01b57
Merge branch 'master' of https://github.com/akashsharma02/opencv_cont…
akashsharma02 9599c3a
Minor API changes
akashsharma02 b5051a4
Merge branch 'master' of https://github.com/opencv/opencv_contrib int…
akashsharma02 dfce899
Minor
akashsharma02 8f82ccc
Merge branch 'master' of https://github.com/opencv/opencv_contrib int…
akashsharma02 48ee51e
Remove CRTP for HashTSDF class
akashsharma02 daa800f
Bug fixes for HashTSDF integration
akashsharma02 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 hidden or 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 |
---|---|---|
@@ -1,2 +1,11 @@ | ||
set(the_description "RGBD algorithms") | ||
|
||
find_package(Ceres QUIET) | ||
ocv_define_module(rgbd opencv_core opencv_calib3d opencv_imgproc OPTIONAL opencv_viz WRAP python) | ||
ocv_target_link_libraries(${the_module} ${CERES_LIBRARIES}) | ||
|
||
if(Ceres_FOUND) | ||
ocv_target_compile_definitions(${the_module} PUBLIC CERES_FOUND) | ||
else() | ||
message(STATUS "CERES support is disabled. Ceres Solver is Required for Posegraph optimization") | ||
endif() |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,143 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html | ||
|
||
// This code is also subject to the license terms in the LICENSE_KinectFusion.md file found in this | ||
// module's directory | ||
|
||
#ifndef __OPENCV_RGBD_LARGEKINFU_HPP__ | ||
#define __OPENCV_RGBD_LARGEKINFU_HPP__ | ||
|
||
#include <opencv2/rgbd/volume.hpp> | ||
|
||
#include "opencv2/core.hpp" | ||
#include "opencv2/core/affine.hpp" | ||
|
||
namespace cv | ||
{ | ||
namespace large_kinfu | ||
{ | ||
struct CV_EXPORTS_W Params | ||
{ | ||
/** @brief Default parameters | ||
A set of parameters which provides better model quality, can be very slow. | ||
*/ | ||
CV_WRAP static Ptr<Params> defaultParams(); | ||
|
||
/** @brief Coarse parameters | ||
A set of parameters which provides better speed, can fail to match frames | ||
in case of rapid sensor motion. | ||
*/ | ||
CV_WRAP static Ptr<Params> coarseParams(); | ||
|
||
/** @brief HashTSDF parameters | ||
A set of parameters suitable for use with HashTSDFVolume | ||
*/ | ||
CV_WRAP static Ptr<Params> hashTSDFParams(bool isCoarse); | ||
|
||
/** @brief frame size in pixels */ | ||
CV_PROP_RW Size frameSize; | ||
|
||
/** @brief camera intrinsics */ | ||
CV_PROP_RW Matx33f intr; | ||
|
||
/** @brief pre-scale per 1 meter for input values | ||
Typical values are: | ||
* 5000 per 1 meter for the 16-bit PNG files of TUM database | ||
* 1000 per 1 meter for Kinect 2 device | ||
* 1 per 1 meter for the 32-bit float images in the ROS bag files | ||
*/ | ||
CV_PROP_RW float depthFactor; | ||
|
||
/** @brief Depth sigma in meters for bilateral smooth */ | ||
CV_PROP_RW float bilateral_sigma_depth; | ||
/** @brief Spatial sigma in pixels for bilateral smooth */ | ||
CV_PROP_RW float bilateral_sigma_spatial; | ||
/** @brief Kernel size in pixels for bilateral smooth */ | ||
CV_PROP_RW int bilateral_kernel_size; | ||
|
||
/** @brief Number of pyramid levels for ICP */ | ||
CV_PROP_RW int pyramidLevels; | ||
|
||
/** @brief Minimal camera movement in meters | ||
Integrate new depth frame only if camera movement exceeds this value. | ||
*/ | ||
CV_PROP_RW float tsdf_min_camera_movement; | ||
|
||
/** @brief light pose for rendering in meters */ | ||
CV_PROP_RW Vec3f lightPose; | ||
|
||
/** @brief distance theshold for ICP in meters */ | ||
CV_PROP_RW float icpDistThresh; | ||
/** @brief angle threshold for ICP in radians */ | ||
CV_PROP_RW float icpAngleThresh; | ||
/** @brief number of ICP iterations for each pyramid level */ | ||
CV_PROP_RW std::vector<int> icpIterations; | ||
|
||
/** @brief Threshold for depth truncation in meters | ||
All depth values beyond this threshold will be set to zero | ||
*/ | ||
CV_PROP_RW float truncateThreshold; | ||
|
||
/** @brief Volume parameters | ||
*/ | ||
kinfu::VolumeParams volumeParams; | ||
}; | ||
|
||
/** @brief Large Scale Dense Depth Fusion implementation | ||
|
||
This class implements a 3d reconstruction algorithm for larger environments using | ||
Spatially hashed TSDF volume "Submaps". | ||
It also runs a periodic posegraph optimization to minimize drift in tracking over long sequences. | ||
Currently the algorithm does not implement a relocalization or loop closure module. | ||
Potentially a Bag of words implementation or RGBD relocalization as described in | ||
Glocker et al. ISMAR 2013 will be implemented | ||
|
||
It takes a sequence of depth images taken from depth sensor | ||
(or any depth images source such as stereo camera matching algorithm or even raymarching | ||
renderer). The output can be obtained as a vector of points and their normals or can be | ||
Phong-rendered from given camera pose. | ||
|
||
An internal representation of a model is a spatially hashed voxel cube that stores TSDF values | ||
which represent the distance to the closest surface (for details read the @cite kinectfusion article | ||
about TSDF). There is no interface to that representation yet. | ||
|
||
For posegraph optimization, a Submap abstraction over the Volume class is created. | ||
New submaps are added to the model when there is low visibility overlap between current viewing frustrum | ||
and the existing volume/model. Multiple submaps are simultaneously tracked and a posegraph is created and | ||
optimized periodically. | ||
|
||
LargeKinfu does not use any OpenCL acceleration yet. | ||
To enable or disable it explicitly use cv::setUseOptimized() or cv::ocl::setUseOpenCL(). | ||
|
||
This implementation is inspired from Kintinuous, InfiniTAM and other SOTA algorithms | ||
|
||
You need to set the OPENCV_ENABLE_NONFREE option in CMake to use KinectFusion. | ||
*/ | ||
class CV_EXPORTS_W LargeKinfu | ||
{ | ||
public: | ||
CV_WRAP static Ptr<LargeKinfu> create(const Ptr<Params>& _params); | ||
virtual ~LargeKinfu() = default; | ||
|
||
virtual const Params& getParams() const = 0; | ||
|
||
CV_WRAP virtual void render(OutputArray image, | ||
const Matx44f& cameraPose = Matx44f::eye()) const = 0; | ||
|
||
CV_WRAP virtual void getCloud(OutputArray points, OutputArray normals) const = 0; | ||
|
||
CV_WRAP virtual void getPoints(OutputArray points) const = 0; | ||
|
||
CV_WRAP virtual void getNormals(InputArray points, OutputArray normals) const = 0; | ||
|
||
CV_WRAP virtual void reset() = 0; | ||
|
||
virtual const Affine3f getPose() const = 0; | ||
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. Please use Matx44f instead, Affine3f has problems with Python bindings 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. Done. |
||
|
||
CV_WRAP virtual bool update(InputArray depth) = 0; | ||
}; | ||
|
||
} // namespace large_kinfu | ||
} // namespace cv | ||
#endif |
Oops, something went wrong.
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.
Docs should be rewritten 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.
Have modified the docs a bit. Do let me know if there are any concerns or issues.