camera_usb
Public Member Functions | Static Public Member Functions | List of all members
camera::Helpers Class Reference

#include <helpers.h>

Public Member Functions

 Helpers ()
 
uint8_t clip (int value)
 
void convertYUYVPixel (uint8_t y, uint8_t u, uint8_t v, uint8_t &r, uint8_t &g, uint8_t &b)
 
void convertYUYV2RGB (uint8_t *yuyv_data, size_t yuyv_data_length, std::vector< uint8_t > &rgb_buffer)
 

Static Public Member Functions

static void removeJpegCommentBlock (base::samples::frame::Frame &frame)
 
static bool storeImageToFile (std::vector< uint8_t > const &buffer, std::string const &file_name)
 

Constructor & Destructor Documentation

camera::Helpers::Helpers ( )
inline

Creates YUV2RGB lookup tables.

Member Function Documentation

uint8_t camera::Helpers::clip ( int  value)
inline
void camera::Helpers::convertYUYV2RGB ( uint8_t *  yuyv_data,
size_t  yuyv_data_length,
std::vector< uint8_t > &  rgb_buffer 
)
inline

Converts an YUYV image to RGB24.

Parameters
yuyv_dataPointer to the YUV data. Four bytes are two pixels, U and V belong to both Ys: YUY'V forms YUV and Y'UV. Ranges on the test system: Y[0,255] U[0,218] V[0,254]
yuyv_data_lengthNumber of bytes of yuyv_data. Divides by 2 is the number of pixels.
rgb_bufferBuffer which will receive the RGB pixels. http://stackoverflow.com/questions/37561461/how-to-convert-yuyv-to-rgb-code-to-yuv420-to-rgb
void camera::Helpers::convertYUYVPixel ( uint8_t  y,
uint8_t  u,
uint8_t  v,
uint8_t &  r,
uint8_t &  g,
uint8_t &  b 
)
inline
static void camera::Helpers::removeJpegCommentBlock ( base::samples::frame::Frame &  frame)
inlinestatic

Someone (OpenCV?) does not understand JPEG comment-blocks. Removes comment block to avoid getting 'Corrupt JPEG data: x extraneous bytes before marker 0xe0.'

static bool camera::Helpers::storeImageToFile ( std::vector< uint8_t > const &  buffer,
std::string const &  file_name 
)
inlinestatic

The documentation for this class was generated from the following file: