Open3D (C++ API)  0.18.0
Functions
open3d::core::eigen_converter Namespace Reference

Functions

Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > TensorToEigenMatrixXd (const core::Tensor &tensor)
 Converts a 2D tensor to Eigen::MatrixXd of same shape. Regardless of the tensor dtype, the output will be converted to double. More...
 
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > TensorToEigenMatrixXf (const core::Tensor &tensor)
 Converts a 2D tensor to Eigen::MatrixXf of same shape. Regardless of the tensor dtype, the output will be converted to float. More...
 
Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > TensorToEigenMatrixXi (const core::Tensor &tensor)
 Converts a 2D tensor to Eigen::MatrixXi of same shape. Regardless of the tensor dtype, the output will be converted to int. More...
 
std::vector< Eigen::Vector2d > TensorToEigenVector2dVector (const core::Tensor &tensor)
 Converts a tensor of shape (N, 2) to std::vector<Eigen::Vector2d>. An exception will be thrown if the tensor shape is not (N, 2). Regardless of the tensor dtype, the output will be converted to double. More...
 
std::vector< Eigen::Vector3d > TensorToEigenVector3dVector (const core::Tensor &tensor)
 Converts a tensor of shape (N, 3) to std::vector<Eigen::Vector3d>. An exception will be thrown if the tensor shape is not (N, 3). Regardless of the tensor dtype, the output will be converted to double. More...
 
std::vector< Eigen::Vector3i > TensorToEigenVector3iVector (const core::Tensor &tensor)
 Converts a tensor of shape (N, 3) to std::vector<Eigen::Vector3i>. An exception will be thrown if the tensor shape is not (N, 3). Regardless of the tensor dtype, the output will be converted to int. More...
 
std::vector< Eigen::Vector2i > TensorToEigenVector2iVector (const core::Tensor &tensor)
 Converts a tensor of shape (N, 2) to std::vector<Eigen::Vector2i>. An exception will be thrown if the tensor shape is not (N, 2). Regardless of the tensor dtype, the output will be converted to int. More...
 
core::Tensor EigenVector3dVectorToTensor (const std::vector< Eigen::Vector3d > &values, core::Dtype dtype, const core::Device &device)
 Converts a vector of Eigen::Vector3d to a (N, 3) tensor. This function also takes care of dtype conversion and device transfer if necessary. More...
 
core::Tensor EigenVector2dVectorToTensor (const std::vector< Eigen::Vector2d > &values, core::Dtype dtype, const core::Device &device)
 Converts a vector of Eigen::Vector2d to a (N, 2) tensor. This function also takes care of dtype conversion and device transfer if necessary. More...
 
core::Tensor EigenVector3iVectorToTensor (const std::vector< Eigen::Vector3i > &values, core::Dtype dtype, const core::Device &device)
 Converts a vector of Eigen::Vector3i to a (N, 3) tensor. This function also takes care of dtype conversion and device transfer if necessary. More...
 
core::Tensor EigenVector2iVectorToTensor (const std::vector< Eigen::Vector2i > &values, core::Dtype dtype, const core::Device &device)
 Converts a vector of Eigen::Vector2i to a (N, 2) tensor. This function also takes care of dtype conversion and device transfer if necessary. More...
 
template<class Derived >
core::Tensor EigenMatrixToTensor (const Eigen::MatrixBase< Derived > &matrix)
 Converts a eigen matrix of shape (M, N) with alignment A and type T to a tensor. More...
 

Function Documentation

◆ EigenMatrixToTensor()

template<class Derived >
core::Tensor open3d::core::eigen_converter::EigenMatrixToTensor ( const Eigen::MatrixBase< Derived > &  matrix)

Converts a eigen matrix of shape (M, N) with alignment A and type T to a tensor.

Parameters
matrixAn eigen matrix (e.g. Eigen::Matrix3f) or vector (e.g. Eigen::Vector3d).
Returns
A tensor converted from the eigen matrix. The resuliting tensor is always 2D.

◆ EigenVector2dVectorToTensor()

core::Tensor open3d::core::eigen_converter::EigenVector2dVectorToTensor ( const std::vector< Eigen::Vector2d > &  values,
core::Dtype  dtype,
const core::Device device 
)

Converts a vector of Eigen::Vector2d to a (N, 2) tensor. This function also takes care of dtype conversion and device transfer if necessary.

Parameters
valuesA vector of Eigen::Vector2d values, e.g. a list of UV coordinates.
dtypeDtype of the output tensor.
deviceDevice of the output tensor.
Returns
A tensor of shape (N, 2) with the specified dtype and device.

◆ EigenVector2iVectorToTensor()

core::Tensor open3d::core::eigen_converter::EigenVector2iVectorToTensor ( const std::vector< Eigen::Vector2i > &  values,
core::Dtype  dtype,
const core::Device device 
)

Converts a vector of Eigen::Vector2i to a (N, 2) tensor. This function also takes care of dtype conversion and device transfer if necessary.

Parameters
valuesA vector of Eigen::Vector2i values, e.g. a list of 2D points / indices.
dtypeDtype of the output tensor.
deviceDevice of the output tensor.
Returns
A tensor of shape (N, 2) with the specified dtype and device.

◆ EigenVector3dVectorToTensor()

core::Tensor open3d::core::eigen_converter::EigenVector3dVectorToTensor ( const std::vector< Eigen::Vector3d > &  values,
core::Dtype  dtype,
const core::Device device 
)

Converts a vector of Eigen::Vector3d to a (N, 3) tensor. This function also takes care of dtype conversion and device transfer if necessary.

Parameters
valuesA vector of Eigen::Vector3d values, e.g. a list of 3D points.
dtypeDtype of the output tensor.
deviceDevice of the output tensor.
Returns
A tensor of shape (N, 3) with the specified dtype and device.

◆ EigenVector3iVectorToTensor()

core::Tensor open3d::core::eigen_converter::EigenVector3iVectorToTensor ( const std::vector< Eigen::Vector3i > &  values,
core::Dtype  dtype,
const core::Device device 
)

Converts a vector of Eigen::Vector3i to a (N, 3) tensor. This function also takes care of dtype conversion and device transfer if necessary.

Parameters
valuesA vector of Eigen::Vector3i values, e.g. a list of 3D points.
dtypeDtype of the output tensor.
deviceDevice of the output tensor.
Returns
A tensor of shape (N, 3) with the specified dtype and device.

◆ TensorToEigenMatrixXd()

Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > open3d::core::eigen_converter::TensorToEigenMatrixXd ( const core::Tensor tensor)

Converts a 2D tensor to Eigen::MatrixXd of same shape. Regardless of the tensor dtype, the output will be converted to double.

Parameters
tensorA 2D tensor.
Returns
Eigen::MatrixXd.

◆ TensorToEigenMatrixXf()

Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > open3d::core::eigen_converter::TensorToEigenMatrixXf ( const core::Tensor tensor)

Converts a 2D tensor to Eigen::MatrixXf of same shape. Regardless of the tensor dtype, the output will be converted to float.

Parameters
tensorA 2D tensor.
Returns
Eigen::MatrixXf.

◆ TensorToEigenMatrixXi()

Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > open3d::core::eigen_converter::TensorToEigenMatrixXi ( const core::Tensor tensor)

Converts a 2D tensor to Eigen::MatrixXi of same shape. Regardless of the tensor dtype, the output will be converted to int.

Parameters
tensorA 2D tensor.
Returns
Eigen::MatrixXi.

◆ TensorToEigenVector2dVector()

std::vector< Eigen::Vector2d > open3d::core::eigen_converter::TensorToEigenVector2dVector ( const core::Tensor tensor)

Converts a tensor of shape (N, 2) to std::vector<Eigen::Vector2d>. An exception will be thrown if the tensor shape is not (N, 2). Regardless of the tensor dtype, the output will be converted to double.

Parameters
tensorA tensor of shape (N, 2).
Returns
A vector of N Eigen::Vector2d values.

◆ TensorToEigenVector2iVector()

std::vector< Eigen::Vector2i > open3d::core::eigen_converter::TensorToEigenVector2iVector ( const core::Tensor tensor)

Converts a tensor of shape (N, 2) to std::vector<Eigen::Vector2i>. An exception will be thrown if the tensor shape is not (N, 2). Regardless of the tensor dtype, the output will be converted to int.

Parameters
tensorA tensor of shape (N, 2).
Returns
A vector of N Eigen::Vector2i values.

◆ TensorToEigenVector3dVector()

std::vector< Eigen::Vector3d > open3d::core::eigen_converter::TensorToEigenVector3dVector ( const core::Tensor tensor)

Converts a tensor of shape (N, 3) to std::vector<Eigen::Vector3d>. An exception will be thrown if the tensor shape is not (N, 3). Regardless of the tensor dtype, the output will be converted to double.

Parameters
tensorA tensor of shape (N, 3).
Returns
A vector of N Eigen::Vector3d values.

◆ TensorToEigenVector3iVector()

std::vector< Eigen::Vector3i > open3d::core::eigen_converter::TensorToEigenVector3iVector ( const core::Tensor tensor)

Converts a tensor of shape (N, 3) to std::vector<Eigen::Vector3i>. An exception will be thrown if the tensor shape is not (N, 3). Regardless of the tensor dtype, the output will be converted to int.

Parameters
tensorA tensor of shape (N, 3).
Returns
A vector of N Eigen::Vector3i values.