38 namespace eigen_converter {
45 template <
class T,
int M,
int N,
int A>
48 Eigen::Matrix<T, M, N, Eigen::RowMajor> matrix_row_major = matrix;
49 return core::Tensor(matrix_row_major.data(), {matrix.rows(), matrix.cols()},
58 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
66 Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
74 Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
122 const std::vector<Eigen::Vector3d> &values,
136 const std::vector<Eigen::Vector2d> &values,
150 const std::vector<Eigen::Vector2i> &values,
163 const std::vector<Eigen::Vector3i> &values,
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...
Definition: EigenConverter.cpp:179
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 conve...
Definition: EigenConverter.cpp:198
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.
Definition: EigenConverter.cpp:86
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 conve...
Definition: EigenConverter.cpp:204
Definition: PinholeCameraIntrinsic.cpp:35
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.
Definition: EigenConverter.cpp:96
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.
Definition: EigenConverter.cpp:91
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 conve...
Definition: EigenConverter.cpp:191
core::Tensor EigenMatrixToTensor(const Eigen::Matrix< T, M, N, A > &matrix)
Converts a Eigen matrix of shape (M, N) with alignment A and type T to a Tensor.
Definition: EigenConverter.h:46
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...
Definition: EigenConverter.cpp:164
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 conve...
Definition: EigenConverter.cpp:184
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...
Definition: EigenConverter.cpp:174
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...
Definition: EigenConverter.cpp:169