Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
usb_cam::UsbCam Class Reference

#include <usb_cam.h>

Classes

struct  buffer
 
struct  camera_image_t
 

Public Types

enum  io_method { IO_METHOD_READ, IO_METHOD_MMAP, IO_METHOD_USERPTR, IO_METHOD_UNKNOWN }
 
enum  pixel_format {
  PIXEL_FORMAT_YUYV, PIXEL_FORMAT_UYVY, PIXEL_FORMAT_MJPEG, PIXEL_FORMAT_YUVMONO10,
  PIXEL_FORMAT_RGB24, PIXEL_FORMAT_GREY, PIXEL_FORMAT_UNKNOWN
}
 

Public Member Functions

void grab_image (sensor_msgs::Image *image)
 
bool is_capturing ()
 
void set_auto_focus (int value)
 
void set_v4l_parameter (const std::string &param, int value)
 
void set_v4l_parameter (const std::string &param, const std::string &value)
 
void shutdown (void)
 
void start (const std::string &dev, io_method io, pixel_format pf, int image_width, int image_height, int framerate)
 
void start_capturing (void)
 
void stop_capturing (void)
 
 UsbCam ()
 
 ~UsbCam ()
 

Static Public Member Functions

static io_method io_method_from_string (const std::string &str)
 
static pixel_format pixel_format_from_string (const std::string &str)
 

Private Member Functions

void close_device (void)
 
void grab_image ()
 
void init_device (int image_width, int image_height, int framerate)
 
int init_mjpeg_decoder (int image_width, int image_height)
 
void init_mmap (void)
 
void init_read (unsigned int buffer_size)
 
void init_userp (unsigned int buffer_size)
 
void mjpeg2rgb (char *MJPEG, int len, char *RGB, int NumPixels)
 
void open_device (void)
 
void process_image (const void *src, int len, camera_image_t *dest)
 
int read_frame ()
 
void uninit_device (void)
 

Private Attributes

AVCodec * avcodec_
 
AVCodecContext * avcodec_context_
 
AVFrame * avframe_camera_
 
int avframe_camera_size_
 
AVFrame * avframe_rgb_
 
int avframe_rgb_size_
 
AVDictionary * avoptions_
 
bufferbuffers_
 
std::string camera_dev_
 
int fd_
 
camera_image_timage_
 
io_method io_
 
bool is_capturing_
 
bool monochrome_
 
unsigned int n_buffers_
 
unsigned int pixelformat_
 
struct SwsContext * video_sws_
 

Detailed Description

Definition at line 62 of file usb_cam.h.

Member Enumeration Documentation

Enumerator
IO_METHOD_READ 
IO_METHOD_MMAP 
IO_METHOD_USERPTR 
IO_METHOD_UNKNOWN 

Definition at line 64 of file usb_cam.h.

Enumerator
PIXEL_FORMAT_YUYV 
PIXEL_FORMAT_UYVY 
PIXEL_FORMAT_MJPEG 
PIXEL_FORMAT_YUVMONO10 
PIXEL_FORMAT_RGB24 
PIXEL_FORMAT_GREY 
PIXEL_FORMAT_UNKNOWN 

Definition at line 69 of file usb_cam.h.

Constructor & Destructor Documentation

usb_cam::UsbCam::UsbCam ( )

Definition at line 356 of file usb_cam.cpp.

usb_cam::UsbCam::~UsbCam ( )

Definition at line 361 of file usb_cam.cpp.

Member Function Documentation

void usb_cam::UsbCam::close_device ( void  )
private

Definition at line 972 of file usb_cam.cpp.

void usb_cam::UsbCam::grab_image ( sensor_msgs::Image *  image)

Definition at line 1082 of file usb_cam.cpp.

void usb_cam::UsbCam::grab_image ( )
private

Definition at line 1101 of file usb_cam.cpp.

void usb_cam::UsbCam::init_device ( int  image_width,
int  image_height,
int  framerate 
)
private

Definition at line 833 of file usb_cam.cpp.

int usb_cam::UsbCam::init_mjpeg_decoder ( int  image_width,
int  image_height 
)
private

Definition at line 366 of file usb_cam.cpp.

void usb_cam::UsbCam::init_mmap ( void  )
private

Definition at line 724 of file usb_cam.cpp.

void usb_cam::UsbCam::init_read ( unsigned int  buffer_size)
private

Definition at line 704 of file usb_cam.cpp.

void usb_cam::UsbCam::init_userp ( unsigned int  buffer_size)
private

Definition at line 784 of file usb_cam.cpp.

UsbCam::io_method usb_cam::UsbCam::io_method_from_string ( const std::string &  str)
static

Definition at line 1217 of file usb_cam.cpp.

bool usb_cam::UsbCam::is_capturing ( )

Definition at line 588 of file usb_cam.cpp.

void usb_cam::UsbCam::mjpeg2rgb ( char *  MJPEG,
int  len,
char *  RGB,
int  NumPixels 
)
private

Definition at line 409 of file usb_cam.cpp.

void usb_cam::UsbCam::open_device ( void  )
private

Definition at line 980 of file usb_cam.cpp.

UsbCam::pixel_format usb_cam::UsbCam::pixel_format_from_string ( const std::string &  str)
static

Definition at line 1229 of file usb_cam.cpp.

void usb_cam::UsbCam::process_image ( const void *  src,
int  len,
camera_image_t dest 
)
private

Definition at line 462 of file usb_cam.cpp.

int usb_cam::UsbCam::read_frame ( )
private

Definition at line 485 of file usb_cam.cpp.

void usb_cam::UsbCam::set_auto_focus ( int  value)

Definition at line 1135 of file usb_cam.cpp.

void usb_cam::UsbCam::set_v4l_parameter ( const std::string &  param,
int  value 
)

Set video device parameter via call to v4l-utils.

Parameters
paramThe name of the parameter to set
paramThe value to assign

Definition at line 1181 of file usb_cam.cpp.

void usb_cam::UsbCam::set_v4l_parameter ( const std::string &  param,
const std::string &  value 
)

Set video device parameter via call to v4l-utils.

Parameters
paramThe name of the parameter to set
paramThe value to assign

Definition at line 1191 of file usb_cam.cpp.

void usb_cam::UsbCam::shutdown ( void  )

Definition at line 1059 of file usb_cam.cpp.

void usb_cam::UsbCam::start ( const std::string &  dev,
io_method  io,
pixel_format  pf,
int  image_width,
int  image_height,
int  framerate 
)

Definition at line 1005 of file usb_cam.cpp.

void usb_cam::UsbCam::start_capturing ( void  )

Definition at line 616 of file usb_cam.cpp.

void usb_cam::UsbCam::stop_capturing ( void  )

Definition at line 592 of file usb_cam.cpp.

void usb_cam::UsbCam::uninit_device ( void  )
private

Definition at line 679 of file usb_cam.cpp.

Member Data Documentation

AVCodec* usb_cam::UsbCam::avcodec_
private

Definition at line 142 of file usb_cam.h.

AVCodecContext* usb_cam::UsbCam::avcodec_context_
private

Definition at line 144 of file usb_cam.h.

AVFrame* usb_cam::UsbCam::avframe_camera_
private

Definition at line 140 of file usb_cam.h.

int usb_cam::UsbCam::avframe_camera_size_
private

Definition at line 145 of file usb_cam.h.

AVFrame* usb_cam::UsbCam::avframe_rgb_
private

Definition at line 141 of file usb_cam.h.

int usb_cam::UsbCam::avframe_rgb_size_
private

Definition at line 146 of file usb_cam.h.

AVDictionary* usb_cam::UsbCam::avoptions_
private

Definition at line 143 of file usb_cam.h.

buffer* usb_cam::UsbCam::buffers_
private

Definition at line 138 of file usb_cam.h.

std::string usb_cam::UsbCam::camera_dev_
private

Definition at line 133 of file usb_cam.h.

int usb_cam::UsbCam::fd_
private

Definition at line 137 of file usb_cam.h.

camera_image_t* usb_cam::UsbCam::image_
private

Definition at line 148 of file usb_cam.h.

io_method usb_cam::UsbCam::io_
private

Definition at line 136 of file usb_cam.h.

bool usb_cam::UsbCam::is_capturing_
private

Definition at line 130 of file usb_cam.h.

bool usb_cam::UsbCam::monochrome_
private

Definition at line 135 of file usb_cam.h.

unsigned int usb_cam::UsbCam::n_buffers_
private

Definition at line 139 of file usb_cam.h.

unsigned int usb_cam::UsbCam::pixelformat_
private

Definition at line 134 of file usb_cam.h.

struct SwsContext* usb_cam::UsbCam::video_sws_
private

Definition at line 147 of file usb_cam.h.


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


usb_cam
Author(s): Benjamin Pitzer
autogenerated on Fri Jun 7 2019 21:46:25