 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
10 #include <unordered_map>
21 namespace voxel_grid {
32 void DepthTouch(std::shared_ptr<core::HashMap>& hashmap,
72 int64_t block_resolution,
78 void RayCast(std::shared_ptr<core::HashMap>& hashmap,
91 float weight_threshold,
92 float trunc_voxel_multiplier,
93 int range_map_down_factor);
105 float weight_threshold,
120 float weight_threshold,
150 template <
typename input_depth_t,
151 typename input_color_t,
176 int64_t block_resolution,
182 template <
typename tsdf_t,
typename weight_t,
typename color_t>
183 void RayCastCPU(std::shared_ptr<core::HashMap>& hashmap,
196 float weight_threshold,
197 float trunc_voxel_multiplier,
198 int range_map_down_factor);
200 template <
typename tsdf_t,
typename weight_t,
typename color_t>
211 float weight_threshold,
214 template <
typename tsdf_t,
typename weight_t,
typename color_t>
227 float weight_threshold,
230 #ifdef BUILD_CUDA_MODULE
231 void PointCloudTouchCUDA(std::shared_ptr<core::HashMap>& hashmap,
238 void DepthTouchCUDA(std::shared_ptr<core::HashMap>& hashmap,
250 void GetVoxelCoordinatesAndFlattenedIndicesCUDA(
const core::Tensor& buf_indices,
257 template <
typename input_depth_t,
258 typename input_color_t,
283 int64_t block_resolution,
289 template <
typename tsdf_t,
typename weight_t,
typename color_t>
290 void RayCastCUDA(std::shared_ptr<core::HashMap>& hashmap,
303 float weight_threshold,
304 float trunc_voxel_multiplier,
305 int range_map_down_factor);
307 template <
typename tsdf_t,
typename weight_t,
typename color_t>
308 void ExtractPointCloudCUDA(
const core::Tensor& block_indices,
318 float weight_threshold,
321 template <
typename tsdf_t,
typename weight_t,
typename color_t>
322 void ExtractTriangleMeshCUDA(
const core::Tensor& block_indices,
334 float weight_threshold,
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
double colors[3]
Definition: TriangleMeshIO.cpp:53
Definition: TensorMap.h:31
Dtype GetDtype() const
Definition: Tensor.h:1164
void ExtractTriangleMeshCPU(const core::Tensor &block_indices, const core::Tensor &inv_block_indices, const core::Tensor &nb_block_indices, const core::Tensor &nb_block_masks, const core::Tensor &block_keys, const TensorMap &block_value_map, core::Tensor &vertices, core::Tensor &triangles, core::Tensor &vertex_normals, core::Tensor &vertex_colors, index_t block_resolution, float voxel_size, float weight_threshold, index_t &vertex_count)
Definition: VoxelBlockGridImpl.h:1305
static std::pair< core::Tensor, core::Tensor > BufferRadiusNeighbors(std::shared_ptr< core::HashMap > &hashmap, const core::Tensor &active_buf_indices)
Definition: VoxelBlockGrid.cpp:23
static const Dtype Bool
Definition: Dtype.h:34
int64_t GetLength() const
Definition: Tensor.h:1125
CLOUDVIEWER_HOST_DEVICE Pair< First, Second > make_pair(const First &_first, const Second &_second)
Definition: SlabTraits.h:49
SizeVector GetShape() const
Definition: Tensor.h:1127
bool copy
Definition: VtkUtils.cpp:74
void SetVertexColors(const core::Tensor &value)
Definition: TriangleMesh.h:268
std::string GetFileExtensionInLowerCase(const std::string &filename)
Definition: FileSystem.cpp:281
void ExtractPointCloudCPU(const core::Tensor &block_indices, const core::Tensor &nb_block_indices, const core::Tensor &nb_block_masks, const core::Tensor &block_keys, const TensorMap &block_value_map, core::Tensor &points, core::Tensor &normals, core::Tensor &colors, index_t block_resolution, float voxel_size, float weight_threshold, index_t &valid_size)
Definition: VoxelBlockGridImpl.h:1043
core::Tensor GetVoxelCoordinates(const core::Tensor &voxel_indices) const
Definition: VoxelBlockGrid.cpp:131
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:181
bool IsCUDA() const
Definition: Device.h:99
Tensor Contiguous() const
Definition: Tensor.cpp:772
void CheckBlockCoordinates(const core::Tensor &block_coords)
Definition: Utility.h:69
static TensorMap ConstructTensorMap(const core::HashMap &block_hashmap, std::unordered_map< std::string, int > name_attr_map)
Definition: VoxelBlockGrid.cpp:54
The Image class stores image with customizable rows, cols, channels, dtype and device.
Definition: Image.h:29
Tensor View(const SizeVector &dst_shape) const
Definition: Tensor.cpp:721
math::float4 color
Definition: LineSetBuffers.cpp:46
int64_t GetRows() const
Get the number of rows of the image.
Definition: Image.h:84
core::Tensor GetAttribute(const std::string &attr_name) const
Definition: VoxelBlockGrid.cpp:120
A point cloud contains a list of 3D points.
Definition: PointCloud.h:82
Tensor GetValueTensor(size_t index=0) const
Definition: HashMap.cpp:294
static VoxelBlockGrid Load(const std::string &file_name)
Load a voxel block grid from a .npz file.
Definition: VoxelBlockGrid.cpp:541
A triangle mesh contains vertices and triangles.
Definition: TriangleMesh.h:98
double normals[3]
Definition: TriangleMeshIO.cpp:54
int width
Definition: FileIOFactory.cpp:142
float
Definition: my_point_types.h:154
static const Dtype Float32
Definition: Dtype.h:24
#define CUDA_CALL(cuda_function,...)
Definition: CUDAUtils.h:49
void CheckExtrinsicTensor(const core::Tensor &extrinsic)
Definition: Utility.h:53
int height
Definition: FileIOFactory.cpp:143
bool Contains(const std::string &key) const
Definition: TensorMap.h:187
static Tensor Arange(const Scalar start, const Scalar stop, const Scalar step=1, const Dtype dtype=core::Int64, const Device &device=core::Device("CPU:0"))
Create a 1D tensor with evenly spaced values in the given interval.
Definition: Tensor.cpp:436
void RayCast(std::shared_ptr< core::HashMap > &hashmap, const TensorMap &block_value_map, const core::Tensor &range_map, TensorMap &renderings_map, const core::Tensor &intrinsic, const core::Tensor &extrinsic, index_t h, index_t w, index_t block_resolution, float voxel_size, float depth_scale, float depth_min, float depth_max, float weight_threshold, float trunc_voxel_multiplier, int range_map_down_factor)
Definition: VoxelBlockGrid.cpp:227
static Tensor Zeros(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with zeros.
Definition: Tensor.cpp:406
TriangleMesh ExtractTriangleMesh(float weight_threshold=3.0f, int estimated_vertex_numer=-1)
Definition: VoxelBlockGrid.cpp:437
const Dtype Int32
Definition: Dtype.cpp:46
void GetVoxelCoordinatesAndFlattenedIndicesCPU(const core::Tensor &buf_indices, const core::Tensor &block_keys, core::Tensor &voxel_coords, core::Tensor &flattened_indices, index_t block_resolution, float voxel_size)
Definition: VoxelBlockGridImpl.h:39
core::Tensor AsTensor() const
Returns the underlying Tensor of the Image.
Definition: Image.h:124
int index_t
Definition: VoxelBlockGrid.h:23
void RayCastCPU(std::shared_ptr< core::HashMap > &hashmap, const TensorMap &block_value_map, const core::Tensor &range_map, TensorMap &renderings_map, const core::Tensor &intrinsic, const core::Tensor &extrinsic, index_t h, index_t w, index_t block_resolution, float voxel_size, float depth_scale, float depth_min, float depth_max, float weight_threshold, float trunc_voxel_multiplier, int range_map_down_factor)
Definition: VoxelBlockGridImpl.h:544
void ExtractTriangleMesh(const core::Tensor &block_indices, const core::Tensor &inv_block_indices, const core::Tensor &nb_block_indices, const core::Tensor &nb_block_masks, const core::Tensor &block_keys, const TensorMap &block_value_map, core::Tensor &vertices, core::Tensor &triangles, core::Tensor &vertex_normals, core::Tensor &vertex_colors, index_t block_resolution, float voxel_size, float weight_threshold, int &vertex_count)
Definition: VoxelBlockGrid.cpp:334
void CheckColorTensor(const core::Tensor &color)
Definition: Utility.h:27
#define DISPATCH_VALUE_DTYPE_TO_TEMPLATE(WEIGHT_DTYPE, COLOR_DTYPE,...)
Definition: VoxelBlockGrid.cpp:85
void Integrate(const core::Tensor &block_coords, const Image &depth, const Image &color, const core::Tensor &depth_intrinsic, const core::Tensor &color_intrinsic, const core::Tensor &extrinsic, float depth_scale=1000.0f, float depth_max=3.0f, float trunc_voxel_multiplier=8.0f)
Definition: VoxelBlockGrid.cpp:293
PointCloud ExtractPointCloud(float weight_threshold=3.0f, int estimated_point_number=-1)
Definition: VoxelBlockGrid.cpp:405
static const Dtype UInt8
Definition: Dtype.h:30
Tensor IndexGet(const std::vector< Tensor > &index_tensors) const
Advanced indexing getter. This will always allocate a new Tensor.
Definition: Tensor.cpp:905
std::pair< core::Tensor, core::Tensor > GetVoxelCoordinatesAndFlattenedIndices()
Definition: VoxelBlockGrid.cpp:187
void PointCloudTouch(std::shared_ptr< core::HashMap > &hashmap, const core::Tensor &points, core::Tensor &voxel_block_coords, index_t voxel_grid_resolution, float voxel_size, float sdf_trunc)
Definition: VoxelBlockGrid.cpp:25
const Dtype Float64
Definition: Dtype.cpp:43
core::Tensor GetVoxelIndices() const
Get all active voxel indices.
Definition: VoxelBlockGrid.cpp:181
Definition: VoxelBlockGrid.h:26
int64_t GetCols() const
Get the number of columns of the image.
Definition: Image.h:87
int points
Definition: FileIOFactory.cpp:144
static const Dtype Int64
Definition: Dtype.h:29
const Dtype Float32
Definition: Dtype.cpp:42
Definition: SizeVector.h:70
void PointCloudTouchCPU(std::shared_ptr< core::HashMap > &hashmap, const core::Tensor &points, core::Tensor &voxel_block_coords, index_t voxel_grid_resolution, float voxel_size, float sdf_trunc)
CPU.
Definition: VoxelBlockGridCPU.cpp:55
#define LogError(...)
Definition: Logging.h:60
TensorMap RayCast(const core::Tensor &block_coords, const core::Tensor &intrinsic, const core::Tensor &extrinsic, int width, int height, const std::vector< std::string > attrs={"depth", "color"}, float depth_scale=1000.0f, float depth_min=0.1f, float depth_max=3.0f, float weight_threshold=3.0f, float trunc_voxel_multiplier=8.0f, int range_map_down_factor=8)
Definition: VoxelBlockGrid.cpp:329
core::Tensor GetUniqueBlockCoordinates(const Image &depth, const core::Tensor &intrinsic, const core::Tensor &extrinsic, float depth_scale=1000.0f, float depth_max=3.0f, float trunc_voxel_multiplier=8.0)
Definition: VoxelBlockGrid.cpp:213
void Save(const std::string &file_name) const
Save a voxel block grid to a .npz file.
Definition: VoxelBlockGrid.cpp:475
void GetVoxelCoordinatesAndFlattenedIndices(const core::Tensor &buf_indices, const core::Tensor &block_keys, core::Tensor &voxel_coords, core::Tensor &flattened_indices, index_t block_resolution, float voxel_size)
Definition: VoxelBlockGrid.cpp:66
bool IsCPU() const
Definition: Device.h:95
HashBackendType
Definition: HashMap.h:21
void SetVertexNormals(const core::Tensor &value)
Definition: TriangleMesh.h:275
std::unordered_map< std::string, core::Tensor > ReadNpz(const std::string &file_name)
Definition: NumpyIO.cpp:675
VoxelBlockGrid To(const core::Device &device, bool copy=false) const
Convert the hash map to another device.
Definition: VoxelBlockGrid.cpp:530
void WriteNpz(const std::string &file_name, const std::unordered_map< std::string, core::Tensor > &tensor_map)
Definition: NumpyIO.cpp:759
void DepthTouchCPU(std::shared_ptr< core::HashMap > &hashmap, const core::Tensor &depth, const core::Tensor &intrinsic, const core::Tensor &extrinsic, core::Tensor &voxel_block_coords, index_t voxel_grid_resolution, float voxel_size, float sdf_trunc, float depth_scale, float depth_max, index_t stride)
Definition: VoxelBlockGridCPU.cpp:117
void DepthTouch(std::shared_ptr< core::HashMap > &hashmap, const core::Tensor &depth, const core::Tensor &intrinsic, const core::Tensor &extrinsic, core::Tensor &voxel_block_coords, index_t voxel_grid_resolution, float voxel_size, float sdf_trunc, float depth_scale, float depth_max, index_t stride)
Definition: VoxelBlockGrid.cpp:42
void CheckIntrinsicTensor(const core::Tensor &intrinsic)
Definition: Utility.h:37
#define LogWarning(...)
Definition: Logging.h:72
#define DISPATCH_INPUT_DTYPE_TO_TEMPLATE(DEPTH_DTYPE, COLOR_DTYPE,...)
Definition: VoxelBlockGrid.cpp:106
core::Tensor & GetPointPositions()
Get the value of the "positions" attribute. Convenience function.
Definition: PointCloud.h:124
void Integrate(const core::Tensor &depth, const core::Tensor &color, const core::Tensor &block_indices, const core::Tensor &block_keys, TensorMap &block_value_map, const core::Tensor &depth_intrinsic, const core::Tensor &color_intrinsic, const core::Tensor &extrinsic, index_t resolution, float voxel_size, float sdf_trunc, float depth_scale, float depth_max)
Definition: VoxelBlockGrid.cpp:126
void EstimateRangeCPU(const core::Tensor &block_keys, core::Tensor &range_minmax_map, const core::Tensor &intrinsics, const core::Tensor &extrinsics, int h, int w, int down_factor, int64_t block_resolution, float voxel_size, float depth_min, float depth_max, core::Tensor &fragment_buffer)
Definition: VoxelBlockGridImpl.h:302
void ExtractPointCloud(const core::Tensor &block_indices, const core::Tensor &nb_block_indices, const core::Tensor &nb_block_masks, const core::Tensor &block_keys, const TensorMap &block_value_map, core::Tensor &points, core::Tensor &normals, core::Tensor &colors, index_t block_resolution, float voxel_size, float weight_threshold, int &valid_size)
Definition: VoxelBlockGrid.cpp:284
void EstimateRange(const core::Tensor &block_keys, core::Tensor &range_minmax_map, const core::Tensor &intrinsics, const core::Tensor &extrinsics, int h, int w, int down_factor, int64_t block_resolution, float voxel_size, float depth_min, float depth_max, core::Tensor &fragment_buffer)
Definition: VoxelBlockGrid.cpp:194
const Dtype Int64
Definition: Dtype.cpp:47
Tensor To(Dtype dtype, bool copy=false) const
Definition: Tensor.cpp:739
::ccPointCloud PointCloud
Definition: PointCloud.h:19
double voxel_size
Definition: VoxelGridIO.cpp:28
void CheckDepthTensor(const core::Tensor &depth)
Definition: Utility.h:17
void IntegrateCPU(const core::Tensor &depth, const core::Tensor &color, const core::Tensor &block_indices, const core::Tensor &block_keys, TensorMap &block_value_map, const core::Tensor &depth_intrinsic, const core::Tensor &color_intrinsic, const core::Tensor &extrinsic, index_t resolution, float voxel_size, float sdf_trunc, float depth_scale, float depth_max)
Definition: VoxelBlockGridImpl.h:150
std::string name
Definition: FileIOFactory.cpp:129
size_t stride
Definition: TriangleMeshBuffers.cpp:166