JeVois  1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:

Jpeg classes and functions, mainly used to support sending MJPEG video output over USB from raw uncompressed images captured by a camera.

Collaboration diagram for Jpeg-related classes and functions:

Classes

class  jevois::JpegCompressor
 Simple singleton wrapper over a turbojpeg compressor. More...
 

Functions

void jevois::convertYUYVtoYUV422 (unsigned char const *src, int width, int height, unsigned char *dst)
 Helper to convert from packed YUYV to planar YUV422. More...
 
unsigned long jevois::compressBGRtoJpeg (unsigned char const *src, int width, int height, unsigned char *dst, int quality=75)
 Compress raw pixel buffer to jpeg. More...
 
void jevois::compressBGRtoJpeg (cv::Mat const &src, RawImage &dst, int quality=75)
 Compress a BGR cv::Mat into an output JPEG jevois::RawImage. More...
 
unsigned long jevois::compressRGBtoJpeg (unsigned char const *src, int width, int height, unsigned char *dst, int quality=75)
 Compress raw pixel buffer to jpeg. More...
 
void jevois::compressRGBtoJpeg (cv::Mat const &src, RawImage &dst, int quality=75)
 Compress a RGB cv::Mat into an output JPEG jevois::RawImage. More...
 
unsigned long jevois::compressRGBAtoJpeg (unsigned char const *src, int width, int height, unsigned char *dst, int quality=75)
 Compress raw pixel buffer to jpeg. More...
 
void jevois::compressRGBAtoJpeg (cv::Mat const &src, RawImage &dst, int quality=75)
 Compress an RGBA cv::Mat into an output JPEG jevois::RawImage. More...
 
unsigned long jevois::compressGRAYtoJpeg (unsigned char const *src, int width, int height, unsigned char *dst, int quality=75)
 Compress raw pixel buffer to jpeg. More...
 
void jevois::compressGRAYtoJpeg (cv::Mat const &src, RawImage &dst, int quality=75)
 Compress a Gray cv::Mat into an output JPEG jevois::RawImage. More...
 

Function Documentation

◆ compressBGRtoJpeg() [1/2]

void jevois::compressBGRtoJpeg ( cv::Mat const &  src,
RawImage dst,
int  quality = 75 
)

Compress a BGR cv::Mat into an output JPEG jevois::RawImage.

The dst RawImage should have an allocated buffer, typically this is intended for use with a RawImage that was obtained from the UVC gadget.

Definition at line 108 of file Jpeg.C.

References jevois::RawImage::buf, jevois::compressBGRtoJpeg(), and jevois::RawImage::pixelsw().

◆ compressBGRtoJpeg() [2/2]

unsigned long jevois::compressBGRtoJpeg ( unsigned char const *  src,
int  width,
int  height,
unsigned char *  dst,
int  quality = 75 
)

Compress raw pixel buffer to jpeg.

The compressed size is returned. The dst buffer should have been allocated by caller, with size at least width * height * 2 bytes. quality should be between 1 (worst) and 100 (best).

Definition at line 52 of file Jpeg.C.

References jevois::JpegCompressor::compressor(), and jevois::Singleton< JpegCompressor >::instance().

Referenced by jevois::compressBGRtoJpeg(), and jevois::rawimage::convertCvBGRtoRawImage().

◆ compressGRAYtoJpeg() [1/2]

void jevois::compressGRAYtoJpeg ( cv::Mat const &  src,
RawImage dst,
int  quality = 75 
)

Compress a Gray cv::Mat into an output JPEG jevois::RawImage.

The dst RawImage should have an allocated buffer, typically this is intended for use with a RawImage that was obtained from the UVC gadget.

Definition at line 126 of file Jpeg.C.

References jevois::RawImage::buf, jevois::compressGRAYtoJpeg(), and jevois::RawImage::pixelsw().

◆ compressGRAYtoJpeg() [2/2]

unsigned long jevois::compressGRAYtoJpeg ( unsigned char const *  src,
int  width,
int  height,
unsigned char *  dst,
int  quality = 75 
)

Compress raw pixel buffer to jpeg.

The compressed size is returned. The dst buffer should have been allocated by caller, with size at least width * height * 2 bytes. quality should be between 1 (worst) and 100 (best).

Definition at line 94 of file Jpeg.C.

References jevois::JpegCompressor::compressor(), and jevois::Singleton< JpegCompressor >::instance().

Referenced by jevois::compressGRAYtoJpeg(), and jevois::rawimage::convertCvGRAYtoRawImage().

◆ compressRGBAtoJpeg() [1/2]

void jevois::compressRGBAtoJpeg ( cv::Mat const &  src,
RawImage dst,
int  quality = 75 
)

Compress an RGBA cv::Mat into an output JPEG jevois::RawImage.

The dst RawImage should have an allocated buffer, typically this is intended for use with a RawImage that was obtained from the UVC gadget.

Definition at line 120 of file Jpeg.C.

References jevois::RawImage::buf, jevois::compressRGBAtoJpeg(), and jevois::RawImage::pixelsw().

◆ compressRGBAtoJpeg() [2/2]

unsigned long jevois::compressRGBAtoJpeg ( unsigned char const *  src,
int  width,
int  height,
unsigned char *  dst,
int  quality = 75 
)

Compress raw pixel buffer to jpeg.

The compressed size is returned. The dst buffer should have been allocated by caller, with size at least width * height * 2 bytes. quality should be between 1 (worst) and 100 (best).

Definition at line 80 of file Jpeg.C.

References jevois::JpegCompressor::compressor(), and jevois::Singleton< JpegCompressor >::instance().

Referenced by jevois::compressRGBAtoJpeg(), and jevois::rawimage::convertCvRGBAtoRawImage().

◆ compressRGBtoJpeg() [1/2]

void jevois::compressRGBtoJpeg ( cv::Mat const &  src,
RawImage dst,
int  quality = 75 
)

Compress a RGB cv::Mat into an output JPEG jevois::RawImage.

The dst RawImage should have an allocated buffer, typically this is intended for use with a RawImage that was obtained from the UVC gadget.

Definition at line 114 of file Jpeg.C.

References jevois::RawImage::buf, jevois::compressRGBtoJpeg(), and jevois::RawImage::pixelsw().

◆ compressRGBtoJpeg() [2/2]

unsigned long jevois::compressRGBtoJpeg ( unsigned char const *  src,
int  width,
int  height,
unsigned char *  dst,
int  quality = 75 
)

Compress raw pixel buffer to jpeg.

The compressed size is returned. The dst buffer should have been allocated by caller, with size at least width * height * 2 bytes. quality should be between 1 (worst) and 100 (best).

Definition at line 66 of file Jpeg.C.

References jevois::JpegCompressor::compressor(), and jevois::Singleton< JpegCompressor >::instance().

Referenced by jevois::compressRGBtoJpeg(), and jevois::rawimage::convertCvRGBtoRawImage().

◆ convertYUYVtoYUV422()

void jevois::convertYUYVtoYUV422 ( unsigned char const *  src,
int  width,
int  height,
unsigned char *  dst 
)

Helper to convert from packed YUYV to planar YUV422.

Memory must have been allocated by caller.

Definition at line 35 of file Jpeg.C.