diff --git a/CHANGELOG.md b/CHANGELOG.md index 38c78580060..2164a63d139 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master +* Fix tensor based TSDF integration example. * Use GLIBCXX_USE_CXX11_ABI=ON by default * Python 3.9 support. Tensorflow bump 2.4.1 -> 2.5.0. PyTorch bump 1.7.1 -> 1.8.1 (LTS) * Fix undefined names: docstr and VisibleDeprecationWarning (PR #3844) diff --git a/docs/tutorial/t_reconstruction_system/integration.rst b/docs/tutorial/t_reconstruction_system/integration.rst index e62d9bf3cfc..900e9bcad43 100644 --- a/docs/tutorial/t_reconstruction_system/integration.rst +++ b/docs/tutorial/t_reconstruction_system/integration.rst @@ -12,8 +12,8 @@ In the activation step, we first locate blocks that contain points unprojected f .. literalinclude:: ../../../examples/python/t_reconstruction_system/integrate.py :language: python - :lineno-start: 82 - :lines: 27,83-85 + :lineno-start: 52 + :lines: 52-54 Integration ```````````` @@ -23,8 +23,8 @@ We may use optimized functions, along with raw depth images with calibration par .. literalinclude:: ../../../examples/python/t_reconstruction_system/integrate.py :language: python - :lineno-start: 86 - :lines: 27,87-93 + :lineno-start: 58 + :lines: 58-60 Currently, to use our optimized function, we assume the below combinations of data types, in the order of ``depth image``, ``color image``, ``tsdf in voxel grid``, ``weight in voxel grid``, ``color in voxel grid`` in CPU @@ -48,8 +48,8 @@ You may use the provided APIs to extract surface points. .. literalinclude:: ../../../examples/python/t_reconstruction_system/integrate.py :language: python - :lineno-start: 135 - :lines: 27,136-140 + :lineno-start: 106 + :lines: 106-110 Note ``extract_triangle_mesh`` applies marching cubes and generate mesh. ``extract_point_cloud`` uses the similar algorithm, but skips the triangle face generation step. diff --git a/examples/python/t_reconstruction_system/config.py b/examples/python/t_reconstruction_system/config.py index 5d87a561c9f..2ca1305e2fc 100644 --- a/examples/python/t_reconstruction_system/config.py +++ b/examples/python/t_reconstruction_system/config.py @@ -6,6 +6,8 @@ # ---------------------------------------------------------------------------- import os + +import argparse import configargparse @@ -107,9 +109,8 @@ def __init__(self): integration_parser = self.add_argument_group('integration') integration_parser.add( - '--integration_mode',type=str, - choices=['color', 'depth'], - help='Volumetric integration mode.') + '--integrate_color', action=argparse.BooleanOptionalAction, + default=True, help='Volumetric integration mode.') integration_parser.add( '--voxel_size', type=float, help='Voxel size in meter for volumetric integration.') diff --git a/examples/python/t_reconstruction_system/default_config.yml b/examples/python/t_reconstruction_system/default_config.yml index 36e4030efce..3e32515cbf4 100644 --- a/examples/python/t_reconstruction_system/default_config.yml +++ b/examples/python/t_reconstruction_system/default_config.yml @@ -8,7 +8,6 @@ depth_folder: depth color_folder: color path_intrinsic: '' path_color_intrinsic: '' -fragment_size: 100 depth_min: 0.1 depth_max: 3.0 depth_scale: 1000.0 @@ -21,7 +20,7 @@ icp_voxelsize: 0.05 icp_distance_thr: 0.07 global_registration_method: ransac registration_loop_weight: 0.1 -integration_mode: color +integrate_color: true voxel_size: 0.0058 trunc_voxel_multiplier: 8.0 block_count: 40000 diff --git a/examples/python/t_reconstruction_system/integrate.py b/examples/python/t_reconstruction_system/integrate.py index 2c3e011cdea..3d86ec02943 100644 --- a/examples/python/t_reconstruction_system/integrate.py +++ b/examples/python/t_reconstruction_system/integrate.py @@ -10,25 +10,22 @@ # P.S. This example is used in documentation, so, please ensure the changes are # synchronized. -import os -import numpy as np +import time + import open3d as o3d import open3d.core as o3c -import time -import matplotlib.pyplot as plt from tqdm import tqdm -from config import ConfigParser from common import load_rgbd_file_names, load_depth_file_names, load_intrinsic, load_extrinsics, get_default_dataset +from config import ConfigParser def integrate(depth_file_names, color_file_names, depth_intrinsic, - color_intrinsic, extrinsics, integrate_color, config): - + color_intrinsic, extrinsics, config): n_files = len(depth_file_names) device = o3d.core.Device(config.device) - if integrate_color: + if config.integrate_color: vbg = o3d.t.geometry.VoxelBlockGrid( attr_names=('tsdf', 'weight', 'color'), attr_dtypes=(o3c.float32, o3c.float32, o3c.float32), @@ -56,7 +53,7 @@ def integrate(depth_file_names, color_file_names, depth_intrinsic, depth, depth_intrinsic, extrinsic, config.depth_scale, config.depth_max) - if integrate_color: + if config.integrate_color: color = o3d.t.io.read_image(color_file_names[i]).to(device) vbg.integrate(frustum_block_coords, depth, color, depth_intrinsic, color_intrinsic, extrinsic, config.depth_scale, @@ -83,7 +80,6 @@ def integrate(depth_file_names, color_file_names, depth_intrinsic, 'Default dataset may be selected from the following options: ' '[lounge, jack_jack]', default='lounge') - parser.add('--integrate_color', action='store_true') parser.add('--path_trajectory', help='path to the trajectory .log or .json file.') parser.add('--path_npz', diff --git a/examples/python/t_reconstruction_system/run_system.py b/examples/python/t_reconstruction_system/run_system.py index 55b5dbcb160..51e94257ace 100644 --- a/examples/python/t_reconstruction_system/run_system.py +++ b/examples/python/t_reconstruction_system/run_system.py @@ -104,7 +104,6 @@ intrinsic, intrinsic, extrinsics, - integrate_color=True, config=config) pcd = vbg.extract_point_cloud()