ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Feature.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <Optional.h>
9 
12 
13 namespace cloudViewer {
14 namespace t {
15 namespace pipelines {
16 namespace kernel {
17 
19  const core::Tensor &points,
20  const core::Tensor &normals,
21  const core::Tensor &indices,
22  const core::Tensor &distance2,
23  const core::Tensor &counts,
24  core::Tensor &fpfhs,
25  const utility::optional<core::Tensor> &mask = utility::nullopt,
26  const utility::optional<core::Tensor> &map_batch_info_idx_to_point_idx =
28 
30  const core::Tensor &points,
31  const core::Tensor &normals,
32  const core::Tensor &indices,
33  const core::Tensor &distance2,
34  const core::Tensor &counts,
35  core::Tensor &fpfhs,
36  const utility::optional<core::Tensor> &mask = utility::nullopt,
37  const utility::optional<core::Tensor> &map_batch_info_idx_to_point_idx =
39 
40 #ifdef BUILD_CUDA_MODULE
41 void ComputeFPFHFeatureCUDA(
42  const core::Tensor &points,
43  const core::Tensor &normals,
44  const core::Tensor &indices,
45  const core::Tensor &distance2,
46  const core::Tensor &counts,
47  core::Tensor &fpfhs,
48  const utility::optional<core::Tensor> &mask = utility::nullopt,
49  const utility::optional<core::Tensor> &map_batch_info_idx_to_point_idx =
51 #endif
52 
53 } // namespace kernel
54 } // namespace pipelines
55 } // namespace t
56 } // namespace cloudViewer
cloudViewer::utility::optional::value
constexpr T const & value() const &
Definition: Optional.h:465
cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU
void ComputeFPFHFeatureCPU(const core::Tensor &points, const core::Tensor &normals, const core::Tensor &indices, const core::Tensor &distance2, const core::Tensor &counts, core::Tensor &fpfhs, const utility::optional< core::Tensor > &mask=utility::nullopt, const utility::optional< core::Tensor > &map_batch_info_idx_to_point_idx=utility::nullopt)
Definition: FeatureImpl.h:112
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
cloudViewer::core::Tensor::IndexSet
void IndexSet(const std::vector< Tensor > &index_tensors, const Tensor &src_tensor)
Advanced indexing getter.
Definition: Tensor.cpp:936
PointCloud.h
cloudViewer::core::Tensor::Ones
static Tensor Ones(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with ones.
Definition: Tensor.cpp:412
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition: Tensor.h:1164
cloudViewer::t::pipelines::registration::path
static const std::string path
Definition: Feature.cpp:25
CUDAUtils.h
Common CUDA utilities.
Optional.h
cloudViewer::t::geometry::PointCloud::To
PointCloud To(const core::Device &device, bool copy=false) const
Definition: PointCloud.cpp:112
cloudViewer::core::Tensor::GetLength
int64_t GetLength() const
Definition: Tensor.h:1125
cloudViewer::t::geometry::PointCloud::SetPointPositions
void SetPointPositions(const core::Tensor &value)
Set the value of the "positions" attribute. Convenience function.
Definition: PointCloud.h:186
cloudViewer::utility::optional::has_value
constexpr bool has_value() const noexcept
Definition: Optional.h:440
cloudViewer::core::Tensor::GetShape
SizeVector GetShape() const
Definition: Tensor.h:1127
ENUM_FPFH_METHOD_DEVICE
#define ENUM_FPFH_METHOD_DEVICE(METHOD_NAME, MAX_NN, RADIUS, INDICES, DEVICE)
Definition: Feature.cpp:188
PointCloudIO.h
Feature.h
core::Tensor
cloudViewer::t::geometry::PointCloud::GetPointNormals
core::Tensor & GetPointNormals()
Get the value of the "normals" attribute. Convenience function.
Definition: PointCloud.h:130
cloudViewer::t::io::ReadPointCloud
bool ReadPointCloud(const std::string &filename, geometry::PointCloud &pointcloud, const cloudViewer::io::ReadPointCloudOption &params)
Definition: PointCloudIO.cpp:72
PointCloud.h
Dataset.h
cloudViewer::core::nns::NearestNeighborSearch::FixedRadiusIndex
bool FixedRadiusIndex(utility::optional< double > radius={})
Definition: NearestNeighborSearch.cpp:40
cloudViewer::core::Tensor::View
Tensor View(const SizeVector &dst_shape) const
Definition: Tensor.cpp:721
cloudViewer::core::Tensor::GetItem
Tensor GetItem(const TensorKey &tk) const
Definition: Tensor.cpp:473
cloudViewer::core::nns::NearestNeighborSearch::KnnIndex
bool KnnIndex()
Definition: NearestNeighborSearch.cpp:23
Feature.h
cloudViewer::t::geometry::PointCloud
A point cloud contains a list of 3D points.
Definition: PointCloud.h:82
cloudViewer::t::geometry::PointCloud::HasPointNormals
bool HasPointNormals() const
Definition: PointCloud.h:234
cloudViewer::core::Dtype
Definition: Dtype.h:21
normals
double normals[3]
Definition: TriangleMeshIO.cpp:54
result
core::Tensor result
Definition: VtkUtils.cpp:76
cloudViewer::t::geometry::PointCloud::EstimateNormals
void EstimateNormals(const utility::optional< int > max_nn=30, const utility::optional< double > radius=utility::nullopt)
Function to estimate point normals. If the point cloud normals exist, the estimated normals are orien...
Definition: PointCloud.cpp:619
Parallel.h
CUDA_CALL
#define CUDA_CALL(cuda_function,...)
Definition: CUDAUtils.h:49
size
int size
Definition: FileIOFactory.cpp:130
cloudViewer::t::pipelines::registration::pointcloud_ply
data::BunnyMesh pointcloud_ply
Definition: Feature.cpp:24
cloudViewer::t::pipelines::registration::ComputeFPFHFeature
core::Tensor ComputeFPFHFeature(const geometry::PointCloud &input, const utility::optional< int > max_nn, const utility::optional< double > radius, const utility::optional< core::Tensor > &indices)
Definition: Feature.cpp:23
cloudViewer::core::nns::NearestNeighborSearch
A Class for nearest neighbor search.
Definition: NearestNeighborSearch.h:26
ParallelFor.h
cloudViewer::core::Tensor::Arange
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
cloudViewer::utility::EstimateMaxThreads
int EstimateMaxThreads()
Estimate the maximum number of threads to be used in a parallel region.
Definition: Parallel.cpp:31
cloudViewer::core::Tensor::Zeros
static Tensor Zeros(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with zeros.
Definition: Tensor.cpp:406
cloudViewer::core::Int32
const Dtype Int32
Definition: Dtype.cpp:46
cloudViewer::t::pipelines::registration::CorrespondencesFromFeatures
core::Tensor CorrespondencesFromFeatures(const core::Tensor &source_features, const core::Tensor &target_features, bool mutual_filter, float mutual_consistent_ratio)
Function to find correspondences via 1-nearest neighbor feature matching. Target is used to construct...
Definition: Feature.cpp:280
LogDebug
#define LogDebug(...)
Definition: Logging.h:90
cloudViewer::core::TensorKey::Index
static TensorKey Index(int64_t index)
Definition: TensorKey.cpp:134
cloudViewer::core::Device
Definition: Device.h:18
cloudViewer::geometry::KDTreeSearchParamRadius
KDTree search parameters for pure radius search.
Definition: ecvKDTreeSearchParam.h:63
cloudViewer::t::geometry::kernel::image::To
void To(const core::Tensor &src, core::Tensor &dst, double scale, double offset)
Definition: Image.cpp:17
cloudViewer::core::nns::NearestNeighborSearch::KnnSearch
std::pair< Tensor, Tensor > KnnSearch(const Tensor &query_points, int knn)
Definition: NearestNeighborSearch.cpp:79
TensorCheck.h
cloudViewer::t::pipelines::registration::LegacyComputeFPFHFeature
void LegacyComputeFPFHFeature(benchmark::State &state, utility::optional< int > max_nn, utility::optional< double > radius, utility::optional< double > ratio_indices)
Definition: Feature.cpp:27
cloudViewer::core::Tensor::IndexGet
Tensor IndexGet(const std::vector< Tensor > &index_tensors) const
Advanced indexing getter. This will always allocate a new Tensor.
Definition: Tensor.cpp:905
cloudViewer::core::Bool
const Dtype Bool
Definition: Dtype.cpp:52
cloudViewer::core::Append
Tensor Append(const Tensor &self, const Tensor &other, const utility::optional< int64_t > &axis)
Appends the two tensors, along the given axis into a new tensor. Both the tensors must have same data...
Definition: TensorFunction.cpp:118
cloudViewer::geometry::KDTreeSearchParamHybrid
KDTree search parameters for hybrid KNN and radius search.
Definition: ecvKDTreeSearchParam.h:79
cloudViewer::utility::ComputeFPFHFeature
std::shared_ptr< Feature > ComputeFPFHFeature(const ccPointCloud &input, const geometry::KDTreeSearchParam &search_param=geometry::KDTreeSearchParamKNN(), const utility::optional< std::vector< size_t >> &indices=utility::nullopt)
Definition: ecvFeature.cpp:143
cloudViewer::core::Tensor::GetDevice
Device GetDevice() const override
Definition: Tensor.cpp:1435
cloudViewer::core::CUDAScopedDevice
When CUDA is not enabled, this is a dummy class.
Definition: CUDAUtils.h:214
NearestNeighborSearch.h
points
int points
Definition: FileIOFactory.cpp:144
cloudViewer::core::Dtype::Int64
static const Dtype Int64
Definition: Dtype.h:29
cloudViewer::core::SizeVector
Definition: SizeVector.h:70
cloudViewer::utility::optional
Definition: Optional.h:44
LogError
#define LogError(...)
Definition: Logging.h:60
cloudViewer::core::IsDevice::IsCPU
bool IsCPU() const
Definition: Device.h:95
cloudViewer::t::geometry::PointCloud::UniformDownSample
PointCloud UniformDownSample(size_t every_k_points) const
Downsamples a point cloud by selecting every kth index point and its attributes.
Definition: PointCloud.cpp:345
cloudViewer::utility::nullopt
constexpr nullopt_t nullopt
Definition: Optional.h:136
Tensor.h
cloudViewer::data::BunnyMesh::GetPath
std::string GetPath() const
Path to the BunnyMesh.ply file.
Definition: Dataset.h:239
LogWarning
#define LogWarning(...)
Definition: Logging.h:72
cloudViewer::core::Tensor::NonZero
Tensor NonZero() const
Definition: Tensor.cpp:1755
cloudViewer::core::Tensor::Full
static Tensor Full(const SizeVector &shape, T fill_value, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with specified value.
Definition: Tensor.h:253
cloudViewer::t::geometry::PointCloud::GetPointPositions
core::Tensor & GetPointPositions()
Get the value of the "positions" attribute. Convenience function.
Definition: PointCloud.h:124
cloudViewer::core::nns::NearestNeighborSearch::FixedRadiusSearch
std::tuple< Tensor, Tensor, Tensor > FixedRadiusSearch(const Tensor &query_points, double radius, bool sort=true)
Definition: NearestNeighborSearch.cpp:98
cloudViewer::t::pipelines::kernel::ComputeFPFHFeature
void ComputeFPFHFeature(const core::Tensor &points, const core::Tensor &normals, const core::Tensor &indices, const core::Tensor &distance2, const core::Tensor &counts, core::Tensor &fpfhs, const utility::optional< core::Tensor > &mask, const utility::optional< core::Tensor > &map_info_idx_to_point_idx)
Definition: Feature.cpp:18
cloudViewer::data::BunnyMesh
Data class for BunnyMesh contains the BunnyMesh.ply from the Stanford 3D Scanning Repository.
Definition: Dataset.h:234
cloudViewer::core::Tensor::Eq
Tensor Eq(const Tensor &value) const
Element-wise equals-to of tensors, returning a new boolean tensor.
Definition: Tensor.cpp:1682
cloudViewer::core::nns::NearestNeighborSearch::HybridIndex
bool HybridIndex(utility::optional< double > radius={})
Definition: NearestNeighborSearch.cpp:60
cloudViewer::utility::optional::emplace
void emplace(Args &&... args)
Definition: Optional.h:410
AssertTensorShape
#define AssertTensorShape(tensor,...)
Definition: TensorCheck.h:61
ecvFeature.h
cloudViewer::core::cuda::Synchronize
void Synchronize()
Definition: CUDAUtils.cpp:59
cloudViewer::t::pipelines::registration::BENCHMARK_CAPTURE
BENCHMARK_CAPTURE(LegacyComputeFPFHFeature, Legacy Hybrid[0.01|100], 100, 0.01, utility::nullopt) -> Unit(benchmark::kMillisecond)
AssertTensorDtypes
#define AssertTensorDtypes(tensor,...)
Definition: TensorCheck.h:33
cloudViewer::io::CreatePointCloudFromFile
std::shared_ptr< ccPointCloud > CreatePointCloudFromFile(const std::string &filename, const std::string &format, bool print_progress)
Definition: PointCloudIO.cpp:84
cloudViewer::core::Int64
const Dtype Int64
Definition: Dtype.cpp:47
cloudViewer::core::Tensor::To
Tensor To(Dtype dtype, bool copy=false) const
Definition: Tensor.cpp:739
cloudViewer::core::nns::NearestNeighborSearch::HybridSearch
std::tuple< Tensor, Tensor, Tensor > HybridSearch(const Tensor &query_points, const double radius, const int max_knn) const
Definition: NearestNeighborSearch.cpp:130
cloudViewer::geometry::KDTreeSearchParamKNN
KDTree search parameters for pure KNN search.
Definition: ecvKDTreeSearchParam.h:46