Ocean
Ocean::CV::OpenCVUtilities Class Reference

This class implements utility functions for the migration from OpenCV to Ocean. More...

Static Public Member Functions

static cv::Mat toCvMat (const Frame &frame, const bool copy=false)
 Convert an Ocean Frame image to an OpenCV image. More...
 
static Frame toOceanFrame (const cv::Mat &frame, const bool copy=false, const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_UNDEFINED)
 Convert an OpenCV image to an Ocean Frame image object. More...
 
template<typename T >
static SquareMatrixT3< T > toOceanSquareMatrix3 (const cv::Matx< T, 3, 3 > &matrix)
 Convert an OpenCV 3-by-3 matrix (row-major) to an Ocean SquareMatrix3 (column-wise order) More...
 
template<typename T >
static SquareMatrixT3< T > toOceanSquareMatrix3Affine (const cv::Matx< T, 2, 3 > &affineTransformation)
 Convert an OpenCV 2-by-3 matrix (row-major) to an Ocean SquareMatrix3 (column-major) More...
 
template<typename T >
static cv::Matx< T, 3, 3 > toCvMatx33 (const SquareMatrixT3< T > &matrix)
 Convert an Ocean SquareMatrix3 (column-major) to an OpenCV 3-by-3 matrix (row-major) More...
 
template<typename T >
static cv::Matx< T, 2, 3 > toCvMatx23Affine (const SquareMatrixT3< T > &affineTransformation)
 Convert an Ocean SquareMatrix3 (column-major) to an OpenCV 2-by-3 matrix (row-major) More...
 
static bool toCvDepth (const FrameType::DataType dataType, int &cvDepth)
 Converts an Ocean frame data type to a corresponding depth type in OpenCV. More...
 
static bool toOceanFrameTypeDataType (const int cvDepth, FrameType::DataType &dataType)
 Converts an OpenCV depth type to a corresponding Ocean frame data type. More...
 

Detailed Description

This class implements utility functions for the migration from OpenCV to Ocean.

Member Function Documentation

◆ toCvDepth()

bool Ocean::CV::OpenCVUtilities::toCvDepth ( const FrameType::DataType  dataType,
int &  cvDepth 
)
inlinestatic

Converts an Ocean frame data type to a corresponding depth type in OpenCV.

Parameters
dataTypeThe Ocean data type that will be converted
cvDepthThe corresponding OpenCV depth type
Returns
True if a correspondence has been found, otherwise false

◆ toCvMat()

cv::Mat Ocean::CV::OpenCVUtilities::toCvMat ( const Frame frame,
const bool  copy = false 
)
inlinestatic

Convert an Ocean Frame image to an OpenCV image.

Parameters
frameAn image instance of the Ocean framework
copyIf true, the data will be copied to (and owned by) to OpenCV Mat.
Returns
An OpenCV-based version of the input image, will be empty on failure

◆ toCvMatx23Affine()

template<typename T >
cv::Matx< T, 2, 3 > Ocean::CV::OpenCVUtilities::toCvMatx23Affine ( const SquareMatrixT3< T > &  affineTransformation)
inlinestatic

Convert an Ocean SquareMatrix3 (column-major) to an OpenCV 2-by-3 matrix (row-major)

Parameters
affineTransformationAn Ocean SquareMatrix3, must be an affine transformation
Template Parameters
TType of the matrix elements (usually float or double)
Returns
The corresponding affine transformation as a 2-by-3 OpenCV matrix

◆ toCvMatx33()

template<typename T >
cv::Matx< T, 3, 3 > Ocean::CV::OpenCVUtilities::toCvMatx33 ( const SquareMatrixT3< T > &  matrix)
inlinestatic

Convert an Ocean SquareMatrix3 (column-major) to an OpenCV 3-by-3 matrix (row-major)

Parameters
matrixAn Ocean SquareMatrix3
Template Parameters
TType of the matrix elements (usually float or double)
Returns
OpenCV instance of a 3-by-3 matrix

◆ toOceanFrame()

Frame Ocean::CV::OpenCVUtilities::toOceanFrame ( const cv::Mat &  frame,
const bool  copy = false,
const FrameType::PixelFormat  pixelFormat = FrameType::FORMAT_UNDEFINED 
)
inlinestatic

Convert an OpenCV image to an Ocean Frame image object.

Parameters
frameThe OpenCV image to be converted
pixelFormatOpenCV image types do not store the pixel format. For images with 2 or more channels, specify the pixel format.
copyIf true, the data will be copied to (and owned by) to Ocean frame
Returns
An Ocean-based version of the input image, will be invalid on failure

◆ toOceanFrameTypeDataType()

bool Ocean::CV::OpenCVUtilities::toOceanFrameTypeDataType ( const int  cvDepth,
FrameType::DataType dataType 
)
inlinestatic

Converts an OpenCV depth type to a corresponding Ocean frame data type.

Parameters
cvDepthThe OpenCV depth type that will be converted
dataTypeThe corresponding Ocean data type
Returns
True if a correspondence has been found, otherwise false

◆ toOceanSquareMatrix3()

template<typename T >
SquareMatrixT3< T > Ocean::CV::OpenCVUtilities::toOceanSquareMatrix3 ( const cv::Matx< T, 3, 3 > &  matrix)
inlinestatic

Convert an OpenCV 3-by-3 matrix (row-major) to an Ocean SquareMatrix3 (column-wise order)

Parameters
matrixAn OpenCV instance of a 3-by-3 matrix
Template Parameters
TType of the matrix elements (usually float or double)
Returns
The corresponding Ocean matrix

◆ toOceanSquareMatrix3Affine()

template<typename T >
SquareMatrixT3< T > Ocean::CV::OpenCVUtilities::toOceanSquareMatrix3Affine ( const cv::Matx< T, 2, 3 > &  affineTransformation)
inlinestatic

Convert an OpenCV 2-by-3 matrix (row-major) to an Ocean SquareMatrix3 (column-major)

Parameters
affineTransformationAn OpenCV instance of a 2-by-3 matrix (OpenCV assumes the third row to be [0, 0, 1])
Template Parameters
TType of the matrix elements (usually float or double)
Returns
The corresponding affine transformation Ocean matrix (third row is [0, 0, 1])

The documentation for this class was generated from the following file: