OpenCV Class Reference

Contains functions for using ic4::ImageBuffer objects using OpenCV. More...

Static Public Member Functions

static cv::Mat 
wrap (const ic4::ImageBuffer &buffer, ic4::Error &err=ic4::Error::Default())

Wraps the passed image buffer in an OpenCV cv::Mat.

static bool 
canWrap (const ic4::ImageBuffer &buffer)

Checks whether wrap can work on the image buffer's pixel format.

static cv::Mat 
copy (const ic4::ImageBuffer &buffer, ic4::Error &err=ic4::Error::Default())

Creates a copy of the image buffer and stores it in an OpenCV cv::Mat.

Detailed Description

Contains functions for using ic4::ImageBuffer objects using OpenCV.

The OpenCV interop support functions are declared in ic4interop/interop-OpenCV.h.

Member Function Documentation

◆ canWrap()

static bool canWrap ( const ic4::ImageBuffer buffer)
inlinestatic

Checks whether wrap can work on the image buffer's pixel format.

Parameters
[in]bufferAn image buffer
Returns
true, if the contents of the image buffer can be wrapped in an OpenCV cv::Mat, otherwise false.
Remarks
Wrapping the contents of an image buffer in an OpenCV cv::Mat is only possible if the pixel format is one of the following:
  • Mono8 or any Bayer8 format
  • Mono16 or any Bayer16 format
  • BGRa8, BGR8 or BGRa16
  • YCbCr422_8 or YUV422_8

◆ copy()

static cv::Mat copy ( const ic4::ImageBuffer buffer,
ic4::Error err = ic4::Error::Default() 
)
inlinestatic

Creates a copy of the image buffer and stores it in an OpenCV cv::Mat.

Parameters
[in]bufferAn image buffer
[out]errReference to an error handler. See Error Handling for details.
Returns
An OpenCV cv::Mat containing a copy of the image data from the passed image buffer.

◆ wrap()

static cv::Mat wrap ( const ic4::ImageBuffer buffer,
ic4::Error err = ic4::Error::Default() 
)
inlinestatic

Wraps the passed image buffer in an OpenCV cv::Mat.

Parameters
[in]bufferAn image buffer
[out]errReference to an error handler. See Error Handling for details.
Returns
An OpenCV cv::Mat using the image buffer's memory as pixel storage
Remarks
Wrapping the contents of an image buffer in an OpenCV cv::Mat is only possible if the pixel format is one of the following:
  • Mono8 or any Bayer8 format
  • Mono16 or any Bayer16 format
  • BGRa8, BGR8 or BGRa16
  • YCbCr422_8 or YUV422_8