47 transformation[3][3] = 1;
48 return transformation;
51 template <
typename scalar_t>
56 scalar_t *transformation_ptr = transformation.
GetDataPtr<scalar_t>();
57 const scalar_t *pose_ptr = pose.
GetDataPtr<scalar_t>();
60 PoseToTransformationImpl<scalar_t>(transformation_ptr, pose_ptr);
62 #ifdef BUILD_CUDA_MODULE
64 PoseToTransformationCUDA<scalar_t>(transformation_ptr, pose_ptr);
85 PoseToTransformationDevice<scalar_t>(transformation, pose_,
94 transformation[3][3] = 1;
95 return transformation;
98 template <
typename scalar_t>
103 scalar_t *pose_ptr = pose.
GetDataPtr<scalar_t>();
104 const scalar_t *transformation_ptr = transformation.
GetDataPtr<scalar_t>();
107 TransformationToPoseImpl<scalar_t>(pose_ptr, transformation_ptr);
109 #ifdef BUILD_CUDA_MODULE
110 TransformationToPoseCUDA<scalar_t>(pose_ptr, transformation_ptr);
131 TransformationToPoseDevice<scalar_t>(pose, transformation_,
147 float &inlier_residual,
153 double *A_1x29_ptr = A_1x29_host.
GetDataPtr<
double>();
158 double *AtA_local_ptr = AtA.
GetDataPtr<
double>();
159 double *Atb_local_ptr = Atb.GetDataPtr<
double>();
161 for (
int j = 0; j < 6; j++) {
162 Atb_local_ptr[j] = A_1x29_ptr[21 + j];
163 const int64_t reduction_idx = ((j * (j + 1)) / 2);
164 for (
int k = 0; k <= j; k++) {
165 AtA_local_ptr[j * 6 + k] = A_1x29_ptr[reduction_idx + k];
166 AtA_local_ptr[k * 6 + j] = A_1x29_ptr[reduction_idx + k];
172 delta = AtA.
Solve(Atb.Neg());
173 inlier_residual = A_1x29_ptr[27];
174 inlier_count =
static_cast<int>(A_1x29_ptr[28]);
175 }
catch (
const std::runtime_error &) {
177 "Singular 6x6 linear system detected, tracking failed.");
#define DISPATCH_FLOAT_DTYPE_TO_TEMPLATE(DTYPE,...)
#define AssertTensorDevice(tensor,...)
#define AssertTensorDtype(tensor,...)
#define AssertTensorDtypes(tensor,...)
#define AssertTensorShape(tensor,...)
When CUDA is not enabled, this is a dummy class.
DeviceType
Type for device.
static TensorKey Slice(utility::optional< int64_t > start, utility::optional< int64_t > stop, utility::optional< int64_t > step)
Tensor Solve(const Tensor &rhs) const
Tensor Contiguous() const
Tensor GetItem(const TensorKey &tk) const
Tensor SetItem(const Tensor &value)
Set all items. Equivalent to tensor[:] = value in Python.
static Tensor Zeros(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with zeros.
Device GetDevice() const override
Tensor Reshape(const SizeVector &dst_shape) const
static Tensor Empty(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor with uninitialized values.
void Fill(S v)
Fill the whole Tensor with a scalar value, the scalar will be casted to the Tensor's Dtype.
Tensor To(Dtype dtype, bool copy=false) const
core::Tensor RtToTransformation(const core::Tensor &R, const core::Tensor &t)
Convert rotation and translation to the transformation matrix.
static void TransformationToPoseDevice(core::Tensor &pose, const core::Tensor &transformation, const core::Device::DeviceType &device_type)
void DecodeAndSolve6x6(const core::Tensor &A_reduction, core::Tensor &delta, float &inlier_residual, int &inlier_count)
Decodes a 6x6 linear system from a compressed 29x1 tensor.
core::Tensor TransformationToPose(const core::Tensor &transformation)
Convert transformation matrix to pose.
static void PoseToTransformationDevice(core::Tensor &transformation, const core::Tensor &pose, const core::Device::DeviceType &device_type)
core::Tensor PoseToTransformation(const core::Tensor &pose)
Convert pose to the transformation matrix.
Generic file read and write utility for python interface.