YARP
Yet Another Robot Platform
yarp::cv Namespace Reference

Classes

struct  convert_code_from_cv
 
struct  convert_code_from_cv< yarp::sig::PixelBgr >
 
struct  convert_code_from_cv< yarp::sig::PixelBgra >
 
struct  convert_code_from_cv< yarp::sig::PixelFloat >
 
struct  convert_code_from_cv< yarp::sig::PixelHsv >
 
struct  convert_code_from_cv< yarp::sig::PixelHsvFloat >
 
struct  convert_code_from_cv< yarp::sig::PixelInt >
 
struct  convert_code_from_cv< yarp::sig::PixelMono >
 
struct  convert_code_from_cv< yarp::sig::PixelMono16 >
 
struct  convert_code_from_cv< yarp::sig::PixelMonoSigned >
 
struct  convert_code_from_cv< yarp::sig::PixelRgb >
 
struct  convert_code_from_cv< yarp::sig::PixelRgba >
 
struct  convert_code_from_cv< yarp::sig::PixelRgbFloat >
 
struct  convert_code_from_cv< yarp::sig::PixelRgbInt >
 
struct  convert_code_from_cv< yarp::sig::PixelRgbSigned >
 
struct  convert_code_to_cv
 
struct  convert_code_to_cv< yarp::sig::PixelBgr >
 
struct  convert_code_to_cv< yarp::sig::PixelBgra >
 
struct  convert_code_to_cv< yarp::sig::PixelFloat >
 
struct  convert_code_to_cv< yarp::sig::PixelHsv >
 
struct  convert_code_to_cv< yarp::sig::PixelHsvFloat >
 
struct  convert_code_to_cv< yarp::sig::PixelInt >
 
struct  convert_code_to_cv< yarp::sig::PixelMono >
 
struct  convert_code_to_cv< yarp::sig::PixelMono16 >
 
struct  convert_code_to_cv< yarp::sig::PixelMonoSigned >
 
struct  convert_code_to_cv< yarp::sig::PixelRgb >
 
struct  convert_code_to_cv< yarp::sig::PixelRgba >
 
struct  convert_code_to_cv< yarp::sig::PixelRgbFloat >
 
struct  convert_code_to_cv< yarp::sig::PixelRgbInt >
 
struct  convert_code_to_cv< yarp::sig::PixelRgbSigned >
 
struct  type_code
 
struct  type_code< yarp::sig::PixelBgr >
 
struct  type_code< yarp::sig::PixelBgra >
 
struct  type_code< yarp::sig::PixelFloat >
 
struct  type_code< yarp::sig::PixelHsv >
 
struct  type_code< yarp::sig::PixelHsvFloat >
 
struct  type_code< yarp::sig::PixelInt >
 
struct  type_code< yarp::sig::PixelMono >
 
struct  type_code< yarp::sig::PixelMono16 >
 
struct  type_code< yarp::sig::PixelMonoSigned >
 
struct  type_code< yarp::sig::PixelRgb >
 
struct  type_code< yarp::sig::PixelRgba >
 
struct  type_code< yarp::sig::PixelRgbFloat >
 
struct  type_code< yarp::sig::PixelRgbInt >
 
struct  type_code< yarp::sig::PixelRgbSigned >
 

Functions

template<typename T >
::cv::Mat toCvMat (yarp::sig::ImageOf< T > &yarpImage)
 Convert a yarp::sig::ImageOf to a cv::Mat object. More...
 
template<typename T >
yarp::sig::ImageOf< T > fromCvMat (::cv::Mat &cvImage)
 Convert a cv::Mat to a yarp::sig::ImageOf object. More...
 

Function Documentation

◆ fromCvMat()

template<typename T >
yarp::sig::ImageOf< T > yarp::cv::fromCvMat ( ::cv::Mat &  cvImage)

Convert a cv::Mat to a yarp::sig::ImageOf object.

Parameters
[in]cvImagecv::Mat input. Since the argument is passed as right-reference, the integrity of the data of the input cv::Mat is not guaranteed.
Note
The input cv::Mat's type(e.g. CV_8UC1) must be compatible with the output yarp image pixel type requested. E.g.:
  • CV_8UC3 -> ImageOf<PixelRgb>/<PixelBgr>/<PixelHsv> OK
  • CV_8UC1 -> ImageOf<PixelMono> OK
  • CV_8UC3 -> ImageOf<PixelMono> NOT OK
  • CV_8UC1 -> ImageOf<PixelRgb>/<PixelBgr>/<PixelHsv> NOT OK Please pay attention to the number of channels and pixel depth. Moreover pay attention on the lifetime of the memory of the input image, since no copy is involved.
Returns
the resulting yarp::sig::ImageOf.

Definition at line 91 of file Cv-inl.h.

◆ toCvMat()

template<typename T >
::cv::Mat yarp::cv::toCvMat ( yarp::sig::ImageOf< T > &  yarpImage)

Convert a yarp::sig::ImageOf to a cv::Mat object.

Parameters
[in]yarpImageyarp::sig::ImageOf input. Since the argument is passed as right-reference, the integrity of the data of the input yarp image is not guaranteed.
Note
The output cv::Mat has the default OpenCV color representation:
  • 1 channel: GRAY
  • 3 channels: BGR
  • 4 channel: BGRA Moreover pay attention on the lifetime of the memory of the input image, since no copy is involved.
Returns
the resulting cv::Mat.
Examples
opencv/main.cpp.