JeVois  1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Minimalistic support for images in the core JeVois library

The main purpose of the classes and functions that support images is to allow handling of image buffers whose memory is mapped onto hardware (camera or USB drivers) without having to copy the data over. Many other libraries and frameworks are available that define more complete image classes and associated image processing and machine vision functions. Functions are here provided to allow you to reinterpret the raw image buffers as, e.g., OpenCV cv::Mat images without copying the image pixel data. For the purposes of creating demo displays, simple image copy, paste, drawing, text, etc into raw YUYV image buffers (which would typically be obtained from the USB driver and need to be filled with some pixel data to send over the USB link) are also provided.

The class that represents an image with a pixel buffer that the camera or USB hardware has direct memory access to (see VideoBuf) is called RawImage. To avoid defining pixel types yet again, as most image-related libraries already do, in RawImage we just use the definitions provided by Video4Linux2.

The functions that operate on RawImage are thus mostly intented for two purposes: 1) get pixel data out of RawImage and into another format like OpenCV, or from some other format into RawImage; 2) Allow simple drawings of lines, circles, rectangles, etc to make simple demo displays directly in the RawImage buffer that will be sent over the USB link.

Collaboration diagram for Minimalistic support for images in the core JeVois library:

Classes

class  jevois::RawImage
 A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget. More...
 

Namespaces

 jevois::yuyv
 Helper YUYV colors.
 
 jevois::rgb565
 Helper RGB565 colors.
 

Modules

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

Enumerations

enum  jevois::rawimage::Font {
  jevois::rawimage::Font5x7, jevois::rawimage::Font6x10, jevois::rawimage::Font7x13, jevois::rawimage::Font8x13bold,
  jevois::rawimage::Font9x15bold, jevois::rawimage::Font10x20, jevois::rawimage::Font11x22, jevois::rawimage::Font12x22,
  jevois::rawimage::Font14x26, jevois::rawimage::Font15x28, jevois::rawimage::Font16x29, jevois::rawimage::Font20x38
}
 Available fonts for writeText() More...
 

Functions

void convertYUYVtoRGB24 (unsigned int w, unsigned int h, unsigned char const *src, unsigned char *dst)
 Convert from YUYV to RGB, mostly intended for internal use. Use RawImage functions instead in most cases. More...
 
void convertYUYVtoRGBYL (unsigned int w, unsigned int h, unsigned char const *src, int *dstrg, int *dstby, int *dstlum, int thresh, int inputbits)
 Convert from YUYV to RG, BY, and luminance for use by Saliency module in jevoisbase. For internal use. More...
 
cv::Mat jevois::rawimage::cvImage (RawImage const &src)
 Create an OpenCV image from the existing RawImage data, sharing the pixel memory rather than copying it. More...
 
cv::Mat jevois::rawimage::convertToCvGray (RawImage const &src)
 Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV gray byte. More...
 
cv::Mat jevois::rawimage::convertToCvBGR (RawImage const &src)
 Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV BGR byte. More...
 
cv::Mat jevois::rawimage::convertToCvRGB (RawImage const &src)
 Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV RGB byte. More...
 
cv::Mat jevois::rawimage::convertToCvRGBA (RawImage const &src)
 Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV RGB-A byte. More...
 
void jevois::rawimage::byteSwap (RawImage &img)
 Swap pairs of bytes in a RawImage. More...
 
void jevois::rawimage::paste (RawImage const &src, RawImage &dest, int dx, int dy)
 Paste an image within another of same pixel type. More...
 
void jevois::rawimage::pasteGreyToYUYV (cv::Mat const &src, RawImage &dest, int dx, int dy)
 Paste a grey byte image into a YUYV image. More...
 
void jevois::rawimage::pasteBGRtoYUYV (cv::Mat const &src, RawImage &dst, int dx, int dy)
 Paste a BGR byte image into a YUYV image. More...
 
void jevois::rawimage::pasteRGBtoYUYV (cv::Mat const &src, RawImage &dst, int dx, int dy)
 Paste a RGB byte image into a YUYV image. More...
 
void jevois::rawimage::roipaste (RawImage const &src, int x, int y, unsigned int w, unsigned int h, RawImage &dest, int dx, int dy)
 Paste an ROI from an image to within another of same pixel type. More...
 
void jevois::rawimage::drawDisk (RawImage &img, int x, int y, unsigned int rad, unsigned int col)
 Draw a disk in a YUYV image. More...
 
void jevois::rawimage::drawCircle (RawImage &img, int x, int y, unsigned int rad, unsigned int thick, unsigned int col)
 Draw a circle in a YUYV image. More...
 
bool jevois::rawimage::clipLine (int wxmin, int wymin, int wxmax, int wymax, int &x1, int &y1, int &x2, int &y2)
 Clip a line to fit inside a viewport [wxmin...wxmax[ x [wymin...wymax[. More...
 
void jevois::rawimage::drawLine (RawImage &img, int x1, int y1, int x2, int y2, unsigned int thick, unsigned int col)
 Draw a line in a YUYV image. More...
 
void jevois::rawimage::drawRect (RawImage &img, int x, int y, unsigned int w, unsigned int h, unsigned int thick, unsigned int col)
 Draw a rectangle in a YUYV image. More...
 
void jevois::rawimage::drawRect (RawImage &img, int x, int y, unsigned int w, unsigned int h, unsigned int col)
 Draw a rectangle in a YUYV image. More...
 
void jevois::rawimage::drawFilledRect (RawImage &img, int x, int y, unsigned int w, unsigned int h, unsigned int col)
 Draw a filled rectangle in a YUYV image. More...
 
void jevois::rawimage::writeText (RawImage &img, std::string const &txt, int x, int y, unsigned int col, Font font=Font6x10)
 Write some text in an image. More...
 
void jevois::rawimage::writeText (RawImage &img, char const *txt, int x, int y, unsigned int col, Font font=Font6x10)
 Write some text in an image. More...
 
void jevois::rawimage::convertCvBGRtoRawImage (cv::Mat const &src, RawImage &dst, int quality)
 Convert a BGR cv::Mat to RawImage with already-allocated pixels and pixel type. More...
 
void jevois::rawimage::convertCvRGBtoRawImage (cv::Mat const &src, RawImage &dst, int quality)
 Convert a RGB cv::Mat to RawImage with already-allocated pixels and pixel type. More...
 
void jevois::rawimage::convertCvRGBAtoRawImage (cv::Mat const &src, RawImage &dst, int quality)
 Convert an RGBA cv::Mat to RawImage with already-allocated pixels and pixel type. More...
 
void jevois::rawimage::convertCvGRAYtoRawImage (cv::Mat const &src, RawImage &dst, int quality)
 Convert a Gray cv::Mat to RawImage with already-allocated pixels and pixel type. More...
 
void jevois::rawimage::unpackCvRGBAtoGrayRawImage (cv::Mat const &src, RawImage &dst)
 Split an RGBA cv::Mat into a 4x taller grey RawImage with already-allocated pixels. More...
 
void jevois::rawimage::hFlipYUYV (RawImage &img)
 Flip a YUYV RawImage horizontally while preserving color information. More...
 
void jevois::rawimage::convertCvRGBtoCvYUYV (cv::Mat const &src, cv::Mat &dst)
 OpenCV does not provide conversion from RGB to YUYV in cvtColor(), so this function provides it. More...
 
void jevois::rawimage::convertCvBGRtoCvYUYV (cv::Mat const &src, cv::Mat &dst)
 OpenCV does not provide conversion from BGR to YUYV in cvtColor(), so this function provides it. More...
 
void jevois::rawimage::convertCvGRAYtoCvYUYV (cv::Mat const &src, cv::Mat &dst)
 OpenCV does not provide conversion from GRAY to YUYV in cvtColor(), so this function provides it. More...
 
void jevois::rawimage::convertCvRGBAtoCvYUYV (cv::Mat const &src, cv::Mat &dst)
 OpenCV does not provide conversion from RGBA to YUYV in cvtColor(), so this function provides it. More...
 
cv::Mat jevois::rescaleCv (cv::Mat const &img, cv::Size const &newdims)
 Rescale an OpenCV image, choosing the right kind of interpolation. More...
 

Enumeration Type Documentation

◆ Font

Available fonts for writeText()

Enumerator
Font5x7 
Font6x10 
Font7x13 
Font8x13bold 
Font9x15bold 
Font10x20 
Font11x22 
Font12x22 
Font14x26 
Font15x28 
Font16x29 
Font20x38 

Definition at line 152 of file RawImageOps.H.

Function Documentation

◆ byteSwap()

void jevois::rawimage::byteSwap ( jevois::RawImage img)

Swap pairs of bytes in a RawImage.

This should never be needed, except maybe for RGB565 images, mainly for internal debugging, or to directly pass an RGB565 camera image (which is big endian) to USB (which assumes little endian when using RGBP UVC format). This function is NEON-accelerated when compiled for the platform hardware.

Definition at line 368 of file RawImageOps.C.

References jevois::async(), jevois::RawImage::bytesize(), jevois::RawImage::bytesperpix(), jevois::RawImage::height, LFATAL, jevois::RawImage::pixelsw(), and jevois::RawImage::width.

◆ clipLine()

bool jevois::rawimage::clipLine ( int  wxmin,
int  wymin,
int  wxmax,
int  wymax,
int &  x1,
int &  y1,
int &  x2,
int &  y2 
)

Clip a line to fit inside a viewport [wxmin...wxmax[ x [wymin...wymax[.

This uses the Liang-Barsky line clipping algorithm. Returns false if the line is entirely outside the viewport (nothing to draw).

Definition at line 533 of file RawImageOps.C.

Referenced by jevois::rawimage::drawLine().

◆ convertCvBGRtoCvYUYV()

void jevois::rawimage::convertCvBGRtoCvYUYV ( cv::Mat const &  src,
cv::Mat &  dst 
)

OpenCV does not provide conversion from BGR to YUYV in cvtColor(), so this function provides it.

Definition at line 1026 of file RawImageOps.C.

References jevois::cvtypestr(), and LFATAL.

◆ convertCvBGRtoRawImage()

void jevois::rawimage::convertCvBGRtoRawImage ( cv::Mat const &  src,
RawImage dst,
int  quality 
)

Convert a BGR cv::Mat to RawImage with already-allocated pixels and pixel type.

This is used to output video frames over USB from internally computed results in opencv BGR format. dst should already have an allocated pixel buffer (typically, it should be obtained from the USB gadget), and its size must match that of the src image.

Supported dst pixel formats:

  • V4L2_PIX_FMT_YUYV
  • V4L2_PIX_FMT_GREY
  • V4L2_PIX_FMT_SRGGB8 (Bayer)
  • V4L2_PIX_FMT_RGB565
  • V4L2_PIX_FMT_MJPG
  • V4L2_PIX_FMT_BGR24

quality is used only when dst is MJPG and should be between 1 and 100.

Definition at line 1266 of file RawImageOps.C.

References jevois::RawImage::bytesperpix(), jevois::compressBGRtoJpeg(), jevois::rawimage::cvImage(), jevois::cvtypestr(), jevois::fccstr(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, jevois::RawImage::pixelsw(), and jevois::RawImage::width.

Referenced by jevois::MovieInput::get(), jevois::MovieInput::get2(), TutorialConvert::process(), jevois::OutputFrame::sendCvBGR(), and jevois::OutputFrame::sendScaledCvBGR().

◆ convertCvGRAYtoCvYUYV()

void jevois::rawimage::convertCvGRAYtoCvYUYV ( cv::Mat const &  src,
cv::Mat &  dst 
)

OpenCV does not provide conversion from GRAY to YUYV in cvtColor(), so this function provides it.

Definition at line 1184 of file RawImageOps.C.

References jevois::cvtypestr(), and LFATAL.

◆ convertCvGRAYtoRawImage()

void jevois::rawimage::convertCvGRAYtoRawImage ( cv::Mat const &  src,
RawImage dst,
int  quality 
)

Convert a Gray cv::Mat to RawImage with already-allocated pixels and pixel type.

This is used to output video frames over USB from internally computed results in opencv Gray format. dst should already have an allocated pixel buffer (typically, it should be obtained from the USB gadget), and its size must match that of the src image.

Supported dst pixel formats:

  • V4L2_PIX_FMT_YUYV
  • V4L2_PIX_FMT_GREY
  • V4L2_PIX_FMT_SRGGB8 (Bayer)
  • V4L2_PIX_FMT_RGB565
  • V4L2_PIX_FMT_MJPG
  • V4L2_PIX_FMT_BGR24

quality is used only when dst is MJPG and should be between 1 and 100.

Definition at line 1359 of file RawImageOps.C.

References jevois::RawImage::bytesperpix(), jevois::compressGRAYtoJpeg(), jevois::rawimage::cvImage(), jevois::cvtypestr(), jevois::fccstr(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, jevois::RawImage::pixelsw(), and jevois::RawImage::width.

Referenced by jevois::OutputFrame::sendCvGRAY(), and jevois::OutputFrame::sendScaledCvGRAY().

◆ convertCvRGBAtoCvYUYV()

void jevois::rawimage::convertCvRGBAtoCvYUYV ( cv::Mat const &  src,
cv::Mat &  dst 
)

OpenCV does not provide conversion from RGBA to YUYV in cvtColor(), so this function provides it.

Definition at line 1256 of file RawImageOps.C.

References jevois::cvtypestr(), and LFATAL.

◆ convertCvRGBAtoRawImage()

void jevois::rawimage::convertCvRGBAtoRawImage ( cv::Mat const &  src,
RawImage dst,
int  quality 
)

Convert an RGBA cv::Mat to RawImage with already-allocated pixels and pixel type.

This is used to output video frames over USB from internally computed results in opencv RGB-A format (which is often the format of choice for NEON or OpenGL processing). dst should already have an allocated pixel buffer (typically, it should be obtained from the USB gadget), and its size must match that of the src image.

Supported dst pixel formats:

  • V4L2_PIX_FMT_YUYV
  • V4L2_PIX_FMT_GREY
  • V4L2_PIX_FMT_SRGGB8 (Bayer)
  • V4L2_PIX_FMT_RGB565
  • V4L2_PIX_FMT_MJPG
  • V4L2_PIX_FMT_BGR24

quality is used only when dst is MJPG and should be between 1 and 100.

Definition at line 1337 of file RawImageOps.C.

References jevois::compressRGBAtoJpeg(), jevois::rawimage::cvImage(), jevois::cvtypestr(), jevois::fccstr(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, and jevois::RawImage::width.

Referenced by jevois::OutputFrame::sendCvRGBA(), and jevois::OutputFrame::sendScaledCvRGBA().

◆ convertCvRGBtoCvYUYV()

void jevois::rawimage::convertCvRGBtoCvYUYV ( cv::Mat const &  src,
cv::Mat &  dst 
)

OpenCV does not provide conversion from RGB to YUYV in cvtColor(), so this function provides it.

Definition at line 1112 of file RawImageOps.C.

References jevois::cvtypestr(), and LFATAL.

◆ convertCvRGBtoRawImage()

void jevois::rawimage::convertCvRGBtoRawImage ( cv::Mat const &  src,
RawImage dst,
int  quality 
)

Convert a RGB cv::Mat to RawImage with already-allocated pixels and pixel type.

This is used to output video frames over USB from internally computed results in opencv BGR format. dst should already have an allocated pixel buffer (typically, it should be obtained from the USB gadget), and its size must match that of the src image.

Supported dst pixel formats:

  • V4L2_PIX_FMT_YUYV
  • V4L2_PIX_FMT_GREY
  • V4L2_PIX_FMT_SRGGB8 (Bayer)
  • V4L2_PIX_FMT_RGB565
  • V4L2_PIX_FMT_MJPG
  • V4L2_PIX_FMT_BGR24

quality is used only when dst is MJPG and should be between 1 and 100.

Definition at line 1289 of file RawImageOps.C.

References jevois::RawImage::bytesperpix(), jevois::compressRGBtoJpeg(), jevois::rawimage::cvImage(), jevois::cvtypestr(), jevois::fccstr(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, jevois::RawImage::pixelsw(), and jevois::RawImage::width.

Referenced by jevois::OutputFrame::sendCvRGB(), and jevois::OutputFrame::sendScaledCvRGB().

◆ convertToCvBGR()

cv::Mat jevois::rawimage::convertToCvBGR ( jevois::RawImage const &  src)

Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV BGR byte.

For historical reasons, BGR is the "native" color format of OpenCV, check whether your algorithm needs RGB or BGR and use the appropriate conversion for it.

Supported RawImage pixel formats:

  • V4L2_PIX_FMT_YUYV
  • V4L2_PIX_FMT_GREY
  • V4L2_PIX_FMT_SRGGB8 (Bayer)
  • V4L2_PIX_FMT_RGB565
  • V4L2_PIX_FMT_BGR24

Definition at line 282 of file RawImageOps.C.

References jevois::rawimage::cvImage(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, and jevois::RawImage::width.

Referenced by jevois::InputFrame::getCvBGR(), jevois::InputFrame::getCvBGRp(), TutorialConvert::process(), jevois::dnn::PreProcessor::process(), and jevois::MovieOutput::send().

◆ convertToCvGray()

cv::Mat jevois::rawimage::convertToCvGray ( jevois::RawImage const &  src)

Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV gray byte.

Supported RawImage pixel formats:

  • V4L2_PIX_FMT_YUYV
  • V4L2_PIX_FMT_GREY
  • V4L2_PIX_FMT_SRGGB8 (Bayer)
  • V4L2_PIX_FMT_RGB565
  • V4L2_PIX_FMT_BGR24

Definition at line 246 of file RawImageOps.C.

References jevois::rawimage::cvImage(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, and jevois::RawImage::width.

Referenced by jevois::InputFrame::getCvGRAY(), jevois::InputFrame::getCvGRAYp(), TutorialEdgeDetection::process(), and TutorialEdgeDetectionX4::process().

◆ convertToCvRGB()

cv::Mat jevois::rawimage::convertToCvRGB ( jevois::RawImage const &  src)

Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV RGB byte.

For historical reasons, BGR is the "native" color format of OpenCV, not RGB as created here, check whether your algorithm needs RGB or BGR and use the appropriate conversion for it.

Supported RawImage pixel formats:

  • V4L2_PIX_FMT_YUYV
  • V4L2_PIX_FMT_GREY
  • V4L2_PIX_FMT_SRGGB8 (Bayer)
  • V4L2_PIX_FMT_RGB565
  • V4L2_PIX_FMT_BGR24

Definition at line 307 of file RawImageOps.C.

References jevois::rawimage::cvImage(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, and jevois::RawImage::width.

Referenced by jevois::InputFrame::getCvRGB(), jevois::InputFrame::getCvRGBp(), and jevois::dnn::PreProcessor::process().

◆ convertToCvRGBA()

cv::Mat jevois::rawimage::convertToCvRGBA ( jevois::RawImage const &  src)

Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV RGB-A byte.

RGBA is seldom used by OpenCV itself, but is useful for many NEON and OpenGL (GPU) algorithms. For these algorithms, we here just use cv::Mat as a convenient container for raw pixel data.

Supported RawImage pixel formats:

  • V4L2_PIX_FMT_YUYV
  • V4L2_PIX_FMT_GREY
  • V4L2_PIX_FMT_SRGGB8 (Bayer)
  • V4L2_PIX_FMT_RGB565
  • V4L2_PIX_FMT_BGR24

Definition at line 332 of file RawImageOps.C.

References jevois::rawimage::cvImage(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, and jevois::RawImage::width.

Referenced by jevois::InputFrame::getCvRGBA(), and jevois::InputFrame::getCvRGBAp().

◆ convertYUYVtoRGB24()

void convertYUYVtoRGB24 ( unsigned int  w,
unsigned int  h,
unsigned char const *  src,
unsigned char *  dst 
)

Convert from YUYV to RGB, mostly intended for internal use. Use RawImage functions instead in most cases.

This code is modified from here: http://pastebin.com/mDcwqJV3 Memory should have been allocated by caller.

Definition at line 23 of file ColorConversion.c.

References CLAMP, G, and h.

◆ convertYUYVtoRGBYL()

void convertYUYVtoRGBYL ( unsigned int  w,
unsigned int  h,
unsigned char const *  src,
int *  dstrg,
int *  dstby,
int *  dstlum,
int  thresh,
int  inputbits 
)

Convert from YUYV to RG, BY, and luminance for use by Saliency module in jevoisbase. For internal use.

Definition at line 89 of file ColorConversion.c.

References convertYUYVtoRGBYLinternal(), G, and h.

◆ cvImage()

cv::Mat jevois::rawimage::cvImage ( jevois::RawImage const &  src)

◆ drawCircle()

void jevois::rawimage::drawCircle ( jevois::RawImage img,
int  x,
int  y,
unsigned int  rad,
unsigned int  thick,
unsigned int  col 
)

Draw a circle in a YUYV image.

Definition at line 483 of file RawImageOps.C.

References jevois::rawimage::drawDisk().

Referenced by jevois::dnn::PostProcessorYuNet::report().

◆ drawDisk()

void jevois::rawimage::drawDisk ( jevois::RawImage img,
int  x,
int  y,
unsigned int  rad,
unsigned int  col 
)

◆ drawFilledRect()

void jevois::rawimage::drawFilledRect ( jevois::RawImage img,
int  x,
int  y,
unsigned int  w,
unsigned int  h,
unsigned int  col 
)

Draw a filled rectangle in a YUYV image.

This is really not flexible and is optimized for speed only. col will be used for both YU and YV pixels. For more demanding drawings, use openCV functions. The pixels drawn go from (x,y) included to (x+w-1,y+h-1) included. If w or h is 0, it is replaced by 1.

Definition at line 646 of file RawImageOps.C.

References h, jevois::RawImage::height, jevois::RawImage::pixelsw(), and jevois::RawImage::width.

◆ drawLine()

void jevois::rawimage::drawLine ( jevois::RawImage img,
int  x1,
int  y1,
int  x2,
int  y2,
unsigned int  thick,
unsigned int  col 
)

◆ drawRect() [1/2]

void jevois::rawimage::drawRect ( jevois::RawImage img,
int  x,
int  y,
unsigned int  w,
unsigned int  h,
unsigned int  col 
)

Draw a rectangle in a YUYV image.

This is really not flexible and is optimized for speed only. col will be used for both YU and YV pixels. For more demanding drawings, use openCV functions. The pixels drawn go from (x,y) included to (x+w-1,y+h-1) included. If w or h is 0, it is replaced by 1.

Definition at line 624 of file RawImageOps.C.

References h, jevois::RawImage::height, jevois::RawImage::pixelsw(), and jevois::RawImage::width.

◆ drawRect() [2/2]

void jevois::rawimage::drawRect ( jevois::RawImage img,
int  x,
int  y,
unsigned int  w,
unsigned int  h,
unsigned int  thick,
unsigned int  col 
)

Draw a rectangle in a YUYV image.

The pixels drawn go from (x,y) included to (x+w-1,y+h-1) included. If w or h is 0, it is replaced by 1.

Definition at line 607 of file RawImageOps.C.

References jevois::rawimage::drawLine(), and h.

Referenced by jevois::dnn::PostProcessorDetect::report(), jevois::dnn::PostProcessorYuNet::report(), and jevois::dnn::PreProcessor::sendreport().

◆ hFlipYUYV()

void jevois::rawimage::hFlipYUYV ( RawImage img)

Flip a YUYV RawImage horizontally while preserving color information.

This function is to allow one to use JeVois with the PhotoBooth app on a Mac, whih flips the image horizontally (about the vertical axis). Only YUYV pixels are supported. You might be able to use cv::flip() from OpenCV instead with other pixel types.

Definition at line 1416 of file RawImageOps.C.

References jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, jevois::RawImage::pixelsw(), and jevois::RawImage::width.

◆ paste()

void jevois::rawimage::paste ( jevois::RawImage const &  src,
jevois::RawImage dest,
int  dx,
int  dy 
)

Paste an image within another of same pixel type.

To keep this function fast, throws if the source image does not fully fit within the destination image, or if the two images do not have the same pixel format.

Definition at line 403 of file RawImageOps.C.

References jevois::RawImage::bytesperpix(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, jevois::RawImage::pixels(), jevois::RawImage::pixelsw(), and jevois::RawImage::width.

◆ pasteBGRtoYUYV()

void jevois::rawimage::pasteBGRtoYUYV ( cv::Mat const &  src,
jevois::RawImage dst,
int  dx,
int  dy 
)

◆ pasteGreyToYUYV()

void jevois::rawimage::pasteGreyToYUYV ( cv::Mat const &  src,
jevois::RawImage dest,
int  dx,
int  dy 
)

Paste a grey byte image into a YUYV image.

Definition at line 448 of file RawImageOps.C.

References jevois::RawImage::bytesperpix(), jevois::RawImage::height, LFATAL, jevois::RawImage::pixelsw(), and jevois::RawImage::width.

◆ pasteRGBtoYUYV()

void jevois::rawimage::pasteRGBtoYUYV ( cv::Mat const &  src,
jevois::RawImage dst,
int  dx,
int  dy 
)

◆ rescaleCv()

cv::Mat jevois::rescaleCv ( cv::Mat const &  img,
cv::Size const &  newdims 
)

◆ roipaste()

void jevois::rawimage::roipaste ( jevois::RawImage const &  src,
int  x,
int  y,
unsigned int  w,
unsigned int  h,
jevois::RawImage dest,
int  dx,
int  dy 
)

Paste an ROI from an image to within another of same pixel type.

To keep this function fast, throws if the source image does not fully fit within the destination image or if the pixel formats differ.

Definition at line 425 of file RawImageOps.C.

References jevois::RawImage::bytesperpix(), jevois::RawImage::fmt, h, jevois::RawImage::height, LFATAL, jevois::RawImage::pixels(), jevois::RawImage::pixelsw(), and jevois::RawImage::width.

◆ unpackCvRGBAtoGrayRawImage()

void jevois::rawimage::unpackCvRGBAtoGrayRawImage ( cv::Mat const &  src,
RawImage dst 
)

Split an RGBA cv::Mat into a 4x taller grey RawImage with already-allocated pixels.

This is used to run GPU shaders that apply different filters to an image and store their results separately into the R, G, B and A components of an RGBA output image. Here, we just unpack the 4 components and stuff them into the output image one above the other: R on top, then G below it, then B below it, then A below it. The destination RawImage must be at least as wide as src and at least 4 times as tall as src, and must have V4L2_PIX_FMT_GREY pixels.

Definition at line 1312 of file RawImageOps.C.

References jevois::async(), jevois::cvtypestr(), jevois::RawImage::fmt, h, jevois::RawImage::height, LFATAL, jevois::RawImage::pixelsw(), and jevois::RawImage::width.

◆ writeText() [1/2]

◆ writeText() [2/2]

void jevois::rawimage::writeText ( jevois::RawImage img,
std::string const &  txt,
int  x,
int  y,
unsigned int  col,
Font  font = Font6x10 
)