Skip to content

Commit

Permalink
Improve Documentation - Fix code links and improve tutorial layout (#…
Browse files Browse the repository at this point in the history
…6321)

* Correct code tagging in interactive_visualization tutorial.

* Highlight the methods that are being introduced at the start.

* Non-Blocking VIZ - Add add_geometry step which is not optional.

* Non-Blocking VIZ - Split main code to simpler function and fix code blocks in docs.

* Fix Typos

* Update docs with new argument values.

* Fix grammar and dedent for overly indented code

* Integrate_Custom - Optimize imports, add early return, use f-strings and remove unnecessary parentheses.

* Fix default value and remove BooleanOptionalAction, its only available >= python 3.9

* Disable use of cuda for tensor based reconstruction

* Customized Integration - Fix code lines

* Ray Casting - Fix code lines

* Dense Slam - Fix code lines and slight grammar.

* Fix some f-strings and extra parantheses

* Make Fragments - Fix code lines

* Code for batch processing was removed long back in #521 in 2018

* Register Fragments - Fix code docs

* Register fragments - Fix code lines

* Integrate Scene - Fix code lines

* Change layout of tutorials - only done at top level.

* Add new lines before bullet/numbered list, else list rendering fails.

* Bugfix - Fix code lines for Integration and add filename as done in v0.14.0

* Remove python version 3.6 as supported versions by open3d.

* Fix line number using lineno-match directive.

* Fix some typos detected automatically.

* Replace prepend with lineno-match

* Correct filename documented in the files

* Fix lineno-start.

* Fix PR comments

* Revert "Code for batch processing was removed long back in #521 in 2018"

This reverts commit d65fb67.

* Correct batch processing section documentation and native multiprocessing.

* Use native multiprocessing for register fragments and refinement of registration

---------

Co-authored-by: Sameer Sheorey <41028320+ssheorey@users.noreply.github.com>
  • Loading branch information
saurabheights and ssheorey authored Sep 26, 2023
1 parent b2f5cef commit f1a0f3e
Show file tree
Hide file tree
Showing 40 changed files with 359 additions and 310 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ For more, please visit the [Open3D documentation](http://www.open3d.org/docs).
## Python quick start

Pre-built pip packages support Ubuntu 18.04+, macOS 10.15+ and Windows 10+
(64-bit) with Python 3.6-3.10.
(64-bit) with Python 3.7-3.10.

```bash
# Install
Expand Down
2 changes: 1 addition & 1 deletion cpp/open3d/core/AdvancedIndexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void AdvancedIndexPreprocessor::RunPreprocess() {
// If the indexed_shape_ contains a dimension of size 0 but the
// replacement shape does not, the index is out of bounds. This is because
// there is no valid number to index an empty tensor.
// Normally, out of bounds is detected in the advanded indexing kernel. We
// Normally, out of bounds is detected in the advanced indexing kernel. We
// detected here for more helpful error message.
auto contains_zero = [](const SizeVector& vals) -> bool {
return std::any_of(vals.begin(), vals.end(),
Expand Down
4 changes: 2 additions & 2 deletions cpp/open3d/core/AdvancedIndexing.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AdvancedIndexPreprocessor {
const Tensor& tensor, const std::vector<Tensor>& index_tensors);

/// Expand all tensors to the broadcasted shape, 0-dim tensors are ignored.
/// Thorws exception if the common broadcasted shape does not exist.
/// Throws exception if the common broadcasted shape does not exist.
static std::pair<std::vector<Tensor>, SizeVector>
ExpandToCommonShapeExceptZeroDim(const std::vector<Tensor>& index_tensors);

Expand Down Expand Up @@ -127,7 +127,7 @@ class AdvancedIndexer {
if (indexed_shape.size() != indexed_strides.size()) {
utility::LogError(
"Internal error: indexed_shape's ndim {} does not equal to "
"indexd_strides' ndim {}",
"indexed_strides' ndim {}",
indexed_shape.size(), indexed_strides.size());
}
num_indices_ = indexed_shape.size();
Expand Down
2 changes: 1 addition & 1 deletion cpp/open3d/geometry/BoundingVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AxisAlignedBoundingBox;
/// \brief A bounding box oriented along an arbitrary frame of reference.
///
/// The oriented bounding box is defined by its center position, rotation
/// maxtrix and extent.
/// matrix and extent.
class OrientedBoundingBox : public Geometry3D {
public:
/// \brief Default constructor.
Expand Down
2 changes: 1 addition & 1 deletion cpp/open3d/geometry/VoxelGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class VoxelGrid : public Geometry3D {
public:
/// Size of the voxel.
double voxel_size_ = 0.0;
/// Coorindate of the origin point.
/// Coordinate of the origin point.
Eigen::Vector3d origin_ = Eigen::Vector3d::Zero();
/// Voxels contained in voxel grid
std::unordered_map<Eigen::Vector3i,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace impl {
/// \param texture_alignment The texture alignment in bytes. This is used
/// for allocating segments within the temporary memory.
///
/// \param filter_backrop Output array for the computed filter gradient
/// \param filter_backprop Output array for the computed filter gradient
/// with shape [depth,height,width, inp channels, out channels]
///
/// \param filter_dims The sizes of the filter dimensions. The size of
Expand Down
2 changes: 1 addition & 1 deletion cpp/open3d/ml/tensorflow/misc/BuildSpatialHashTableOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The following example shows how **build_spatial_hash_table** and
radius = 1.0
# build the spatial hash table for fixex_radius_search
# build the spatial hash table for fixed_radius_search
table = ml3d.ops.build_spatial_hash_table(points,
radius,
points_row_splits=torch.LongTensor([0,5]),
Expand Down
2 changes: 1 addition & 1 deletion cpp/open3d/t/geometry/BoundingVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ OrientedBoundingBox::OrientedBoundingBox(const core::Tensor &center,
utility::LogError(
"Invalid oriented bounding box. Please make sure the values of "
"extent are all positive and the rotation matrix is "
"othogonal.");
"orthogonal.");
}
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/open3d/t/geometry/BoundingVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class AxisAlignedBoundingBox : public Geometry, public DrawableGeometry {
const utility::optional<core::Tensor> &center = utility::nullopt);

/// \brief Add operation for axis-aligned bounding box.
/// The device of ohter box must be the same as the device of the current
/// The device of other box must be the same as the device of the current
/// box.
AxisAlignedBoundingBox &operator+=(const AxisAlignedBoundingBox &other);

Expand Down Expand Up @@ -223,7 +223,7 @@ class AxisAlignedBoundingBox : public Geometry, public DrawableGeometry {
/// \brief A bounding box oriented along an arbitrary frame of reference.
///
/// - (center, rotation, extent): The oriented bounding box is defined by its
/// center position, rotation maxtrix and extent.
/// center position, rotation matrix and extent.
/// - Usage
/// - OrientedBoundingBox::GetCenter()
/// - OrientedBoundingBox::SetCenter(const core::Tensor &center)
Expand Down
2 changes: 1 addition & 1 deletion cpp/open3d/visualization/gui/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ Widget::DrawResult DrawChild(DrawContext& dc,
const char* name,
std::shared_ptr<Widget> child,
Mode mode) {
// Note: ImGUI's concept of a "window" is really a moveable child of the
// Note: ImGUI's concept of a "window" is really a movable child of the
// OS window. We want a child to act like a child of the OS window,
// like native UI toolkits, Qt, etc. So the top-level widgets of
// a window are drawn using ImGui windows whose frame is specified
Expand Down
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ Open3D: A Modern Library for 3D Data Processing
:maxdepth: 2
:caption: Tutorial

tutorial/core/index
tutorial/geometry/index
tutorial/t_geometry/index
tutorial/data/index
tutorial/visualization/index
tutorial/pipelines/index
tutorial/t_pipelines/index
tutorial/visualization/index
tutorial/core/index
tutorial/data/index
tutorial/reconstruction_system/index
tutorial/t_reconstruction_system/index
tutorial/sensor/index
Expand Down
4 changes: 4 additions & 0 deletions docs/jupyter/core/hashmap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,23 @@
"Next we show how to insert a batch of (key, value) pairs. You'll need to prepare two tensors:\n",
"\n",
"The `keys` tensor contains all keys. \n",
"\n",
"- The `keys` tensor must be on the same device as the hash map. \n",
"- The shape of the `keys` tensor is `key_elment_shape` with `N` prefixed to the front. \n",
"\n",
"For example \n",
" \n",
"1. if `key_element_shape == ()`, `keys.shape == (N,)`; \n",
"2. if `key_element_shape == (3,)`, `keys.shape == (N, 3).`; \n",
"3. if `key_element_shape == (8, 8, 8)`, `keys.shape == (N, 8, 8, 8).`\n",
" \n",
"The `vals` tensor contains all values. \n",
" \n",
"- The `vals` tensor must be on the same device as the hash map. \n",
"- The shape of the `vals` tensor is `val_elment_shape` with `N` prefixed to the front. \n",
"\n",
"For example \n",
"\n",
"1. if `val_elment_shape == ()`, `vals.shape == (N,)`; \n",
"2. if `val_elment_shape == (3,)`, `vals.shape == (N, 3).`;\n",
"3. if `val_elment_shape == (8, 8, 8)`, `vals.shape == (N, 8, 8, 8).`"
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorial/reconstruction_system/integrate_scene.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ Integrate RGBD frames

.. literalinclude:: ../../../examples/python/reconstruction_system/integrate_scene.py
:language: python
:lineno-start: 38
:lines: 27,40-72
:pyobject: scalable_integrate_rgb_frames
:end-at: o3d.visualization.draw_geometries([mesh])
:linenos:
:lineno-match:

This function first reads the alignment results from both
:ref:`reconstruction_system_make_fragments` and
Expand Down
29 changes: 17 additions & 12 deletions docs/tutorial/reconstruction_system/make_fragments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Register RGBD image pairs

.. literalinclude:: ../../../examples/python/reconstruction_system/make_fragments.py
:language: python
:lineno-start: 46
:lines: 27,47-76
:pyobject: register_one_rgbd_pair
:linenos:
:lineno-match:

The function reads a pair of RGBD images and registers the ``source_rgbd_image``
to the ``target_rgbd_image``. The Open3D function ``compute_rgbd_odometry`` is
Expand All @@ -45,9 +45,9 @@ Multiway registration

.. literalinclude:: ../../../examples/python/reconstruction_system/make_fragments.py
:language: python
:lineno-start: 76
:lines: 27,77-123
:pyobject: make_posegraph_for_fragment
:linenos:
:lineno-match:

This script uses the technique demonstrated in
:ref:`/tutorial/pipelines/multiway_registration.ipynb`. The function
Expand All @@ -61,9 +61,9 @@ function ``optimize_posegraph_for_fragment``.

.. literalinclude:: ../../../examples/python/reconstruction_system/optimize_posegraph.py
:language: python
:lineno-start: 51
:lines: 27,52-63
:pyobject: optimize_posegraph_for_fragment
:linenos:
:lineno-match:

This function calls ``global_optimization`` to estimate poses of the RGBD images.

Expand All @@ -74,23 +74,28 @@ Make a fragment

.. literalinclude:: ../../../examples/python/reconstruction_system/make_fragments.py
:language: python
:lineno-start: 124
:lines: 27,125-146
:pyobject: integrate_rgb_frames_for_fragment
:linenos:
:lineno-match:

Once the poses are estimates, :ref:`/tutorial/pipelines/rgbd_integration.ipynb`
Once the poses are estimated, :ref:`/tutorial/pipelines/rgbd_integration.ipynb`
is used to reconstruct a colored fragment from each RGBD sequence.

Batch processing
``````````````````````````````````````

.. literalinclude:: ../../../examples/python/reconstruction_system/make_fragments.py
:language: python
:lineno-start: 181
:lines: 27,182-205
:start-at: def process_single_fragment(fragment_id, color_files, depth_files, n_files,
:linenos:
:lineno-match:

The ``process_single_fragment`` function calls each individual function explained above.
The ``run`` function determines the number of fragments to generate based on the number
of images in the dataset and the configuration value ``n_frames_per_fragment``.
Subsequently, it invokes ``process_single_fragment`` for each of these fragments.
Furthermore, it leverages multiprocessing to speed up computation of all fragments.

The main function calls each individual function explained above.

.. _reconstruction_system_make_fragments_results:

Expand Down
19 changes: 9 additions & 10 deletions docs/tutorial/reconstruction_system/refine_registration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Fine-grained registration

.. literalinclude:: ../../../examples/python/reconstruction_system/refine_registration.py
:language: python
:lineno-start: 63
:lines: 27,64-136
:linenos:
:pyobject: multiscale_icp
:lineno-match:

Two options are given for the fine-grained registration. The ``color`` option is
recommended since it uses color information to prevent drift. See [Park2017]_
Expand All @@ -33,9 +33,9 @@ Multiway registration

.. literalinclude:: ../../../examples/python/reconstruction_system/refine_registration.py
:language: python
:lineno-start: 40
:lines: 27,41-63
:linenos:
:pyobject: update_posegraph_for_scene
:lineno-match:

This script uses the technique demonstrated in :ref:`/tutorial/pipelines/multiway_registration.ipynb`. Function ``update_posegraph_for_scene`` builds a pose graph for multiway registration of all fragments. Each graph node represents a fragment and its pose which transforms the geometry to the global space.

Expand All @@ -44,21 +44,20 @@ for multiway registration.

.. literalinclude:: ../../../examples/python/reconstruction_system/optimize_posegraph.py
:language: python
:lineno-start: 63
:lines: 27,64-73
:linenos:
:pyobject: optimize_posegraph_for_scene
:lineno-match:

Main registration loop
``````````````````````````````````````

The function ``make_posegraph_for_refined_scene`` below calls all the functions
introduced above.
The function ``make_posegraph_for_refined_scene`` below calls all the functions introduced above.

.. literalinclude:: ../../../examples/python/reconstruction_system/refine_registration.py
:language: python
:lineno-start: 173
:lines: 27,174-223
:linenos:
:pyobject: make_posegraph_for_refined_scene
:lineno-match:

The main workflow is: pairwise local refinement -> multiway registration.

Expand Down
24 changes: 12 additions & 12 deletions docs/tutorial/reconstruction_system/register_fragments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Preprocess point cloud

.. literalinclude:: ../../../examples/python/reconstruction_system/register_fragments.py
:language: python
:lineno-start: 41
:lines: 27,42-54
:pyobject: preprocess_point_cloud
:linenos:
:lineno-match:

This function downsamples a point cloud to make it sparser and regularly
distributed. Normals and FPFH feature are precomputed. See
Expand All @@ -36,9 +36,9 @@ Compute initial registration

.. literalinclude:: ../../../examples/python/reconstruction_system/register_fragments.py
:language: python
:lineno-start: 85
:lines: 27,86-114
:pyobject: compute_initial_registration
:linenos:
:lineno-match:

This function computes a rough alignment between two fragments. If the fragments
are neighboring fragments, the rough alignment is determined by an aggregating
Expand All @@ -53,9 +53,9 @@ Pairwise global registration

.. literalinclude:: ../../../examples/python/reconstruction_system/register_fragments.py
:language: python
:lineno-start: 54
:lines: 27,55-85
:pyobject: register_point_cloud_fpfh
:linenos:
:lineno-match:

This function uses :ref:`/tutorial/pipelines/global_registration.ipynb#RANSAC` or :ref:`/tutorial/pipelines/global_registration.ipynb#fast-global-registration` for pairwise global registration.

Expand All @@ -66,9 +66,9 @@ Multiway registration

.. literalinclude:: ../../../examples/python/reconstruction_system/register_fragments.py
:language: python
:lineno-start: 114
:lines: 27,115-137
:pyobject: update_posegraph_for_scene
:linenos:
:lineno-match:

This script uses the technique demonstrated in
:ref:`/tutorial/pipelines/multiway_registration.ipynb`. The function
Expand All @@ -81,9 +81,9 @@ called for multiway registration.

.. literalinclude:: ../../../examples/python/reconstruction_system/optimize_posegraph.py
:language: python
:lineno-start: 63
:lines: 27,64-73
:pyobject: optimize_posegraph_for_scene
:linenos:
:lineno-match:

Main registration loop
``````````````````````````````````````
Expand All @@ -94,9 +94,9 @@ multiway registration.

.. literalinclude:: ../../../examples/python/reconstruction_system/register_fragments.py
:language: python
:lineno-start: 167
:lines: 27,168-210
:pyobject: make_posegraph_for_scene
:linenos:
:lineno-match:

Results
``````````````````````````````````````
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorial/reconstruction_system/system_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Getting the example code

.. code-block:: sh
# Activate your conda enviroment, where you have installed open3d pip package.
# Activate your conda environment, where you have installed open3d pip package.
# Clone the Open3D github repository and go to the example.
cd examples/python/reconstruction_system/
Expand All @@ -69,7 +69,7 @@ Running the example with default dataset.
python run_system.py --make --register --refine --integrate
Changing the default dataset.
One may change the default dataset to other avaialble datasets.
One may change the default dataset to other available datasets.
Currently the following datasets are available:

1. Lounge (keyword: ``lounge``) (Default)
Expand All @@ -81,7 +81,7 @@ Currently the following datasets are available:

.. code-block:: sh
# Using jack_jack as the default dataset.
# Using bedroom as the default dataset.
python run_system.py --default_dataset 'bedroom' --make --register --refine --integrate
Running the example with custom dataset using config file.
Expand Down
Loading

0 comments on commit f1a0f3e

Please sign in to comment.