VisionWorks Toolkit Reference

April 8, 2016 | 1.4 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
OpenCV Interoperability API

Detailed Description

This section includes the OpenCV Interoperability API supported in VisionWorks.

Data Structures

class  nvx_cv::VXImageToCVMatMapper
 Utility class to map OpenVX Image into OpenCV Mat or GpuMat. More...
 

Functions

vx_matrix nvx_cv::cloneCVMatToVXMatrix (vx_context context, const cv::Mat &src_mat)
 Creates OpenVX Matrix object and copies data from OpenCV Mat. More...
 
vx_df_image nvx_cv::convertCVMatTypeToVXImageFormat (int mat_type)
 Converts from OpenCV Mat's type to OpenVX Image's format. More...
 
vx_enum nvx_cv::convertCVMatTypeToVXMatrixType (int mat_type)
 Converts from OpenCV Mat's type to OpenVX Matrix' type. More...
 
int nvx_cv::convertVXImageFormatToCVMatType (vx_df_image format, vx_uint32 plane_index=0)
 Converts from OpenVX Image's format to OpenCV Mat's type. More...
 
int nvx_cv::convertVXMatrixTypeToCVMatType (vx_enum matrix_type)
 Converts from OpenVX Matrix' type to OpenCV Mat's type. More...
 
void nvx_cv::copyCVMatToVXMatrix (const cv::Mat &src_mat, vx_matrix dst_mat)
 Copies data from OpenCV Mat to OpenVX Matrix. More...
 
void nvx_cv::copyVXMatrixToCVMat (vx_matrix src_mat, cv::Mat &dst_mat)
 Copies data from OpenVX Matrix to OpenCV Mat. More...
 
vx_image nvx_cv::createVXImageFromCVGpuMat (vx_context context, const cv::gpu::GpuMat &mat)
 Creates OpenVX Image from OpenCV GpuMat without data copy. More...
 
vx_image nvx_cv::createVXImageFromCVMat (vx_context context, const cv::Mat &mat)
 Creates OpenVX Image from OpenCV Mat without data copy. More...
 

Function Documentation

vx_matrix nvx_cv::cloneCVMatToVXMatrix ( vx_context  context,
const cv::Mat &  src_mat 
)
inline

Creates OpenVX Matrix object and copies data from OpenCV Mat.

Parameters
[in]contextOpenVX context.
[in]src_matInput OpenCV Mat.
Returns
OpenVX Matrix.

Definition at line 259 of file nvx_opencv_interop.hpp.

References nvx_cv::convertCVMatTypeToVXMatrixType(), nvx_cv::copyCVMatToVXMatrix(), VX_SUCCESS, vxCreateMatrix(), and vxGetStatus().

vx_df_image nvx_cv::convertCVMatTypeToVXImageFormat ( int  mat_type)
inline

Converts from OpenCV Mat's type to OpenVX Image's format.

Parameters
[in]mat_typeOpenCV Mat's type.
Returns
OpenVX Image's format.

Definition at line 160 of file nvx_opencv_interop.hpp.

References NVX_DF_IMAGE_2F32, NVX_DF_IMAGE_2S16, NVX_DF_IMAGE_F32, NVX_DF_IMAGE_RGB16, VX_DF_IMAGE_RGB, VX_DF_IMAGE_RGBX, VX_DF_IMAGE_S16, VX_DF_IMAGE_S32, VX_DF_IMAGE_U16, and VX_DF_IMAGE_U8.

Referenced by nvx_cv::createVXImageFromCVGpuMat(), and nvx_cv::createVXImageFromCVMat().

vx_enum nvx_cv::convertCVMatTypeToVXMatrixType ( int  mat_type)
inline

Converts from OpenCV Mat's type to OpenVX Matrix' type.

Parameters
[in]mat_typeOpenCV Mat's type.
Returns
OpenVX Matrix' type.

Definition at line 78 of file nvx_opencv_interop.hpp.

References NVX_TYPE_POINT2F, NVX_TYPE_POINT3F, VX_TYPE_FLOAT32, VX_TYPE_FLOAT64, VX_TYPE_INT16, VX_TYPE_INT32, VX_TYPE_INT8, VX_TYPE_UINT16, and VX_TYPE_UINT8.

Referenced by nvx_cv::cloneCVMatToVXMatrix().

int nvx_cv::convertVXImageFormatToCVMatType ( vx_df_image  format,
vx_uint32  plane_index = 0 
)
inline

Converts from OpenVX Image's format to OpenCV Mat's type.

Parameters
[in]formatOpenVX Image's format.
[in]plane_indexOptional OpenVX Image's plane index.
Returns
OpenCV Mat's type.

Definition at line 114 of file nvx_opencv_interop.hpp.

References NVX_DF_IMAGE_2F32, NVX_DF_IMAGE_2S16, NVX_DF_IMAGE_F32, NVX_DF_IMAGE_RGB16, VX_DF_IMAGE_IYUV, VX_DF_IMAGE_NV12, VX_DF_IMAGE_NV21, VX_DF_IMAGE_RGB, VX_DF_IMAGE_RGBX, VX_DF_IMAGE_S16, VX_DF_IMAGE_S32, VX_DF_IMAGE_U16, VX_DF_IMAGE_U32, VX_DF_IMAGE_U8, VX_DF_IMAGE_UYVY, VX_DF_IMAGE_YUV4, and VX_DF_IMAGE_YUYV.

Referenced by nvx_cv::VXImageToCVMatMapper::VXImageToCVMatMapper().

int nvx_cv::convertVXMatrixTypeToCVMatType ( vx_enum  matrix_type)
inline

Converts from OpenVX Matrix' type to OpenCV Mat's type.

Parameters
[in]matrix_typeOpenVX Matrix' type.
Returns
OpenCV Mat's type.

Definition at line 42 of file nvx_opencv_interop.hpp.

References NVX_TYPE_POINT2F, NVX_TYPE_POINT3F, VX_TYPE_FLOAT32, VX_TYPE_FLOAT64, VX_TYPE_INT16, VX_TYPE_INT32, VX_TYPE_INT8, VX_TYPE_UINT16, VX_TYPE_UINT32, and VX_TYPE_UINT8.

Referenced by nvx_cv::copyCVMatToVXMatrix(), and nvx_cv::copyVXMatrixToCVMat().

void nvx_cv::copyCVMatToVXMatrix ( const cv::Mat &  src_mat,
vx_matrix  dst_mat 
)
inline

Copies data from OpenCV Mat to OpenVX Matrix.

Parameters
[in]src_matInput OpenCV Mat. It must be a continuous matrix.
[out]dst_matOutput OpenVX Matrix.

Definition at line 227 of file nvx_opencv_interop.hpp.

References nvx_cv::convertVXMatrixTypeToCVMatType(), VX_MATRIX_ATTRIBUTE_COLUMNS, VX_MATRIX_ATTRIBUTE_ROWS, VX_MATRIX_ATTRIBUTE_TYPE, VX_SUCCESS, vxQueryMatrix(), and vxWriteMatrix().

Referenced by nvx_cv::cloneCVMatToVXMatrix().

void nvx_cv::copyVXMatrixToCVMat ( vx_matrix  src_mat,
cv::Mat &  dst_mat 
)
inline

Copies data from OpenVX Matrix to OpenCV Mat.

Parameters
[in]src_matInput OpenVX Matrix.
[out]dst_matOutput OpenCV Mat.

Definition at line 196 of file nvx_opencv_interop.hpp.

References nvx_cv::convertVXMatrixTypeToCVMatType(), VX_MATRIX_ATTRIBUTE_COLUMNS, VX_MATRIX_ATTRIBUTE_ROWS, VX_MATRIX_ATTRIBUTE_TYPE, VX_SUCCESS, vxQueryMatrix(), and vxReadMatrix().

vx_image nvx_cv::createVXImageFromCVGpuMat ( vx_context  context,
const cv::gpu::GpuMat &  mat 
)
inline

Creates OpenVX Image from OpenCV GpuMat without data copy.

The OpenVX Image points to the same pixels as the OpenCV GpuMat.

Note
The OpenCV GpuMat object must not be released until the OpenVX Image object is destroyed.
Parameters
[in]contextOpenVX context.
[in]matInput OpenCV GpuMat to import.
Returns
OpenVX Image object imported from input OpenCV GpuMat.

Definition at line 314 of file nvx_opencv_interop.hpp.

References nvx_cv::convertCVMatTypeToVXImageFormat(), vx_imagepatch_addressing_t::dim_x, NVX_IMPORT_TYPE_CUDA, VX_SUCCESS, vxCreateImageFromHandle(), and vxGetStatus().

vx_image nvx_cv::createVXImageFromCVMat ( vx_context  context,
const cv::Mat &  mat 
)
inline

Creates OpenVX Image from OpenCV Mat without data copy.

The OpenVX Image points to the same pixels as the OpenCV Mat.

Note
The OpenCV Mat object must not be released until the OpenVX Image object is destroyed.
Parameters
[in]contextOpenVX context.
[in]matInput OpenCV Mat to import.
Returns
OpenVX Image object imported from input OpenCV Mat.

Definition at line 283 of file nvx_opencv_interop.hpp.

References nvx_cv::convertCVMatTypeToVXImageFormat(), vx_imagepatch_addressing_t::dim_x, VX_IMPORT_TYPE_HOST, VX_SUCCESS, vxCreateImageFromHandle(), and vxGetStatus().