19 namespace eigen_converter {
28 template <
class Derived>
30 typedef typename Derived::Scalar
Scalar;
31 core::Dtype dtype = core::Dtype::FromType<Scalar>();
32 Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
33 matrix_row_major = matrix;
34 return core::Tensor(matrix_row_major.data(), {matrix.rows(), matrix.cols()},
43 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
51 Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
59 Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
107 const std::vector<Eigen::Vector3d> &values,
121 const std::vector<Eigen::Vector2d> &values,
135 const std::vector<Eigen::Vector2i> &values,
148 const std::vector<Eigen::Vector3i> &values,
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:145
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:160
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,...
Definition: EigenConverter.cpp:77
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:179
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:185
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,...
Definition: EigenConverter.cpp:67
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:155
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:165
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:150
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.
Definition: EigenConverter.h:29
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:172
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,...
Definition: EigenConverter.cpp:72
Definition: PinholeCameraIntrinsic.cpp:16