ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
RGBDOdometry.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 #pragma once
9 
11 
12 namespace cloudViewer {
13 namespace t {
14 namespace pipelines {
15 namespace kernel {
16 namespace odometry {
17 
19  const core::Tensor &source_vertex_map,
20  const core::Tensor &target_vertex_map,
21  const core::Tensor &target_normal_map,
22  const core::Tensor &intrinsics,
23  const core::Tensor &init_source_to_target,
24  core::Tensor &delta,
25  float &inlier_residual,
26  int &inlier_count,
27  const float depth_outlier_trunc,
28  const float depth_huber_delta);
29 
30 void ComputeOdometryResultIntensity(const core::Tensor &source_depth,
31  const core::Tensor &target_depth,
32  const core::Tensor &source_intensity,
33  const core::Tensor &target_intensity,
34  const core::Tensor &target_intensity_dx,
35  const core::Tensor &target_intensity_dy,
36  const core::Tensor &source_vertex_map,
37  const core::Tensor &intrinsics,
38  const core::Tensor &init_source_to_target,
39  core::Tensor &delta,
40  float &inlier_residual,
41  int &inlier_count,
42  const float depth_outlier_trunc,
43  const float intensity_huber_delta);
44 
45 void ComputeOdometryResultHybrid(const core::Tensor &source_depth,
46  const core::Tensor &target_depth,
47  const core::Tensor &source_intensity,
48  const core::Tensor &target_intensity,
49  const core::Tensor &target_depth_dx,
50  const core::Tensor &target_depth_dy,
51  const core::Tensor &target_intensity_dx,
52  const core::Tensor &target_intensity_dy,
53  const core::Tensor &source_vertex_map,
54  const core::Tensor &intrinsics,
55  const core::Tensor &init_source_to_target,
56  core::Tensor &delta,
57  float &inlier_residual,
58  int &inlier_count,
59  const float depth_outlier_trunc,
60  const float depth_huber_delta,
61  const float intensity_huber_delta);
62 
63 void ComputeOdometryInformationMatrix(const core::Tensor &source_vertex_map,
64  const core::Tensor &target_vertex_map,
65  const core::Tensor &intrinsic,
66  const core::Tensor &source_to_target,
67  const float square_dist_thr,
68  core::Tensor &information);
69 
70 } // namespace odometry
71 } // namespace kernel
72 } // namespace pipelines
73 } // namespace t
74 } // namespace cloudViewer
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
PointCloud.h
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition: Tensor.h:1164
cloudViewer::core::Tensor::Clone
Tensor Clone() const
Copy Tensor to the same device.
Definition: Tensor.h:502
cloudViewer::t::pipelines::odometry::OdometryConvergenceCriteria
Definition: RGBDOdometry.h:30
cloudViewer::t::geometry::Image::ClipTransform
Image ClipTransform(float scale, float min_value, float max_value, float clip_fill=0.0f) const
Return new image after scaling and clipping image values.
Definition: Image.cpp:417
cloudViewer::data::SampleRedwoodRGBDImages
Data class for SampleRedwoodRGBDImages contains a sample set of 5 color and depth images from Redwood...
Definition: Dataset.h:1047
CUDAUtils.h
Common CUDA utilities.
cloudViewer::t::pipelines::odometry::Method
Method
Definition: RGBDOdometry.h:23
TransformationConverter.h
cloudViewer::core::Tensor::GetShape
SizeVector GetShape() const
Definition: Tensor.h:1127
cloudViewer::data::SampleRedwoodRGBDImages::GetColorPaths
std::vector< std::string > GetColorPaths() const
Returns List of paths to color image samples of size 5.
Definition: Dataset.h:1052
cloudViewer::t::pipelines::odometry::Method::Intensity
@ Intensity
cloudViewer::t::geometry::Image::To
Image To(const core::Device &device, bool copy=false) const
Transfer the image to a specified device.
Definition: Image.h:132
PointCloudIO.h
cloudViewer::t::geometry::RGBDImage::depth_
Image depth_
The depth image.
Definition: RGBDImage.h:106
core::Tensor
cloudViewer::t::geometry::Image::CreateVertexMap
Image CreateVertexMap(const core::Tensor &intrinsics, float invalid_fill=0.0f)
Create a vertex map from a depth image using unprojection.
Definition: Image.cpp:449
cloudViewer::t::pipelines::odometry::ComputeOdometryInformationMatrix
core::Tensor ComputeOdometryInformationMatrix(const geometry::Image &source_depth, const geometry::Image &target_depth, const core::Tensor &intrinsic, const core::Tensor &source_to_target, const float dist_thr, const float depth_scale, const float depth_max)
Definition: RGBDOdometry.cpp:489
AssertTensorDevice
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:45
cloudViewer::core::Tensor::Contiguous
Tensor Contiguous() const
Definition: Tensor.cpp:772
cloudViewer::t::pipelines::odometry::OdometryLossParams::depth_outlier_trunc_
float depth_outlier_trunc_
Depth difference threshold used to filter projective associations.
Definition: RGBDOdometry.h:116
cloudViewer::core::Device::DeviceType::CPU
@ CPU
Dataset.h
cloudViewer::t::geometry::Image
The Image class stores image with customizable rows, cols, channels, dtype and device.
Definition: Image.h:29
cloudViewer::core::Tensor
Definition: Tensor.h:32
cloudViewer::t::pipelines::odometry::OdometryLossParams
Definition: RGBDOdometry.h:87
cloudViewer::t::geometry::Image::GetDevice
core::Device GetDevice() const override
Get device of the image.
Definition: Image.h:96
RGBDOdometry.h
cloudViewer::core::Dtype
Definition: Dtype.h:21
cloudViewer::t::pipelines::odometry::Method::Hybrid
@ Hybrid
cloudViewer::t::pipelines::odometry::OdometryResult
Definition: RGBDOdometry.h:59
cloudViewer::t::geometry::Image::RGBToGray
Image RGBToGray() const
Converts a 3-channel RGB image to a new 1-channel Grayscale image.
Definition: Image.cpp:120
cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScalePointToPlane
OdometryResult RGBDOdometryMultiScalePointToPlane(const RGBDImage &source, const RGBDImage &target, const Tensor &intrinsics, const Tensor &trans, const float depth_scale, const float depth_max, const std::vector< OdometryConvergenceCriteria > &criteria, const OdometryLossParams &params)
Definition: RGBDOdometry.cpp:109
result
core::Tensor result
Definition: VtkUtils.cpp:76
cloudViewer::core::Device::IsCUDA
bool IsCUDA() const
Returns true iff device type is CUDA.
Definition: Device.h:49
CUDA_CALL
#define CUDA_CALL(cuda_function,...)
Definition: CUDAUtils.h:49
cloudViewer::camera::PinholeCameraIntrinsicParameters::PrimeSenseDefault
@ PrimeSenseDefault
Default settings for PrimeSense camera sensor.
cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultIntensityCPU
void ComputeOdometryResultIntensityCPU(const core::Tensor &source_depth, const core::Tensor &target_depth, const core::Tensor &source_intensity, const core::Tensor &target_intensity, const core::Tensor &target_intensity_dx, const core::Tensor &target_intensity_dy, const core::Tensor &source_vertex_map, const core::Tensor &intrinsics, const core::Tensor &init_source_to_target, core::Tensor &delta, float &inlier_residual, int &inlier_count, const float depth_outlier_trunc, const float intensity_huber_delta)
Definition: RGBDOdometryCPU.cpp:110
cloudViewer::core::Tensor::Eye
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Definition: Tensor.cpp:418
RGBDImage.h
RGBDOdometryImpl.h
cloudViewer::t::geometry::Image::CreateNormalMap
Image CreateNormalMap(float invalid_fill=0.0f)
Create a normal map from a vertex map.
Definition: Image.cpp:467
e
const double * e
Definition: essential_matrix_poly.h:10
cloudViewer::t::geometry::Image::AsTensor
core::Tensor AsTensor() const
Returns the underlying Tensor of the Image.
Definition: Image.h:124
cloudViewer::t::geometry::Image::PyrDown
Image PyrDown() const
Return a new downsampled image with pyramid downsampling.
Definition: Image.cpp:395
LogDebug
#define LogDebug(...)
Definition: Logging.h:90
cloudViewer::t::pipelines::odometry::BENCHMARK_CAPTURE
BENCHMARK_CAPTURE(RGBDOdometryMultiScale, Hybrid_CPU, core::Device("CPU:0"), t::pipelines::odometry::Method::Hybrid) -> Unit(benchmark::kMillisecond)
cloudViewer::t::geometry::Image::FilterSobel
std::pair< Image, Image > FilterSobel(int kernel_size=3) const
Return a pair of new gradient images (dx, dy) after Sobel filtering.
Definition: Image.cpp:345
cloudViewer::core::Device
Definition: Device.h:18
cloudViewer::t::pipelines::odometry::OdometryLossParams::intensity_huber_delta_
float intensity_huber_delta_
Definition: RGBDOdometry.h:118
cloudViewer::camera::PinholeCameraIntrinsic
Contains the pinhole camera intrinsic parameters.
Definition: PinholeCameraIntrinsic.h:34
cloudViewer::core::Float64
const Dtype Float64
Definition: Dtype.cpp:43
cloudViewer::core::Tensor::GetDevice
Device GetDevice() const override
Definition: Tensor.cpp:1435
cloudViewer::t::pipelines::odometry::ComputeOdometryResultIntensity
OdometryResult ComputeOdometryResultIntensity(const Tensor &source_depth, const Tensor &target_depth, const Tensor &source_intensity, const Tensor &target_intensity, const Tensor &target_intensity_dx, const Tensor &target_intensity_dy, const Tensor &source_vertex_map, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_outlier_trunc, const float intensity_huber_delta)
Estimates the 4x4 rigid transformation T from source to target, with inlier rmse and fitness....
Definition: RGBDOdometry.cpp:420
cloudViewer::core::CUDAScopedDevice
When CUDA is not enabled, this is a dummy class.
Definition: CUDAUtils.h:214
cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrix
void ComputeOdometryInformationMatrix(const core::Tensor &source_vertex_map, const core::Tensor &target_vertex_map, const core::Tensor &intrinsic, const core::Tensor &source_to_target, const float square_dist_thr, core::Tensor &information)
Definition: RGBDOdometry.cpp:195
cloudViewer::core::Float32
const Dtype Float32
Definition: Dtype.cpp:42
cloudViewer::t::geometry::Image::PyrDownDepth
Image PyrDownDepth(float diff_threshold, float invalid_fill=0.f) const
Edge and invalid value preserving downsampling by 2 specifically for depth images.
Definition: Image.cpp:400
cloudViewer::t::pipelines::odometry::ComputeOdometryResultPointToPlane
OdometryResult ComputeOdometryResultPointToPlane(const Tensor &source_vertex_map, const Tensor &target_vertex_map, const Tensor &target_normal_map, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_outlier_trunc, const float depth_huber_delta)
Estimates the 4x4 rigid transformation T from source to target, with inlier rmse and fitness....
Definition: RGBDOdometry.cpp:392
cloudViewer::data::SampleRedwoodRGBDImages::GetDepthPaths
std::vector< std::string > GetDepthPaths() const
Returns List of paths to depth image samples of size 5.
Definition: Dataset.h:1054
LogError
#define LogError(...)
Definition: Logging.h:60
cloudViewer::t::geometry::Image::HAVE_IPP
static constexpr bool HAVE_IPP
Do we use IPP for accelerating image processing operations?
Definition: Image.h:339
cloudViewer::t::geometry::Image::FilterBilateral
Image FilterBilateral(int kernel_size=3, float value_sigma=20.0f, float distance_sigma=10.0f) const
Return a new image after bilateral filtering.
Definition: Image.cpp:239
cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultHybrid
void ComputeOdometryResultHybrid(const core::Tensor &source_depth, const core::Tensor &target_depth, const core::Tensor &source_intensity, const core::Tensor &target_intensity, const core::Tensor &target_depth_dx, const core::Tensor &target_depth_dy, const core::Tensor &target_intensity_dx, const core::Tensor &target_intensity_dy, const core::Tensor &source_vertex_map, const core::Tensor &intrinsics, const core::Tensor &init_source_to_target, core::Tensor &delta, float &inlier_residual, int &inlier_count, const float depth_outlier_trunc, const float depth_huber_delta, const float intensity_huber_delta)
Definition: RGBDOdometry.cpp:126
cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultHybridCPU
void ComputeOdometryResultHybridCPU(const core::Tensor &source_depth, const core::Tensor &target_depth, const core::Tensor &source_intensity, const core::Tensor &target_intensity, const core::Tensor &target_depth_dx, const core::Tensor &target_depth_dy, const core::Tensor &target_intensity_dx, const core::Tensor &target_intensity_dy, const core::Tensor &source_vertex_map, const core::Tensor &intrinsics, const core::Tensor &init_source_to_target, core::Tensor &delta, float &inlier_residual, int &inlier_count, const float depth_outlier_trunc, const float depth_huber_delta, const float intensity_huber_delta)
Definition: RGBDOdometryCPU.cpp:207
cloudViewer::core::Device::IsCPU
bool IsCPU() const
Returns true iff device type is CPU.
Definition: Device.h:46
cloudViewer::t::pipelines::odometry::Method::PointToPlane
@ PointToPlane
cloudViewer::t::pipelines::odometry::CreateIntrisicTensor
static core::Tensor CreateIntrisicTensor()
Definition: RGBDOdometry.cpp:26
AssertTensorDtype
#define AssertTensorDtype(tensor,...)
Definition: TensorCheck.h:21
ImageIO.h
Image.h
Image.h
Tensor.h
cloudViewer::t::pipelines::odometry::OdometryLossParams::depth_huber_delta_
float depth_huber_delta_
Definition: RGBDOdometry.h:117
cloudViewer::t::geometry::RGBDImage::color_
Image color_
The color image.
Definition: RGBDImage.h:104
RGBDOdometry.h
cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScaleIntensity
OdometryResult RGBDOdometryMultiScaleIntensity(const RGBDImage &source, const RGBDImage &target, const Tensor &intrinsic, const Tensor &trans, const float depth_scale, const float depth_max, const std::vector< OdometryConvergenceCriteria > &criteria, const OdometryLossParams &params)
Definition: RGBDOdometry.cpp:190
cloudViewer::camera::PinholeCameraIntrinsic::GetPrincipalPoint
std::pair< double, double > GetPrincipalPoint() const
Definition: PinholeCameraIntrinsic.h:93
cloudViewer::t::io::CreateImageFromFile
std::shared_ptr< geometry::Image > CreateImageFromFile(const std::string &filename)
Definition: ImageIO.cpp:48
cloudViewer::core::Device::DeviceType::CUDA
@ CUDA
cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrixCPU
void ComputeOdometryInformationMatrixCPU(const core::Tensor &source_vertex_map, const core::Tensor &target_vertex_map, const core::Tensor &intrinsic, const core::Tensor &source_to_target, const float square_dist_thr, core::Tensor &information)
Definition: RGBDOdometryCPU.cpp:26
cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultPointToPlaneCPU
void ComputeOdometryResultPointToPlaneCPU(const core::Tensor &source_vertex_map, const core::Tensor &target_vertex_map, const core::Tensor &target_normal_map, const core::Tensor &intrinsics, const core::Tensor &init_source_to_target, core::Tensor &delta, float &inlier_residual, int &inlier_count, const float depth_outlier_trunc, const float depth_huber_delta)
Definition: RGBDOdometryCPU.cpp:315
AssertTensorShape
#define AssertTensorShape(tensor,...)
Definition: TensorCheck.h:61
cloudViewer::camera::PinholeCameraIntrinsic::GetFocalLength
std::pair< double, double > GetFocalLength() const
Returns the focal length in a tuple of X-axis and Y-axis focal lengths.
Definition: PinholeCameraIntrinsic.h:87
cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultIntensity
void ComputeOdometryResultIntensity(const core::Tensor &source_depth, const core::Tensor &target_depth, const core::Tensor &source_intensity, const core::Tensor &target_intensity, const core::Tensor &target_intensity_dx, const core::Tensor &target_intensity_dy, const core::Tensor &source_vertex_map, const core::Tensor &intrinsics, const core::Tensor &init_source_to_target, core::Tensor &delta, float &inlier_residual, int &inlier_count, const float depth_outlier_trunc, const float intensity_huber_delta)
Definition: RGBDOdometry.cpp:66
cloudViewer::core::Device::GetType
DeviceType GetType() const
Returns type of the device, e.g. DeviceType::CPU, DeviceType::CUDA.
Definition: Device.h:58
cloudViewer::core::cuda::Synchronize
void Synchronize()
Definition: CUDAUtils.cpp:59
cloudViewer::t::pipelines::odometry::ComputeOdometryResultHybrid
OdometryResult ComputeOdometryResultHybrid(const Tensor &source_depth, const Tensor &target_depth, const Tensor &source_intensity, const Tensor &target_intensity, const Tensor &target_depth_dx, const Tensor &target_depth_dy, const Tensor &target_intensity_dx, const Tensor &target_intensity_dy, const Tensor &source_vertex_map, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_outlier_trunc, const float depth_huber_delta, const float intensity_huber_delta)
Estimates the 4x4 rigid transformation T from source to target, with inlier rmse and fitness....
Definition: RGBDOdometry.cpp:453
AssertTensorDtypes
#define AssertTensorDtypes(tensor,...)
Definition: TensorCheck.h:33
cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScaleHybrid
OdometryResult RGBDOdometryMultiScaleHybrid(const RGBDImage &source, const RGBDImage &target, const Tensor &intrinsics, const Tensor &trans, const float depth_scale, const float depth_max, const std::vector< OdometryConvergenceCriteria > &criteria, const OdometryLossParams &params)
Definition: RGBDOdometry.cpp:288
DrawGeometry.h
cloudViewer::t::pipelines::kernel::PoseToTransformation
core::Tensor PoseToTransformation(const core::Tensor &pose)
Convert pose to the transformation matrix.
Definition: TransformationConverter.cpp:73
cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScale
OdometryResult RGBDOdometryMultiScale(const RGBDImage &source, const RGBDImage &target, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_scale, const float depth_max, const std::vector< OdometryConvergenceCriteria > &criteria, const Method method, const OdometryLossParams &params)
Create an RGBD image pyramid given the original source and target RGBD images, and perform hierarchic...
Definition: RGBDOdometry.cpp:56
PinholeCameraIntrinsic.h
cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultPointToPlane
void ComputeOdometryResultPointToPlane(const core::Tensor &source_vertex_map, const core::Tensor &target_vertex_map, const core::Tensor &target_normal_map, const core::Tensor &intrinsics, const core::Tensor &init_source_to_target, core::Tensor &delta, float &inlier_residual, int &inlier_count, const float depth_outlier_trunc, const float depth_huber_delta)
Definition: RGBDOdometry.cpp:19
cloudViewer::core::Tensor::To
Tensor To(Dtype dtype, bool copy=false) const
Definition: Tensor.cpp:739
cloudViewer::t::geometry::RGBDImage
RGBDImage A pair of color and depth images.
Definition: RGBDImage.h:21