OpenCV  5.0.0-pre
Open Source Computer Vision
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions
Eigen support

Detailed Description

These functions are provided for OpenCV-Eigen interoperability. They convert Mat objects to corresponding Eigen::Matrix objects and vice-versa. Consult the Eigen documentation for information about the Matrix template type.

Note
Using these functions requires the Eigen/Dense or similar header to be included before this header.

Namespaces

namespace  cv::traits
 

Classes

class  cv::Affine3< T >
 Affine transform. More...
 

Typedefs

typedef Affine3< double > cv::Affine3d
 
typedef Affine3< float > cv::Affine3f
 

Functions

template<typename _Tp >
static void cv::cv2eigen (const Mat &src, Eigen::Matrix< _Tp, 1, Eigen::Dynamic > &dst)
 
template<typename _Tp , int _rows, int _cols, int _options, int _maxRows, int _maxCols>
static void cv::cv2eigen (const Mat &src, Eigen::Matrix< _Tp, _rows, _cols, _options, _maxRows, _maxCols > &dst)
 
template<typename _Tp >
static void cv::cv2eigen (const Mat &src, Eigen::Matrix< _Tp, Eigen::Dynamic, 1 > &dst)
 
template<typename _Tp >
static void cv::cv2eigen (const Mat &src, Eigen::Matrix< _Tp, Eigen::Dynamic, Eigen::Dynamic > &dst)
 
template<typename _Tp >
static void cv::cv2eigen (const Mat &src, Eigen::Matrix< _Tp, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &dst)
 
template<typename _Tp , int _layout>
static void cv::cv2eigen (const Mat &src, Eigen::Tensor< _Tp, 3, _layout > &dst)
 Converts a cv::Mat to an Eigen::Tensor.
 
template<typename _Tp , int _cols>
static void cv::cv2eigen (const Matx< _Tp, 1, _cols > &src, Eigen::Matrix< _Tp, 1, Eigen::Dynamic > &dst)
 
template<typename _Tp , int _rows>
static void cv::cv2eigen (const Matx< _Tp, _rows, 1 > &src, Eigen::Matrix< _Tp, Eigen::Dynamic, 1 > &dst)
 
template<typename _Tp , int _rows, int _cols, int _options, int _maxRows, int _maxCols>
static void cv::cv2eigen (const Matx< _Tp, _rows, _cols > &src, Eigen::Matrix< _Tp, _rows, _cols, _options, _maxRows, _maxCols > &dst)
 
template<typename _Tp , int _rows, int _cols>
static void cv::cv2eigen (const Matx< _Tp, _rows, _cols > &src, Eigen::Matrix< _Tp, Eigen::Dynamic, Eigen::Dynamic > &dst)
 
template<typename _Tp , int _rows, int _cols>
static void cv::cv2eigen (const Matx< _Tp, _rows, _cols > &src, Eigen::Matrix< _Tp, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &dst)
 
template<typename _Tp >
static Eigen::TensorMap< Eigen::Tensor< _Tp, 3, Eigen::RowMajor > > cv::cv2eigen_tensormap (InputArray src)
 Maps cv::Mat data to an Eigen::TensorMap.
 
template<typename _Tp , int _rows, int _cols, int _options, int _maxRows, int _maxCols>
static void cv::eigen2cv (const Eigen::Matrix< _Tp, _rows, _cols, _options, _maxRows, _maxCols > &src, Matx< _Tp, _rows, _cols > &dst)
 
template<typename _Tp , int _rows, int _cols, int _options, int _maxRows, int _maxCols>
static void cv::eigen2cv (const Eigen::Matrix< _Tp, _rows, _cols, _options, _maxRows, _maxCols > &src, OutputArray dst)
 
template<typename _Tp , int _layout>
static void cv::eigen2cv (const Eigen::Tensor< _Tp, 3, _layout > &src, OutputArray dst)
 Converts an Eigen::Tensor to a cv::Mat.
 
template<typename T , typename V >
static V cv::operator* (const Affine3< T > &affine, const V &vector)
 V is a 3-element vector with member fields x, y and z.
 
template<typename T >
static Affine3< T > cv::operator* (const Affine3< T > &affine1, const Affine3< T > &affine2)
 
static Vec3d cv::operator* (const Affine3d &affine, const Vec3d &vector)
 
static Vec3f cv::operator* (const Affine3f &affine, const Vec3f &vector)
 

Typedef Documentation

◆ Affine3d

typedef Affine3<double> cv::Affine3d

◆ Affine3f

typedef Affine3<float> cv::Affine3f

Function Documentation

◆ cv2eigen() [1/11]

template<typename _Tp >
static void cv::cv2eigen ( const Mat src,
Eigen::Matrix< _Tp, 1, Eigen::Dynamic > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen() [2/11]

template<typename _Tp , int _rows, int _cols, int _options, int _maxRows, int _maxCols>
static void cv::cv2eigen ( const Mat src,
Eigen::Matrix< _Tp, _rows, _cols, _options, _maxRows, _maxCols > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen() [3/11]

template<typename _Tp >
static void cv::cv2eigen ( const Mat src,
Eigen::Matrix< _Tp, Eigen::Dynamic, 1 > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen() [4/11]

template<typename _Tp >
static void cv::cv2eigen ( const Mat src,
Eigen::Matrix< _Tp, Eigen::Dynamic, Eigen::Dynamic > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen() [5/11]

template<typename _Tp >
static void cv::cv2eigen ( const Mat src,
Eigen::Matrix< _Tp, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen() [6/11]

template<typename _Tp , int _layout>
static void cv::cv2eigen ( const Mat src,
Eigen::Tensor< _Tp, 3, _layout > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Converts a cv::Mat to an Eigen::Tensor.

The method converts a cv::Mat to an Eigen Tensor with shape (H x W x C) where: H = number of rows W = number of columns C = number of channels

Usage:

Mat a_mat(...);
// populate Mat with values
Eigen::Tensor<float, 3, Eigen::RowMajor> a_tensor(...);
cv2eigen(a_mat, a_tensor);
n-dimensional dense array class
Definition mat.hpp:950
static void cv2eigen(const Mat &src, Eigen::Tensor< _Tp, 3, _layout > &dst)
Converts a cv::Mat to an Eigen::Tensor.
Definition eigen.hpp:133
Here is the call graph for this function:

◆ cv2eigen() [7/11]

template<typename _Tp , int _cols>
static void cv::cv2eigen ( const Matx< _Tp, 1, _cols > &  src,
Eigen::Matrix< _Tp, 1, Eigen::Dynamic > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen() [8/11]

template<typename _Tp , int _rows>
static void cv::cv2eigen ( const Matx< _Tp, _rows, 1 > &  src,
Eigen::Matrix< _Tp, Eigen::Dynamic, 1 > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen() [9/11]

template<typename _Tp , int _rows, int _cols, int _options, int _maxRows, int _maxCols>
static void cv::cv2eigen ( const Matx< _Tp, _rows, _cols > &  src,
Eigen::Matrix< _Tp, _rows, _cols, _options, _maxRows, _maxCols > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen() [10/11]

template<typename _Tp , int _rows, int _cols>
static void cv::cv2eigen ( const Matx< _Tp, _rows, _cols > &  src,
Eigen::Matrix< _Tp, Eigen::Dynamic, Eigen::Dynamic > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen() [11/11]

template<typename _Tp , int _rows, int _cols>
static void cv::cv2eigen ( const Matx< _Tp, _rows, _cols > &  src,
Eigen::Matrix< _Tp, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ cv2eigen_tensormap()

template<typename _Tp >
static Eigen::TensorMap< Eigen::Tensor< _Tp, 3, Eigen::RowMajor > > cv::cv2eigen_tensormap ( InputArray  src)
inlinestatic

#include <opencv2/core/eigen.hpp>

Maps cv::Mat data to an Eigen::TensorMap.

The method wraps an existing Mat data array with an Eigen TensorMap of shape (H x W x C) where: H = number of rows W = number of columns C = number of channels

Explicit instantiation of the return type is required.

Note
Caller should be aware of the lifetime of the cv::Mat instance and take appropriate safety measures. The cv::Mat instance will retain ownership of the data and the Eigen::TensorMap will lose access when the cv::Mat data is deallocated.

The example below initializes a cv::Mat and produces an Eigen::TensorMap:

float arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
Mat a_mat(2, 2, CV_32FC3, arr);
Eigen::TensorMap<Eigen::Tensor<float, 3, Eigen::RowMajor>> a_tensormap = cv2eigen_tensormap<float>(a_mat);
#define CV_32FC3
Definition interface.h:131
Here is the call graph for this function:

◆ eigen2cv() [1/3]

template<typename _Tp , int _rows, int _cols, int _options, int _maxRows, int _maxCols>
static void cv::eigen2cv ( const Eigen::Matrix< _Tp, _rows, _cols, _options, _maxRows, _maxCols > &  src,
Matx< _Tp, _rows, _cols > &  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ eigen2cv() [2/3]

template<typename _Tp , int _rows, int _cols, int _options, int _maxRows, int _maxCols>
static void cv::eigen2cv ( const Eigen::Matrix< _Tp, _rows, _cols, _options, _maxRows, _maxCols > &  src,
OutputArray  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Here is the call graph for this function:

◆ eigen2cv() [3/3]

template<typename _Tp , int _layout>
static void cv::eigen2cv ( const Eigen::Tensor< _Tp, 3, _layout > &  src,
OutputArray  dst 
)
inlinestatic

#include <opencv2/core/eigen.hpp>

Converts an Eigen::Tensor to a cv::Mat.

The method converts an Eigen::Tensor with shape (H x W x C) to a cv::Mat where: H = number of rows W = number of columns C = number of channels

Usage:

Eigen::Tensor<float, 3, Eigen::RowMajor> a_tensor(...);
// populate tensor with values
Mat a_mat;
eigen2cv(a_tensor, a_mat);
static void eigen2cv(const Eigen::Tensor< _Tp, 3, _layout > &src, OutputArray dst)
Converts an Eigen::Tensor to a cv::Mat.
Definition eigen.hpp:101
Here is the call graph for this function:

◆ operator*() [1/4]

template<typename T , typename V >
static V cv::operator* ( const Affine3< T > &  affine,
const V &  vector 
)
static

#include <opencv2/core/affine.hpp>

V is a 3-element vector with member fields x, y and z.

◆ operator*() [2/4]

template<typename T >
static Affine3< T > cv::operator* ( const Affine3< T > &  affine1,
const Affine3< T > &  affine2 
)
static

◆ operator*() [3/4]

static Vec3d cv::operator* ( const Affine3d affine,
const Vec3d vector 
)
static

◆ operator*() [4/4]

static Vec3f cv::operator* ( const Affine3f affine,
const Vec3f vector 
)
static