Visual Servoing Platform  version 3.0.0
vpImageConvert Class Reference

#include <visp3/core/vpImageConvert.h>

Static Public Member Functions

static void convert (const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
 
static void convert (const vpImage< vpRGBa > &src, vpImage< unsigned char > &dest)
 
static void convert (const vpImage< float > &src, vpImage< unsigned char > &dest)
 
static void convert (const vpImage< unsigned char > &src, vpImage< float > &dest)
 
static void convert (const vpImage< double > &src, vpImage< unsigned char > &dest)
 
static void convert (const vpImage< unsigned char > &src, vpImage< double > &dest)
 
static void convert (const IplImage *src, vpImage< vpRGBa > &dest, bool flip=false)
 
static void convert (const IplImage *src, vpImage< unsigned char > &dest, bool flip=false)
 
static void convert (const vpImage< vpRGBa > &src, IplImage *&dest)
 
static void convert (const vpImage< unsigned char > &src, IplImage *&dest)
 
static void convert (const cv::Mat &src, vpImage< vpRGBa > &dest, const bool flip=false)
 
static void convert (const cv::Mat &src, vpImage< unsigned char > &dest, const bool flip=false)
 
static void convert (const vpImage< vpRGBa > &src, cv::Mat &dest)
 
static void convert (const vpImage< unsigned char > &src, cv::Mat &dest, const bool copyData=true)
 
static void convert (const vpImage< unsigned char > &src, yarp::sig::ImageOf< yarp::sig::PixelMono > *dest, const bool copyData=true)
 
static void convert (const yarp::sig::ImageOf< yarp::sig::PixelMono > *src, vpImage< unsigned char > &dest, const bool copyData=true)
 
static void convert (const vpImage< vpRGBa > &src, yarp::sig::ImageOf< yarp::sig::PixelRgba > *dest, const bool copyData=true)
 
static void convert (const yarp::sig::ImageOf< yarp::sig::PixelRgba > *src, vpImage< vpRGBa > &dest, const bool copyData=true)
 
static void convert (const vpImage< vpRGBa > &src, yarp::sig::ImageOf< yarp::sig::PixelRgb > *dest)
 
static void convert (const yarp::sig::ImageOf< yarp::sig::PixelRgb > *src, vpImage< vpRGBa > &dest)
 
static void split (const vpImage< vpRGBa > &src, vpImage< unsigned char > *pR, vpImage< unsigned char > *pG, vpImage< unsigned char > *pB, vpImage< unsigned char > *pa=NULL)
 
static void merge (const vpImage< unsigned char > *R, const vpImage< unsigned char > *G, const vpImage< unsigned char > *B, const vpImage< unsigned char > *a, vpImage< vpRGBa > &RGBa)
 
static void YUVToRGB (unsigned char y, unsigned char u, unsigned char v, unsigned char &r, unsigned char &g, unsigned char &b)
 
static void YUYVToRGBa (unsigned char *yuyv, unsigned char *rgba, unsigned int width, unsigned int height)
 
static void YUYVToRGB (unsigned char *yuyv, unsigned char *rgb, unsigned int width, unsigned int height)
 
static void YUYVToGrey (unsigned char *yuyv, unsigned char *grey, unsigned int size)
 
static void YUV411ToRGBa (unsigned char *yuv, unsigned char *rgba, unsigned int size)
 
static void YUV411ToRGB (unsigned char *yuv, unsigned char *rgb, unsigned int size)
 
static void YUV411ToGrey (unsigned char *yuv, unsigned char *grey, unsigned int size)
 
static void YUV422ToRGBa (unsigned char *yuv, unsigned char *rgba, unsigned int size)
 
static void YUV422ToRGB (unsigned char *yuv, unsigned char *rgb, unsigned int size)
 
static void YUV422ToGrey (unsigned char *yuv, unsigned char *grey, unsigned int size)
 
static void YUV420ToRGBa (unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
 
static void YUV420ToRGB (unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
 
static void YUV420ToGrey (unsigned char *yuv, unsigned char *grey, unsigned int size)
 
static void YUV444ToRGBa (unsigned char *yuv, unsigned char *rgba, unsigned int size)
 
static void YUV444ToRGB (unsigned char *yuv, unsigned char *rgb, unsigned int size)
 
static void YUV444ToGrey (unsigned char *yuv, unsigned char *grey, unsigned int size)
 
static void YV12ToRGBa (unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
 
static void YV12ToRGB (unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
 
static void YVU9ToRGBa (unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
 
static void YVU9ToRGB (unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
 
static void RGBToRGBa (unsigned char *rgb, unsigned char *rgba, unsigned int size)
 
static void RGBaToRGB (unsigned char *rgba, unsigned char *rgb, unsigned int size)
 
static void RGBToGrey (unsigned char *rgb, unsigned char *grey, unsigned int size)
 
static void RGBaToGrey (unsigned char *rgba, unsigned char *grey, unsigned int size)
 
static void RGBToRGBa (unsigned char *bgr, unsigned char *rgba, unsigned int width, unsigned int height, bool flip=false)
 
static void RGBToGrey (unsigned char *bgr, unsigned char *grey, unsigned int width, unsigned int height, bool flip=false)
 
static void GreyToRGBa (unsigned char *grey, unsigned char *rgba, unsigned int size)
 
static void GreyToRGB (unsigned char *grey, unsigned char *rgb, unsigned int size)
 
static void BGRToRGBa (unsigned char *bgr, unsigned char *rgba, unsigned int width, unsigned int height, bool flip=false)
 
static void BGRToGrey (unsigned char *bgr, unsigned char *grey, unsigned int width, unsigned int height, bool flip=false)
 
static void YCbCrToRGB (unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
 
static void YCbCrToRGBa (unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
 
static void YCrCbToRGB (unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
 
static void YCrCbToRGBa (unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
 
static void YCbCrToGrey (unsigned char *ycbcr, unsigned char *grey, unsigned int size)
 
static void MONO16ToGrey (unsigned char *grey16, unsigned char *grey, unsigned int size)
 
static void MONO16ToRGBa (unsigned char *grey16, unsigned char *rgba, unsigned int size)
 
static void HSVToRGBa (const double *hue, const double *saturation, const double *value, unsigned char *rgba, const unsigned int size)
 
static void HSVToRGBa (const unsigned char *hue, const unsigned char *saturation, const unsigned char *value, unsigned char *rgba, const unsigned int size)
 
static void RGBaToHSV (const unsigned char *rgba, double *hue, double *saturation, double *value, const unsigned int size)
 
static void RGBaToHSV (const unsigned char *rgba, unsigned char *hue, unsigned char *saturation, unsigned char *value, const unsigned int size)
 
static void HSVToRGB (const double *hue, const double *saturation, const double *value, unsigned char *rgb, const unsigned int size)
 
static void HSVToRGB (const unsigned char *hue, const unsigned char *saturation, const unsigned char *value, unsigned char *rgb, const unsigned int size)
 
static void RGBToHSV (const unsigned char *rgb, double *hue, double *saturation, double *value, const unsigned int size)
 
static void RGBToHSV (const unsigned char *rgb, unsigned char *hue, unsigned char *saturation, unsigned char *value, const unsigned int size)
 

Detailed Description

Convert image types.

The following example available in tutorial-image-converter.cpp shows how to convert an OpenCV cv::Mat image into a vpImage:

#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
try {
cv::Mat A;
#if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
A = cv::imread("monkey.bmp", cv::IMREAD_GRAYSCALE);
#else
A = cv::imread("monkey.bmp", CV_LOAD_IMAGE_GRAYSCALE);
#endif
# ifdef VISP_HAVE_PNG
vpImageIo::write(I, "monkey.png"); // Gray
# endif
}
catch(vpException e) {
std::cout << "Catch an exception: " << e << std::endl;
}
#endif
}

Definition at line 94 of file vpImageConvert.h.

Member Function Documentation

void vpImageConvert::BGRToGrey ( unsigned char *  bgr,
unsigned char *  grey,
unsigned int  width,
unsigned int  height,
bool  flip = false 
)
static

Converts a BGR image to greyscale Flips the image verticaly if needed assumes that grey is already resized

Definition at line 2924 of file vpImageConvert.cpp.

Referenced by vpV4l2Grabber::acquire(), and convert().

void vpImageConvert::BGRToRGBa ( unsigned char *  bgr,
unsigned char *  rgba,
unsigned int  width,
unsigned int  height,
bool  flip = false 
)
static

Converts a BGR image to RGBa Flips the image verticaly if needed assumes that rgba is already resized

Definition at line 2886 of file vpImageConvert.cpp.

Referenced by vpV4l2Grabber::acquire().

void vpImageConvert::convert ( const vpImage< unsigned char > &  src,
vpImage< vpRGBa > &  dest 
)
static

Convert a vpImage<vpRGBa> to a vpImage<unsigned char>

Parameters
src: source image
dest: destination image
Examples:
AROgre.cpp, AROgreBasic.cpp, grabOpenCV-2.cpp, HelloWorldOgre.cpp, HelloWorldOgreAdvanced.cpp, servoPioneerPoint2DDepth.cpp, servoPioneerPoint2DDepthWithoutVpServo.cpp, servoViper850FourPointsKinect.cpp, testConversion.cpp, testKeyPoint-3.cpp, testKeyPoint-4.cpp, trackKltOpencv.cpp, tutorial-barcode-detector-live.cpp, tutorial-blob-tracker-live-firewire.cpp, tutorial-blob-tracker-live-v4l2.cpp, tutorial-bridge-opencv.cpp, tutorial-face-detector-live.cpp, tutorial-grabber-opencv-bis.cpp, tutorial-ibvs-4pts-ogre-tracking.cpp, tutorial-image-converter.cpp, tutorial-image-filter.cpp, tutorial-klt-tracker-live-v4l2.cpp, tutorial-klt-tracker-with-reinit.cpp, tutorial-klt-tracker.cpp, tutorial-me-ellipse-tracker.cpp, tutorial-me-line-tracker.cpp, tutorial-pose-from-points-tracking.cpp, and tutorial-video-recorder.cpp.

Definition at line 65 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), GreyToRGBa(), and vpImage< Type >::resize().

Referenced by vpVideoReader::acquire(), vpKeyPointSurf::buildReference(), vpImageFilter::canny(), vpDetectorFace::detect(), vpKeyPoint::detect(), vpKeyPoint::detectExtractAffine(), vpDisplayOpenCV::displayImage(), vpDisplayOpenCV::displayImageROI(), vpKeyPoint::extract(), vpVideoReader::getFrame(), vpImageFilter::getGaussPyramidal(), vpDisplayOpenCV::getImage(), vpDisplay::getImage(), vpImageSimulator::init(), vpMbEdgeTracker::initPyramid(), vpKeyPointSurf::matchPoint(), vpMbKltTracker::preTracking(), vpImageIo::read(), vpImageIo::readJPEG(), vpImageIo::readPGM(), vpImageIo::readPNG(), vpImageIo::readPPM(), vpMbKltTracker::reinit(), vpVideoWriter::saveFrame(), vpMeNurbs::seekExtremitiesCanny(), vpFernClassifier::setImage(), vpMbKltTracker::setPose(), vpImageIo::write(), vpImageIo::writePGM(), and vpImageIo::writePPM().

void vpImageConvert::convert ( const vpImage< vpRGBa > &  src,
vpImage< unsigned char > &  dest 
)
static

Convert a vpImage<unsigned char> to a vpImage<vpRGBa>

Parameters
src: source image
dest: destination image

Definition at line 79 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpImage< Type >::resize(), and RGBaToGrey().

void vpImageConvert::convert ( const vpImage< float > &  src,
vpImage< unsigned char > &  dest 
)
static

Convert a vpImage<float> to a vpImage<unsigend char> by renormalizing between 0 and 255.

Parameters
src: source image
dest: destination image

Definition at line 94 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getMinMaxValue(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().

void vpImageConvert::convert ( const vpImage< unsigned char > &  src,
vpImage< float > &  dest 
)
static

Convert a vpImage<unsigned char> to a vpImage<float> by basic casting.

Parameters
src: source image
dest: destination image

Definition at line 119 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().

void vpImageConvert::convert ( const vpImage< double > &  src,
vpImage< unsigned char > &  dest 
)
static

Convert a vpImage<double> to a vpImage<unsigend char> by renormalizing between 0 and 255.

Parameters
src: source image
dest: destination image

Definition at line 132 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getMinMaxValue(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().

void vpImageConvert::convert ( const vpImage< unsigned char > &  src,
vpImage< double > &  dest 
)
static

Convert a vpImage<unsigned char> to a vpImage<double> by basic casting.

Parameters
src: source image
dest: destination image

Definition at line 157 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().

void vpImageConvert::convert ( const IplImage *  src,
vpImage< vpRGBa > &  dest,
bool  flip = false 
)
static
Deprecated:
Rather then using OpenCV IplImage you should use cv::Mat images. IplImage structure will be removed with OpenCV transcient from C to C++ api.

Convert an IplImage to a vpImage<vpRGBa>.

An IplImage is an OpenCV (Intel's Open source Computer Vision Library) image structure. See http://opencvlibrary.sourceforge.net/ for general OpenCV documentation, or http://opencvlibrary.sourceforge.net/CxCore for the specific IplImage structure documentation.

Warning
This function is only available if OpenCV was detected during the configuration step.
Parameters
src: Source image in OpenCV format.
dest: Destination image in ViSP format.
flip: Set to true to vertically flip the converted image.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION < 0x020408)
vpImage<vpRGBa> Ic; // A color image
IplImage* Ip;
// Read an image on a disk with openCV library
Ip = cvLoadImage("image.ppm", CV_LOAD_IMAGE_COLOR);
// Convert the grayscale IplImage into vpImage<vpRGBa>
// ...
// Release Ip header and data
cvReleaseImage(&Ip);
#endif
}

Definition at line 210 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, and vpImage< Type >::resize().

void vpImageConvert::convert ( const IplImage *  src,
vpImage< unsigned char > &  dest,
bool  flip = false 
)
static
Deprecated:
Rather then using OpenCV IplImage you should use cv::Mat images. IplImage structure will be removed with OpenCV transcient from C to C++ api.

Convert an IplImage to a vpImage<unsigned char>.

An IplImage is an OpenCV (Intel's Open source Computer Vision Library) image structure. See http://opencvlibrary.sourceforge.net/ for general OpenCV documentation, or http://opencvlibrary.sourceforge.net/CxCore for the specific IplImage structure documentation.

Warning
This function is only available if OpenCV was detected during the configuration step.
Parameters
src: Source image in OpenCV format.
dest: Destination image in ViSP format.
flip: Set to true to vertically flip the converted image.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION < 0x020408)
vpImage<unsigned char> Ig; // A grayscale image
IplImage* Ip;
// Read an image on a disk with openCV library
Ip = cvLoadImage("image.pgm", CV_LOAD_IMAGE_GRAYSCALE);
// Convert the grayscale IplImage into vpImage<unsigned char>
// ...
// Release Ip header and data
cvReleaseImage(&Ip);
#endif
}

Definition at line 316 of file vpImageConvert.cpp.

References BGRToGrey(), vpImage< Type >::bitmap, and vpImage< Type >::resize().

void vpImageConvert::convert ( const vpImage< vpRGBa > &  src,
IplImage *&  dest 
)
static
Deprecated:
Rather then using OpenCV IplImage you should use cv::Mat images. IplImage structure will be removed with OpenCV transcient from C to C++ api.

Convert a vpImage<vpRGBa> to a IplImage.

An IplImage is an OpenCV (Intel's Open source Computer Vision Library) image structure. See http://opencvlibrary.sourceforge.net/ for general OpenCV documentation, or http://opencvlibrary.sourceforge.net/CxCore for the specific IplImage structure documentation.

Warning
This function is only available if OpenCV was detected during the configuration step.
Parameters
src: source image
dest: destination image
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION < 0x020408)
vpImage<vpRGBa> Ic; // A color image
IplImage* Ip = NULL;
// Read an image on a disk
vpImageIo::read(Ic, "image.ppm");
// Convert the vpImage<vpRGBa> in to color IplImage
// Treatments on IplImage
//...
// Save the IplImage on the disk
cvSaveImage("Ipl.ppm", Ip);
//Release Ip header and data
cvReleaseImage(&Ip);
#endif
}

Definition at line 420 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

void vpImageConvert::convert ( const vpImage< unsigned char > &  src,
IplImage *&  dest 
)
static
Deprecated:
Rather then using OpenCV IplImage you should use cv::Mat images. IplImage structure will be removed with OpenCV transcient from C to C++ api.

Convert a vpImage<unsigned char> to a IplImage.

An IplImage is an OpenCV (Intel's Open source Computer Vision Library) image structure. See http://opencvlibrary.sourceforge.net/ for general OpenCV documentation, or http://opencvlibrary.sourceforge.net/CxCore for the specific IplImage structure documentation.

Warning
This function is only available if OpenCV was detected during the configuration step.
Parameters
src: source image
dest: destination image
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION < 0x020408)
vpImage<unsigned char> Ig; // A greyscale image
IplImage* Ip = NULL;
// Read an image on a disk
vpImageIo::read(Ig, "image.pgm");
// Convert the vpImage<unsigned char> in to greyscale IplImage
// Treatments on IplImage Ip
//...
// Save the IplImage on the disk
cvSaveImage("Ipl.pgm", Ip);
//Release Ip header and data
cvReleaseImage(&Ip);
#endif
}

Definition at line 508 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

void vpImageConvert::convert ( const cv::Mat &  src,
vpImage< vpRGBa > &  dest,
const bool  flip = false 
)
static

Convert a cv::Mat to a vpImage<vpRGBa>.

A cv::Mat is an OpenCV image class. See http://opencv.willowgarage.com for the general OpenCV documentation, or http://opencv.willowgarage.com/documentation/cpp/core_basic_structures.html for the specific Mat structure documentation.

Similarily to the convert(const IplImage* src, vpImage<vpRGBa> & dest, bool flip) method, only Mat with a depth equal to 8 and a channel between 1 and 3 are converted.

Warning
This function is only available if OpenCV (version 2.1.0 or greater) was detected during the configuration step.
Parameters
src: Source image in OpenCV format.
dest: Destination image in ViSP format.
flip: Set to true to vertically flip the converted image.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
#include <visp3/core/vpRGBa.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
vpImage<vpRGBa> Ic; // A color image
cv::Mat Ip;
// Read an image on a disk with openCV library
Ip = cv::imread("image.pgm", 1);// second parameter > 0 for a RGB encoding.
// Convert the grayscale cv::Mat into vpImage<vpRGBa>
// ...
#endif
}

Definition at line 582 of file vpImageConvert.cpp.

References vpRGBa::A, vpRGBa::B, vpRGBa::G, vpImage< Type >::getCols(), vpImage< Type >::getRows(), vpRGBa::R, and vpImage< Type >::resize().

void vpImageConvert::convert ( const cv::Mat &  src,
vpImage< unsigned char > &  dest,
const bool  flip = false 
)
static

Convert a cv::Mat to a vpImage<unsigned char>.

A cv::Mat is an OpenCV image class. See http://opencv.willowgarage.com for the general OpenCV documentation, or http://opencv.willowgarage.com/documentation/cpp/core_basic_structures.html for the specific Mat structure documentation.

Similarily to the convert(const IplImage* src, vpImage<vpRGBa> & dest, bool flip) method, only Mat with a depth equal to 8 and a channel between 1 and 3 are converted.

Warning
This function is only available if OpenCV was detected during the configuration step.
Parameters
src: Source image in OpenCV format.
dest: Destination image in ViSP format.
flip: Set to true to vertically flip the converted image.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
vpImage<unsigned char> Ig; // A grayscale image
cv::Mat Ip;
// Read an image on a disk with openCV library
Ip = cv::imread("image.pgm", 0);// second parameter = 0 for a gray level.
// Convert the grayscale cv::Mat into vpImage<unsigned char>
// ...
#endif
}

Definition at line 675 of file vpImageConvert.cpp.

References BGRToGrey(), vpImage< Type >::bitmap, vpImage< Type >::getCols(), vpImage< Type >::getRows(), and vpImage< Type >::resize().

void vpImageConvert::convert ( const vpImage< vpRGBa > &  src,
cv::Mat &  dest 
)
static

Convert a vpImage<unsigned char> to a cv::Mat.

A cv::Mat is an OpenCV image class. See http://opencv.willowgarage.com for the general OpenCV documentation, or http://opencv.willowgarage.com/documentation/cpp/core_basic_structures.html for the specific Mat structure documentation.

Warning
This function is only available if OpenCV version 2.1.0 or greater was detected during the configuration step.
Parameters
src: source image (vpRGBa format)
dest: destination image (BGR format)
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
vpImage<unsigned char> Ig; // A greyscale image
cv::Mat Ip;
// Read an image on a disk
vpImageIo::read(Ig, "image.pgm");
// Convert the vpImage<unsigned char> in to color cv::Mat.
// Treatments on cv::Mat Ip
//...
// Save the cv::Mat on the disk
cv::imwrite("image.pgm", Ip);
#endif
}

Definition at line 757 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getCols(), and vpImage< Type >::getRows().

void vpImageConvert::convert ( const vpImage< unsigned char > &  src,
cv::Mat &  dest,
const bool  copyData = true 
)
static

Convert a vpImage<unsigned char> to a cv::Mat.

A cv::Mat is an OpenCV image class. See http://opencv.willowgarage.com for the general OpenCV documentation, or http://opencv.willowgarage.com/documentation/cpp/core_basic_structures.html for the specific Mat structure documentation.

Warning
This function is only available if OpenCV version 2.1.0 or greater was detected during the configuration step.
Parameters
src: source image
dest: destination image
copyData: if true, the image is copied and modification in one object will not modified the other.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
vpImage<unsigned char> Ig; // A greyscale image
cv::Mat Ip;
// Read an image on a disk
vpImageIo::read(Ig, "image.pgm");
// Convert the vpImage<unsigned char> in to greyscale cv::Mat
// Treatments on cv::Mat Ip
//...
// Save the cv::Mat on the disk
cv::imwrite("image-cv.pgm", Ip);
#endif
}

Definition at line 811 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getCols(), and vpImage< Type >::getRows().

void vpImageConvert::convert ( const vpImage< unsigned char > &  src,
yarp::sig::ImageOf< yarp::sig::PixelMono > *  dest,
const bool  copyData = true 
)
static

Convert a vpImage<unsigned char> to a yarp::sig::ImageOf<yarp::sig::PixelMono>

A yarp::sig::Image is a YARP image class. See http://eris.liralab.it/yarpdoc/df/d15/classyarp_1_1sig_1_1Image.html for the YARP image class documentation.

Parameters
src: Source image in ViSP format.
dest: Destination image in YARP format.
copyData: Set to true to copy all the image content. If false we only update the image pointer.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
#if defined(VISP_HAVE_YARP)
vpImage<unsigned char> I; // A mocochrome image
// Read an image on a disk
vpImageIo::read(I, "image.pgm");
yarp::sig::ImageOf< yarp::sig::PixelMono > *Iyarp = new yarp::sig::ImageOf< yarp::sig::PixelMono >();
// Convert the vpImage<unsigned char> to a yarp::sig::ImageOf<yarp::sig::PixelMono>
// ...
#endif
}

Definition at line 857 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getCols(), vpImage< Type >::getHeight(), vpImage< Type >::getRows(), and vpImage< Type >::getWidth().

void vpImageConvert::convert ( const yarp::sig::ImageOf< yarp::sig::PixelMono > *  src,
vpImage< unsigned char > &  dest,
const bool  copyData = true 
)
static

Convert a yarp::sig::ImageOf<yarp::sig::PixelMono> to a vpImage<unsigned char>

A yarp::sig::Image is a YARP image class. See http://eris.liralab.it/yarpdoc/df/d15/classyarp_1_1sig_1_1Image.html for the YARP image class documentation.

Parameters
src: Source image in YARP format.
dest: Destination image in ViSP format.
copyData: Set to true to copy all the image content. If false we only update the image pointer.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
#if defined(VISP_HAVE_YARP)
#include <yarp/sig/ImageFile.h>
#endif
int main()
{
#if defined(VISP_HAVE_YARP)
yarp::sig::ImageOf< yarp::sig::PixelMono > *Iyarp = new yarp::sig::ImageOf< yarp::sig::PixelMono >();
// Read an image on a disk
yarp::sig::file::read(*Iyarp, "image.pgm");
// Convert the yarp::sig::ImageOf<yarp::sig::PixelMono> to a vpImage<unsigned char>
// ...
#endif
}

Definition at line 905 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, and vpImage< Type >::resize().

void vpImageConvert::convert ( const vpImage< vpRGBa > &  src,
yarp::sig::ImageOf< yarp::sig::PixelRgba > *  dest,
const bool  copyData = true 
)
static

Convert a vpImage<vpRGBa> to a yarp::sig::ImageOf<yarp::sig::PixelRgba>

A yarp::sig::Image is a YARP image class. See http://eris.liralab.it/yarpdoc/df/d15/classyarp_1_1sig_1_1Image.html for the YARP image class documentation.

Parameters
src: Source image in ViSP format.
dest: Destination image in YARP format.
copyData: Set to true to copy all the image content. If false we only update the image pointer.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
#include <visp3/core/vpRGBa.h>
int main()
{
#if defined(VISP_HAVE_YARP)
vpImage<vpRGBa> I; // A color image
// Read an image on a disk
vpImageIo::read(I,"image.jpg");
yarp::sig::ImageOf< yarp::sig::PixelRgba > *Iyarp = new yarp::sig::ImageOf< yarp::sig::PixelRgba >();
// Convert the vpImage<vpRGBa> to a yarp::sig::ImageOf<yarp::sig::PixelRgba>
// ...
#endif
}

Definition at line 948 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getCols(), vpImage< Type >::getHeight(), vpImage< Type >::getRows(), and vpImage< Type >::getWidth().

void vpImageConvert::convert ( const yarp::sig::ImageOf< yarp::sig::PixelRgba > *  src,
vpImage< vpRGBa > &  dest,
const bool  copyData = true 
)
static

Convert a yarp::sig::ImageOf<yarp::sig::PixelRgba> to a vpImage<vpRGBa>

A yarp::sig::Image is a YARP image class. See http://eris.liralab.it/yarpdoc/df/d15/classyarp_1_1sig_1_1Image.html for the YARP image class documentation.

Parameters
src: Source image in YARP format.
dest: Destination image in ViSP format.
copyData: Set to true to copy all the image content. If false we only update the image pointer.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
#include <visp3/core/vpRGBa.h>
#if defined(VISP_HAVE_YARP)
#include <yarp/sig/ImageFile.h>
#endif
int main()
{
#if defined(VISP_HAVE_YARP)
yarp::sig::ImageOf< yarp::sig::PixelRgba > *Iyarp = new yarp::sig::ImageOf< yarp::sig::PixelRgba >();
// Read an image on a disk
yarp::sig::file::read(*Iyarp,"image.pgm");
// Convert the yarp::sig::ImageOf<yarp::sig::PixelRgba> to a vpImage<vpRGBa>
// ...
#endif
}

Definition at line 996 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, and vpImage< Type >::resize().

void vpImageConvert::convert ( const vpImage< vpRGBa > &  src,
yarp::sig::ImageOf< yarp::sig::PixelRgb > *  dest 
)
static

Convert a vpImage<vpRGBa> to a yarp::sig::ImageOf<yarp::sig::PixelRgb>

A yarp::sig::Image is a YARP image class. See http://eris.liralab.it/yarpdoc/df/d15/classyarp_1_1sig_1_1Image.html for the YARP image class documentation.

Parameters
src: Source image in ViSP format.
dest: Destination image in YARP format.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
#include <visp3/core/vpRGBa.h>
int main()
{
#if defined(VISP_HAVE_YARP)
vpImage<vpRGBa> I; // A color image
// Read an image on a disk
vpImageIo::read(I,"image.jpg");
yarp::sig::ImageOf< yarp::sig::PixelRgb > *Iyarp = new yarp::sig::ImageOf< yarp::sig::PixelRgb >();
// Convert the vpImage<vpRGBa> to a yarp::sig::ImageOf<yarp::sig::PixelRgb>
// ...
#endif
}

Definition at line 1038 of file vpImageConvert.cpp.

References vpImage< Type >::getHeight(), vpImage< Type >::getRows(), and vpImage< Type >::getWidth().

void vpImageConvert::convert ( const yarp::sig::ImageOf< yarp::sig::PixelRgb > *  src,
vpImage< vpRGBa > &  dest 
)
static

Convert a yarp::sig::ImageOf<yarp::sig::PixelRgb> to a vpImage<vpRGBa>

A yarp::sig::Image is a YARP image class. See http://eris.liralab.it/yarpdoc/df/d15/classyarp_1_1sig_1_1Image.html for the YARP image class documentation.

Parameters
src: Source image in YARP format.
dest: Destination image in ViSP format.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
#include <visp3/core/vpRGBa.h>
#if defined(VISP_HAVE_YARP)
#include <yarp/sig/ImageFile.h>
#endif
int main()
{
#if defined(VISP_HAVE_YARP)
yarp::sig::ImageOf< yarp::sig::PixelRgb > *Iyarp = new yarp::sig::ImageOf< yarp::sig::PixelRgb >();
// Read an image on a disk
yarp::sig::file::read(*Iyarp,"image.pgm");
// Convert the yarp::sig::ImageOf<yarp::sig::PixelRgb> to a vpImage<vpRGBa>
// ...
#endif
}

Definition at line 1086 of file vpImageConvert.cpp.

References vpImage< Type >::resize().

void vpImageConvert::GreyToRGB ( unsigned char *  grey,
unsigned char *  rgb,
unsigned int  size 
)
static

Convert from grey to linear RGBa.

Definition at line 2862 of file vpImageConvert.cpp.

void vpImageConvert::GreyToRGBa ( unsigned char *  grey,
unsigned char *  rgba,
unsigned int  size 
)
static

Convert from grey to linear RGBa.

Definition at line 2839 of file vpImageConvert.cpp.

Referenced by vp1394CMUGrabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::acquire(), convert(), and vp1394TwoGrabber::dequeue().

void vpImageConvert::HSVToRGB ( const double *  hue,
const double *  saturation,
const double *  value,
unsigned char *  rgb,
const unsigned int  size 
)
static

Converts an array of hue, saturation and value to an array of RGB values.

Parameters
hue: Array of hue values (range between [0 - 1]).
saturation: Array of saturation values (range between [0 - 1]).
value: Array of value values (range between [0 - 1]).
rgb: RGB array values converted from RGB color space.
size: The total image size or the number of pixels.

Definition at line 3714 of file vpImageConvert.cpp.

Referenced by HSVToRGB().

void vpImageConvert::HSVToRGB ( const unsigned char *  hue,
const unsigned char *  saturation,
const unsigned char *  value,
unsigned char *  rgb,
const unsigned int  size 
)
static

Converts an array of hue, saturation and value to an array of RGB values.

Parameters
hue: Array of hue values (range between [0 - 255]).
saturation: Array of saturation values (range between [0 - 255]).
value: Array of value values (range between [0 - 255]).
rgb: RGB array values converted from HSV color space.
size: The total image size or the number of pixels.

Definition at line 3728 of file vpImageConvert.cpp.

References HSVToRGB().

void vpImageConvert::HSVToRGBa ( const double *  hue,
const double *  saturation,
const double *  value,
unsigned char *  rgba,
const unsigned int  size 
)
static

Converts an array of hue, saturation and value to an array of RGBa values.

Parameters
hue: Array of hue values (range between [0 - 1]).
saturation: Array of saturation values (range between [0 - 1]).
value: Array of value values (range between [0 - 1]).
rgba: RGBa array values (with alpha channel set to zero) converted from HSV color space.
size: The total image size or the number of pixels.
Examples:
testConversion.cpp.

Definition at line 3645 of file vpImageConvert.cpp.

Referenced by HSVToRGBa().

void vpImageConvert::HSVToRGBa ( const unsigned char *  hue,
const unsigned char *  saturation,
const unsigned char *  value,
unsigned char *  rgba,
const unsigned int  size 
)
static

Converts an array of hue, saturation and value to an array of RGBa values.

Parameters
hue: Array of hue values (range between [0 - 255]).
saturation: Array of saturation values (range between [0 - 255]).
value: Array of value values (range between [0 - 255]).
rgba: RGBa array values (with alpha channel set to zero) converted from HSV color space.
size: The total image size or the number of pixels.

Definition at line 3659 of file vpImageConvert.cpp.

References HSVToRGBa().

void vpImageConvert::merge ( const vpImage< unsigned char > *  R,
const vpImage< unsigned char > *  G,
const vpImage< unsigned char > *  B,
const vpImage< unsigned char > *  a,
vpImage< vpRGBa > &  RGBa 
)
static

Merge 4 channels into an RGBa image.

Parameters
R: Red channel.
G: Green channel.
B: Blue channel.
a: Alpha channel.
RGBa: Destination RGBa image.
Examples:
testConversion.cpp.

Definition at line 3404 of file vpImageConvert.cpp.

References vpRGBa::A, vpRGBa::B, vpImage< Type >::bitmap, vpException::dimensionError, vpRGBa::G, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpRGBa::R, and vpImage< Type >::resize().

void vpImageConvert::MONO16ToGrey ( unsigned char *  grey16,
unsigned char *  grey,
unsigned int  size 
)
static

Converts a MONO16 grey scale image (each pixel is coded by two bytes) into a grey image where each pixels are coded on one byte.

Parameters
grey16: Input image to convert (two bytes per pixel).
grey: Output image (one byte per pixel)
size: The image size or the number of pixels.

Definition at line 3470 of file vpImageConvert.cpp.

Referenced by vp1394CMUGrabber::acquire(), and vp1394TwoGrabber::dequeue().

void vpImageConvert::MONO16ToRGBa ( unsigned char *  grey16,
unsigned char *  rgba,
unsigned int  size 
)
static

Converts a MONO16 grey scale image (each pixel is coded by two bytes) into a grey image where each pixels are coded on one byte.

Parameters
grey16: Input image to convert (two bytes per pixel).
rgba: Output image.
size: The image size or the number of pixels.

Definition at line 3492 of file vpImageConvert.cpp.

Referenced by vp1394CMUGrabber::acquire(), and vp1394TwoGrabber::dequeue().

void vpImageConvert::RGBaToGrey ( unsigned char *  rgba,
unsigned char *  grey,
unsigned int  size 
)
static

Weights convert from linear RGBa to CIE luminance assuming a modern monitor. See Charles Pontyon's Colour FAQ http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html

Definition at line 2819 of file vpImageConvert.cpp.

Referenced by vpV4l2Grabber::acquire(), and convert().

void vpImageConvert::RGBaToHSV ( const unsigned char *  rgba,
double *  hue,
double *  saturation,
double *  value,
const unsigned int  size 
)
static

Converts an array of RGBa to an array of hue, saturation, value values. The alpha channel is not used.

Parameters
rgba: RGBa array values.
hue: Array of hue values converted from RGB color space (range between [0 - 1]).
saturation: Array of saturation values converted from RGB color space (range between [0 - 1]).
value: Array of value values converted from RGB color space (range between [0 - 1]).
size: The total image size or the number of pixels.
Examples:
testConversion.cpp.

Definition at line 3678 of file vpImageConvert.cpp.

Referenced by RGBaToHSV().

void vpImageConvert::RGBaToHSV ( const unsigned char *  rgba,
unsigned char *  hue,
unsigned char *  saturation,
unsigned char *  value,
const unsigned int  size 
)
static

Converts an array of RGBa to an array of hue, saturation, value values. The alpha channel is not used.

Parameters
rgba: RGBa array values.
hue: Array of hue values converted from RGB color space (range between [0 - 255]).
saturation: Array of saturation values converted from RGB color space (range between [0 - 255]).
value: Array of value values converted from RGB color space (range between [0 - 255]).
size: The total image size or the number of pixels.

Definition at line 3693 of file vpImageConvert.cpp.

References RGBaToHSV().

void vpImageConvert::RGBaToRGB ( unsigned char *  rgba,
unsigned char *  rgb,
unsigned int  size 
)
static

Convert RGB into RGBa

Definition at line 2780 of file vpImageConvert.cpp.

void vpImageConvert::RGBToGrey ( unsigned char *  rgb,
unsigned char *  grey,
unsigned int  size 
)
static

Weights convert from linear RGB to CIE luminance assuming a modern monitor. See Charles Pontyon's Colour FAQ http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html

Definition at line 2799 of file vpImageConvert.cpp.

Referenced by vp1394CMUGrabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::dequeue(), and vpSimulator::getInternalImage().

void vpImageConvert::RGBToGrey ( unsigned char *  rgb,
unsigned char *  grey,
unsigned int  width,
unsigned int  height,
bool  flip = false 
)
static

Converts a RGB image to greyscale Flips the image verticaly if needed assumes that grey is already resized

Definition at line 2994 of file vpImageConvert.cpp.

void vpImageConvert::RGBToHSV ( const unsigned char *  rgb,
double *  hue,
double *  saturation,
double *  value,
const unsigned int  size 
)
static

Converts an array of RGB to an array of hue, saturation, value values.

Parameters
rgb: RGB array values.
hue: Array of hue values converted from RGB color space (range between [0 - 1]).
saturation: Array of saturation values converted from RGB color space (range between [0 - 1]).
value: Array of value values converted from RGB color space (range between [0 - 1]).
size: The total image size or the number of pixels.

Definition at line 3746 of file vpImageConvert.cpp.

Referenced by RGBToHSV().

void vpImageConvert::RGBToHSV ( const unsigned char *  rgb,
unsigned char *  hue,
unsigned char *  saturation,
unsigned char *  value,
const unsigned int  size 
)
static

Converts an array of RGB to an array of hue, saturation, value values.

Parameters
rgb: RGB array values.
hue: Array of hue values converted from RGB color space (range between [0 - 255]).
saturation: Array of saturation values converted from RGB color space (range between [0 - 255]).
value: Array of value values converted from RGB color space (range between [0 - 255]).
size: The total image size or the number of pixels.

Definition at line 3760 of file vpImageConvert.cpp.

References RGBToHSV().

void vpImageConvert::RGBToRGBa ( unsigned char *  rgb,
unsigned char *  rgba,
unsigned int  size 
)
static
void vpImageConvert::RGBToRGBa ( unsigned char *  rgb,
unsigned char *  rgba,
unsigned int  width,
unsigned int  height,
bool  flip = false 
)
static

Converts a RGB image to RGBa Flips the image verticaly if needed assumes that rgba is already resized

Definition at line 2959 of file vpImageConvert.cpp.

void vpImageConvert::split ( const vpImage< vpRGBa > &  src,
vpImage< unsigned char > *  pR,
vpImage< unsigned char > *  pG,
vpImage< unsigned char > *  pB,
vpImage< unsigned char > *  pa = NULL 
)
static

Split an image from vpRGBa format to monochrome channels.

Parameters
src: source image.
pR: red channel. Set as NULL if not needed.
pG: green channel. Set as NULL if not needed.
pB: blue channel. Set as NULL if not needed.
pa: alpha channel. Set as NULL if not needed.

Example code using split :

#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImageConvert.h>
int main()
{
vpImage<vpRGBa> Ic; // A color image
// Load a color image from the disk
vpImageIo::read(Ic,"image.ppm");
// Only R and B Channels are desired.
// Split Ic color image
// R and B will be resized in split function if needed
vpImageConvert::split(Ic, &R, NULL, &B, NULL);
// Save the the R Channel.
vpImageIo::write(R, "RChannel.pgm");
}
Examples:
testConversion.cpp.

Definition at line 3341 of file vpImageConvert.cpp.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getNumberOfPixel(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().

void vpImageConvert::YCbCrToGrey ( unsigned char *  yuv,
unsigned char *  grey,
unsigned int  size 
)
static

Convert an image from YCrCb 4:2:2 (Y0 Cr01 Y1 Cb01 Y2 Cr23 Y3 ...) to grey format. Destination grey image memory area has to be allocated before.

  • In YCrCb (4:2:2) format each pixel is coded using 16 bytes. Byte 0: YO (Luma for Pixel 0) Byte 1: Chroma Red Cr (Red Chroma for Pixel 0 and 1) Byte 2: Y1 (Luma for Pixel 1) Byte 3: Chroma blue Cb (Blue Chroma for Pixel 0 and 1) Byte 4: Y2 (Luma for Pixel 2)
  • In grey format, each pixel is coded using 8 bytes.

Definition at line 3182 of file vpImageConvert.cpp.

void vpImageConvert::YCbCrToRGB ( unsigned char *  ycbcr,
unsigned char *  rgb,
unsigned int  size 
)
static

Convert an image from YCbCr 4:2:2 (Y0 Cb01 Y1 Cr01 Y2 Cb23 Y3 ...) to RGB format. Destination rgb memory area has to be allocated before.

  • In YCbCr (4:2:2) format each pixel is coded using 16 bytes. Byte 0: YO (Luma for Pixel 0) Byte 1: Chroma Blue Cb (Blue Chroma for Pixel 0 and 1) Byte 2: Y1 (Luma for Pixel 1) Byte 3: Chroma Red Cr (Red Chroma for Pixel 0 and 1) Byte 4: Y2 (Luma for Pixel 2)
  • In RGB format, each pixel is coded using 24 bytes. Byte 0: Red Byte 1: Green Byte 2: Blue

Definition at line 3069 of file vpImageConvert.cpp.

References vpDEBUG_TRACE.

void vpImageConvert::YCbCrToRGBa ( unsigned char *  ycbcr,
unsigned char *  rgba,
unsigned int  size 
)
static

Convert an image from YCbCr 4:2:2 (Y0 Cb01 Y1 Cr01 Y2 Cb23 Y3...) to RGBa format. Destination rgba memory area has to be allocated before.

  • In YCbCr (4:2:2) format each pixel is coded using 16 bytes. Byte 0: YO (Luma for Pixel 0) Byte 1: Chroma Blue Cb (Blue Chroma for Pixel 0 and 1) Byte 2: Y1 (Luma for Pixel 1) Byte 3: Chroma Red Cr (Red Chroma for Pixel 0 and 1) Byte 4: Y2 (Luma for Pixel 2)
  • In RGBa format, each pixel is coded using 24 bytes. Byte 0: Red Byte 1: Green Byte 2: Blue Byte 3: -

Definition at line 3127 of file vpImageConvert.cpp.

References vpDEBUG_TRACE.

void vpImageConvert::YCrCbToRGB ( unsigned char *  ycrcb,
unsigned char *  rgb,
unsigned int  size 
)
static

Convert an image from YCrCb 4:2:2 (Y0 Cr01 Y1 Cb01 Y2 Cr23 Y3 ...) to RGB format. Destination rgb memory area has to be allocated before.

  • In YCrCb (4:2:2) format each pixel is coded using 16 bytes. Byte 0: YO (Luma for Pixel 0) Byte 1: Chroma Red Cr (Red Chroma for Pixel 0 and 1) Byte 2: Y1 (Luma for Pixel 1) Byte 3: Chroma blue Cb (Blue Chroma for Pixel 0 and 1) Byte 4: Y2 (Luma for Pixel 2)
  • In RGB format, each pixel is coded using 24 bytes. Byte 0: Red Byte 1: Green Byte 2: Blue

Definition at line 3212 of file vpImageConvert.cpp.

References vpDEBUG_TRACE.

void vpImageConvert::YCrCbToRGBa ( unsigned char *  ycrcb,
unsigned char *  rgba,
unsigned int  size 
)
static

Convert an image from YCrCb 4:2:2 (Y0 Cr01 Y1 Cb01 Y2 Cr23 Y3 ...) to RGBa format. Destination rgba memory area has to be allocated before.

  • In YCrCb (4:2:2) format each pixel is coded using 16 bytes. Byte 0: YO (Luma for Pixel 0) Byte 1: Chroma Red Cr (Red Chroma for Pixel 0 and 1) Byte 2: Y1 (Luma for Pixel 1) Byte 3: Chroma blue Cb (Blue Chroma for Pixel 0 and 1) Byte 4: Y2 (Luma for Pixel 2)
  • In RGBa format, each pixel is coded using 24 bytes. Byte 0: Red Byte 1: Green Byte 2: Blue Byte 3: -

Definition at line 3268 of file vpImageConvert.cpp.

References vpDEBUG_TRACE.

void vpImageConvert::YUV411ToGrey ( unsigned char *  yuv,
unsigned char *  grey,
unsigned int  size 
)
static

Convert YUV411 into Grey yuv411 : u y1 y2 v y3 y4

Definition at line 1444 of file vpImageConvert.cpp.

Referenced by vp1394CMUGrabber::acquire(), and vp1394TwoGrabber::dequeue().

void vpImageConvert::YUV411ToRGB ( unsigned char *  yuv,
unsigned char *  rgb,
unsigned int  size 
)
static

Convert YUV411 into RGB yuv411 : u y1 y2 v y3 y4

Definition at line 1565 of file vpImageConvert.cpp.

References YUVToRGB().

void vpImageConvert::YUV411ToRGBa ( unsigned char *  yuv,
unsigned char *  rgba,
unsigned int  size 
)
static

Convert YUV411 into RGB32 yuv411 : u y1 y2 v y3 y4

Definition at line 1237 of file vpImageConvert.cpp.

References YUVToRGB().

Referenced by vp1394CMUGrabber::acquire(), vp1394TwoGrabber::acquire(), and vp1394TwoGrabber::dequeue().

void vpImageConvert::YUV420ToGrey ( unsigned char *  yuv,
unsigned char *  grey,
unsigned int  size 
)
static

Convert YUV420 into Grey yuv420 : Y(NxM), U(N/2xM/2), V(N/2xM/2)

Definition at line 1886 of file vpImageConvert.cpp.

void vpImageConvert::YUV420ToRGB ( unsigned char *  yuv,
unsigned char *  rgb,
unsigned int  width,
unsigned int  height 
)
static

Convert YUV420 into RGB yuv420 : Y(NxM), U(N/2xM/2), V(N/2xM/2)

Definition at line 1788 of file vpImageConvert.cpp.

void vpImageConvert::YUV420ToRGBa ( unsigned char *  yuv,
unsigned char *  rgba,
unsigned int  width,
unsigned int  height 
)
static

Convert YUV420 into RGBa yuv420 : Y(NxM), U(N/2xM/2), V(N/2xM/2)

Definition at line 1688 of file vpImageConvert.cpp.

void vpImageConvert::YUV422ToGrey ( unsigned char *  yuv,
unsigned char *  grey,
unsigned int  size 
)
static

Convert YUV 4:2:2 (u01 y0 v01 y1 u23 y2 v23 y3 ...) images into Grey. Destination grey memory area has to be allocated before.

See also
YUYVToGrey()

Definition at line 1547 of file vpImageConvert.cpp.

Referenced by vp1394CMUGrabber::acquire(), and vp1394TwoGrabber::dequeue().

void vpImageConvert::YUV422ToRGB ( unsigned char *  yuv,
unsigned char *  rgb,
unsigned int  size 
)
static

Convert YUV 4:2:2 (u01 y0 v01 y1 u23 y2 v23 y3 ...) images into RGB images. Destination rgb memory area has to be allocated before.

See also
YUYVToRGB()

Definition at line 1469 of file vpImageConvert.cpp.

References YUVToRGB().

void vpImageConvert::YUV422ToRGBa ( unsigned char *  yuv,
unsigned char *  rgba,
unsigned int  size 
)
static

Convert YUV 4:2:2 (u01 y0 v01 y1 u23 y2 v23 y3 ...) images into RGB32 images. Destination rgba memory area has to be allocated before.

See also
YUYVToRGBa()

Definition at line 1364 of file vpImageConvert.cpp.

References YUVToRGB().

Referenced by vp1394CMUGrabber::acquire(), vp1394TwoGrabber::acquire(), and vp1394TwoGrabber::dequeue().

void vpImageConvert::YUV444ToGrey ( unsigned char *  yuv,
unsigned char *  grey,
unsigned int  size 
)
static

Convert YUV444 into Grey yuv444 : u y v

Definition at line 1978 of file vpImageConvert.cpp.

Referenced by vp1394CMUGrabber::acquire(), and vp1394TwoGrabber::dequeue().

void vpImageConvert::YUV444ToRGB ( unsigned char *  yuv,
unsigned char *  rgb,
unsigned int  size 
)
static

Convert YUV444 into RGB yuv444 : u y v

Definition at line 1939 of file vpImageConvert.cpp.

void vpImageConvert::YUV444ToRGBa ( unsigned char *  yuv,
unsigned char *  rgba,
unsigned int  size 
)
static

Convert YUV444 into RGBa yuv444 : u y v

Definition at line 1900 of file vpImageConvert.cpp.

Referenced by vp1394CMUGrabber::acquire(), vp1394TwoGrabber::acquire(), and vp1394TwoGrabber::dequeue().

static void vpImageConvert::YUVToRGB ( unsigned char  y,
unsigned char  u,
unsigned char  v,
unsigned char &  r,
unsigned char &  g,
unsigned char &  b 
)
inlinestatic

Converts a yuv pixel value in rgb format.

Parameters
yY component of a pixel.
uU component of a pixel.
vV component of a pixel.
rRed component from the YUV coding format. This value is computed using:

\[ r = 0.9999695*y - 0.0009508*(u-128) + 1.1359061*(v-128) \]

gGreen component from the YUV coding format. This value is computed using:

\[g = 0.9999695*y - 0.3959609*(u-128) - 0.5782955*(v-128) \]

bBlue component from the YUV coding format. This value is computed using:

\[b = 0.9999695*y + 2.04112*(u-128) - 0.0016314*(v-128) \]

Examples:
testConversion.cpp.

Definition at line 182 of file vpImageConvert.h.

Referenced by YUV411ToRGB(), YUV411ToRGBa(), YUV422ToRGB(), and YUV422ToRGBa().

void vpImageConvert::YUYVToGrey ( unsigned char *  yuyv,
unsigned char *  grey,
unsigned int  size 
)
static

Convert an image from YUYV 4:2:2 (y0 u01 y1 v01 y2 u23 y3 v23 ...) to grey. Destination rgb memory area has to be allocated before.

See also
YUV422ToGrey()

Definition at line 1218 of file vpImageConvert.cpp.

Referenced by vpV4l2Grabber::acquire().

void vpImageConvert::YUYVToRGB ( unsigned char *  yuyv,
unsigned char *  rgb,
unsigned int  width,
unsigned int  height 
)
static

Convert an image from YUYV 4:2:2 (y0 u01 y1 v01 y2 u23 y3 v23 ...) to RGB24. Destination rgb memory area has to be allocated before.

See also
YUV422ToRGB()

Definition at line 1165 of file vpImageConvert.cpp.

void vpImageConvert::YUYVToRGBa ( unsigned char *  yuyv,
unsigned char *  rgba,
unsigned int  width,
unsigned int  height 
)
static

Convert an image from YUYV 4:2:2 (y0 u01 y1 v01 y2 u23 y3 v23 ...) to RGB32. Destination rgba memory area has to be allocated before.

See also
YUV422ToRGBa()

Definition at line 1109 of file vpImageConvert.cpp.

Referenced by vpV4l2Grabber::acquire().

void vpImageConvert::YV12ToRGB ( unsigned char *  yuv,
unsigned char *  rgb,
unsigned int  height,
unsigned int  width 
)
static

Convert YV12 into RGB yuv420 : Y(NxM), V(N/2xM/2), U(N/2xM/2)

Definition at line 2094 of file vpImageConvert.cpp.

void vpImageConvert::YV12ToRGBa ( unsigned char *  yuv,
unsigned char *  rgba,
unsigned int  width,
unsigned int  height 
)
static

Convert YV12 into RGBa yuv420 : Y(NxM), V(N/2xM/2), U(N/2xM/2)

Definition at line 1994 of file vpImageConvert.cpp.

void vpImageConvert::YVU9ToRGB ( unsigned char *  yuv,
unsigned char *  rgb,
unsigned int  height,
unsigned int  width 
)
static

Convert YV12 into RGB yuv420 : Y(NxM), V(N/4xM/4), U(N/4xM/4)

Definition at line 2484 of file vpImageConvert.cpp.

void vpImageConvert::YVU9ToRGBa ( unsigned char *  yuv,
unsigned char *  rgba,
unsigned int  width,
unsigned int  height 
)
static

Convert YVU9 into RGBa yuv420 : Y(NxM), V(N/4xM/4), U(N/4xM/4)

Definition at line 2191 of file vpImageConvert.cpp.