![]() |
Visual Servoing Platform version 3.6.0
|
#include <vpV4l2Grabber.h>
Public Types | |
| enum | vpV4l2FramerateType { framerate_50fps , framerate_25fps } |
| enum | vpV4l2FrameFormatType { V4L2_FRAME_FORMAT , V4L2_IMAGE_FORMAT } |
| enum | vpV4l2PixelFormatType { V4L2_GREY_FORMAT , V4L2_RGB24_FORMAT , V4L2_RGB32_FORMAT , V4L2_BGR24_FORMAT , V4L2_YUYV_FORMAT , V4L2_MAX_FORMAT } |
Public Member Functions | |
| vpV4l2Grabber () | |
| vpV4l2Grabber (bool verbose) | |
| vpV4l2Grabber (unsigned input, unsigned scale=vpV4l2Grabber::DEFAULT_SCALE) | |
| vpV4l2Grabber (vpImage< unsigned char > &I, unsigned input, unsigned scale=vpV4l2Grabber::DEFAULT_SCALE) | |
| vpV4l2Grabber (vpImage< vpRGBa > &I, unsigned input, unsigned scale=vpV4l2Grabber::DEFAULT_SCALE) | |
| virtual | ~vpV4l2Grabber () |
| void | open (vpImage< unsigned char > &I) |
| void | open (vpImage< vpRGBa > &I) |
| void | acquire (vpImage< unsigned char > &I) |
| void | acquire (vpImage< unsigned char > &I, const vpRect &roi) |
| void | acquire (vpImage< unsigned char > &I, struct timeval ×tamp, const vpRect &roi=vpRect()) |
| void | acquire (vpImage< vpRGBa > &I) |
| void | acquire (vpImage< vpRGBa > &I, const vpRect &roi) |
| void | acquire (vpImage< vpRGBa > &I, struct timeval ×tamp, const vpRect &roi=vpRect()) |
| bool | getField () |
| vpV4l2FramerateType | getFramerate () |
| vpV4l2PixelFormatType | getPixelFormat () |
| vpV4l2Grabber & | operator>> (vpImage< unsigned char > &I) |
| vpV4l2Grabber & | operator>> (vpImage< vpRGBa > &I) |
| void | setVerboseMode (bool verbose) |
| void | setFramerate (vpV4l2FramerateType framerate) |
| void | setInput (unsigned input=vpV4l2Grabber::DEFAULT_INPUT) |
| void | setWidth (unsigned w) |
| void | setHeight (unsigned h) |
| void | setScale (unsigned scale=vpV4l2Grabber::DEFAULT_SCALE) |
| void | setNBuffers (unsigned nbuffers) |
| void | setDevice (const std::string &devname) |
| void | setFrameFormat (vpV4l2FrameFormatType frameformat) |
| void | open () |
| void | getCapabilities () |
| void | startStreaming () |
| void | stopStreaming () |
| unsigned char * | waiton (__u32 &index, struct timeval ×tamp) |
| int | queueBuffer () |
| void | queueAll () |
| void | printBufInfo (struct v4l2_buffer buf) |
Inherited functionalities from vpFramegrabber | |
| unsigned int | getHeight () const |
| unsigned int | getWidth () const |
| virtual void | close ()=0 |
Public Attributes | |
| int | fd |
| std::string | device |
| struct v4l2_capability | cap |
| struct v4l2_streamparm | streamparm |
| struct v4l2_input * | inp |
| struct v4l2_standard * | std |
| struct v4l2_fmtdesc * | fmt |
| struct v4l2_queryctrl * | ctl |
| struct v4l2_format | fmt_v4l2 |
| struct ng_video_fmt | fmt_me |
| struct v4l2_requestbuffers | reqbufs |
| struct v4l2_buffer * | buf_v4l2 |
| struct ng_video_buf * | buf_me |
| unsigned int | queue |
| unsigned int | waiton_cpt |
| __u32 | index_buffer |
| bool | m_verbose |
| unsigned | m_nbuffers |
| unsigned int | field |
| bool | streaming |
| unsigned | m_input |
| vpV4l2FramerateType | m_framerate |
| vpV4l2FrameFormatType | m_frameformat |
| vpV4l2PixelFormatType | m_pixelformat |
| bool | init |
Static Public Attributes | |
| static const unsigned int | DEFAULT_INPUT = 2 |
| static const unsigned int | DEFAULT_SCALE = 2 |
| static const __u32 | MAX_INPUTS = 16 |
| static const __u32 | MAX_NORM = 16 |
| static const __u32 | MAX_FORMAT = 32 |
| static const unsigned int | MAX_CTRL = 32 |
| static const unsigned int | MAX_BUFFERS = 32 |
| static const unsigned int | FRAME_SIZE = 288 |
Protected Attributes | |
| unsigned int | height |
| unsigned int | width |
Class that is a wrapper over the Video4Linux2 (V4L2) driver.
Thus to be enabled, this class needs the optional V4L2 3rd party. Installation instruction are provided here https://visp.inria.fr/3rd_v4l2.
Information about Video4Linux can be found on http://linuxtv.org/v4lwiki/index.php/Main_Page
This class was tested with a Pinnacle PCTV Studio/Rave board but also with the following webcams (Logitech QuickCam Vision Pro 9000, Logitech QuickCam Orbit AF, Logitech QuickCam IM (V-USB39), Dell latitude E6400 internal webcam).
If the grabbing fail with a webcam, it means probably that you don't have the read/write permission on the /dev/video%d device. You can set the right permissions by "sudo chmod a+rw /dev/video*".
If the grabbing fails when the camera is attached to a bttv PCI card, it means potentially that you have not configured the linux bttv kernel module according to your board.
For that, depending on your linux distribution check the card id in
For example, the card id of a Pinnacle PCTV Studio/Rave board is 39. Once this id is determined, you have to set the bttv driver with, by adding
options bttv card=39
in one of theses files :
This first example available in tutorial-grabber-v4l2.cpp shows how to grab and display images from an usb camera.
This other example shows how to use this grabber with an analogic camera attached to a bttv PCI card.
Definition at line 132 of file vpV4l2Grabber.h.
Frame format type for capture.
| Enumerator | |
|---|---|
| V4L2_FRAME_FORMAT | a field only |
| V4L2_IMAGE_FORMAT | an interlaced image |
Definition at line 155 of file vpV4l2Grabber.h.
Frame rate type for capture.
| Enumerator | |
|---|---|
| framerate_50fps | 50 frames per second |
| framerate_25fps | 25 frames per second |
Definition at line 147 of file vpV4l2Grabber.h.
Pixel format type for capture.
| Enumerator | |
|---|---|
| V4L2_GREY_FORMAT | 8 Greyscale |
| V4L2_RGB24_FORMAT | 24 RGB-8-8-8 |
| V4L2_RGB32_FORMAT | 32 RGB-8-8-8-8 |
| V4L2_BGR24_FORMAT | 24 BGR-8-8-8 |
| V4L2_YUYV_FORMAT | 16 YUYV 4:2:2 |
| V4L2_MAX_FORMAT | |
Definition at line 163 of file vpV4l2Grabber.h.
| vpV4l2Grabber::vpV4l2Grabber | ( | ) |
Default constructor.
Setup the Video For Linux Two (V4L2) driver in streaming mode.
Default settings are:
\code vpImage<unsigned char> I; // Grey level image vpV4l2Grabber g; g.setInput(2); // Input 2 on the board g.setWidth(768); // Acquired images are 768 width g.setHeight(576); // Acquired images are 576 height g.setNBuffers(3); // 3 ring buffers to ensure real-time acquisition g.open(I); // Open the grabber g.acquire(I); // Acquire a 768x576 grey image \endcode
The grabber allows also to grab a portion of an image using a region of interest. The following example shows how to grab a 320x240 region located on the top/left corner of the image that has a higher resolution (ie 640x480).
Definition at line 146 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, cap, ctl, DEFAULT_INPUT, DEFAULT_SCALE, device, fd, field, fmt, fmt_me, fmt_v4l2, framerate_25fps, index_buffer, vpFrameGrabber::init, inp, m_frameformat, m_framerate, m_input, m_nbuffers, m_pixelformat, m_verbose, queue, reqbufs, setDevice(), setFramerate(), setInput(), setNBuffers(), setScale(), std, streaming, streamparm, V4L2_FRAME_FORMAT, V4L2_YUYV_FORMAT, vpV4l2Grabber(), and waiton_cpt.
Referenced by open(), operator>>(), operator>>(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
explicit |
Default constructor.
Setup the Video For Linux Two (V4L2) driver in streaming mode.
| verbose | : If true activates the verbose mode. |
Default settings are:
Image size acquisition: vpV4l2Grabber::DEFAULT_SCALE. Use either setScale() or setWidth() and setHeight to change it.
Definition at line 202 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, cap, ctl, DEFAULT_INPUT, DEFAULT_SCALE, device, fd, field, fmt, fmt_me, fmt_v4l2, framerate_25fps, index_buffer, vpFrameGrabber::init, inp, m_frameformat, m_framerate, m_input, m_nbuffers, m_pixelformat, m_verbose, queue, reqbufs, setDevice(), setFramerate(), setInput(), setNBuffers(), setScale(), std, streaming, streamparm, V4L2_FRAME_FORMAT, V4L2_YUYV_FORMAT, vpV4l2Grabber(), and waiton_cpt.
| vpV4l2Grabber::vpV4l2Grabber | ( | unsigned | input, |
| unsigned | scale = vpV4l2Grabber::DEFAULT_SCALE ) |
Constructor.
Setup the Video For Linux Two (V4L2) driver in streaming mode.
| input | : Video input port. |
| scale | : Decimation factor. |
Default settings are:
Framerate acquisition: 25 fps. Use setFramerate() to set 25 fps or 50 fps. These framerates are reachable only if enought buffers are set.
Definition at line 248 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, cap, ctl, DEFAULT_INPUT, device, fd, field, fmt, fmt_me, fmt_v4l2, framerate_25fps, index_buffer, vpFrameGrabber::init, inp, m_frameformat, m_framerate, m_input, m_nbuffers, m_pixelformat, m_verbose, queue, reqbufs, setDevice(), setFramerate(), setInput(), setNBuffers(), setScale(), std, streaming, streamparm, V4L2_FRAME_FORMAT, V4L2_YUYV_FORMAT, vpV4l2Grabber(), and waiton_cpt.
| vpV4l2Grabber::vpV4l2Grabber | ( | vpImage< unsigned char > & | I, |
| unsigned | input, | ||
| unsigned | scale = vpV4l2Grabber::DEFAULT_SCALE ) |
Constructor.
Setup the Video For Linux Two (V4L2) driver in streaming mode.
| I | : Image data structure (grey 8 bits image) |
| input | : Video input port. |
| scale | : Decimation factor. |
Default settings are:
Framerate acquisition: 25 fps. Use setFramerate() to set 25 fps or 50 fps. These framerates are reachable only if enought buffers are set.
Definition at line 294 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, cap, ctl, DEFAULT_INPUT, device, fd, field, fmt, fmt_me, fmt_v4l2, framerate_25fps, index_buffer, vpFrameGrabber::init, inp, m_frameformat, m_framerate, m_input, m_nbuffers, m_pixelformat, m_verbose, open(), queue, reqbufs, setDevice(), setFramerate(), setInput(), setNBuffers(), setScale(), std, streaming, streamparm, V4L2_FRAME_FORMAT, V4L2_YUYV_FORMAT, vpV4l2Grabber(), and waiton_cpt.
| vpV4l2Grabber::vpV4l2Grabber | ( | vpImage< vpRGBa > & | I, |
| unsigned | input, | ||
| unsigned | scale = vpV4l2Grabber::DEFAULT_SCALE ) |
Constructor.
Setup the Video For Linux Two (V4L2) driver in streaming mode.
| I | : Image data structure (Color RGB32 bits image) |
| input | : Video input port. |
| scale | : Decimation factor. |
Default settings are:
Framerate acquisition: 25 fps. Use setFramerate() to set 25 fps or 50 fps. These framerates are reachable only if enought buffers are set.
Definition at line 343 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, cap, ctl, DEFAULT_INPUT, device, fd, field, fmt, fmt_me, fmt_v4l2, framerate_25fps, index_buffer, vpFrameGrabber::init, inp, m_frameformat, m_framerate, m_input, m_nbuffers, m_pixelformat, m_verbose, open(), queue, reqbufs, setDevice(), setFramerate(), setInput(), setNBuffers(), setScale(), std, streaming, streamparm, V4L2_FRAME_FORMAT, V4L2_YUYV_FORMAT, vpV4l2Grabber(), and waiton_cpt.
|
virtual |
Destructor.
Definition at line 365 of file vpV4l2Grabber.cpp.
References vpFrameGrabber::close().
|
virtual |
Acquire a grey level image.
| I | : Image data structure (8 bits image) |
| vpFrameGrabberException::initializationError | : Frame grabber not initialized. |
Implements vpFrameGrabber.
Definition at line 527 of file vpV4l2Grabber.cpp.
References acquire().
Referenced by acquire(), acquire(), acquire(), acquire(), operator>>(), and operator>>().
Acquire a grey level image.
| I | : Image data structure (8 bits image) |
| roi | : Region of interest to grab from the full resolution image. |
| vpFrameGrabberException::initializationError | : Frame grabber not initialized. |
Definition at line 546 of file vpV4l2Grabber.cpp.
References acquire().
| void vpV4l2Grabber::acquire | ( | vpImage< unsigned char > & | I, |
| struct timeval & | timestamp, | ||
| const vpRect & | roi = vpRect() ) |
Acquire a grey level image.
| I | : Image data structure (8 bits image). |
| timestamp | : Timeval data structure providing the unix time at which the frame was captured in the ringbuffer. Warning: some v4l2 drivers do not return the time since 1970 (the one returned by gettimeofday() or vpTime) but rather a time that counts from the boot time (i.e. uptime). |
| roi | : Region of interest to grab from the full resolution image. By default acquire the whole image. |
| vpFrameGrabberException::initializationError | : Frame grabber not initialized. |
Definition at line 572 of file vpV4l2Grabber.cpp.
References vpImageConvert::BGRToGrey(), vpImage< Type >::bitmap, vpFrameGrabber::close(), vpImageTools::crop(), vpRect::getHeight(), vpRect::getWidth(), vpFrameGrabber::height, index_buffer, vpFrameGrabber::init, vpFrameGrabberException::initializationError, m_pixelformat, open(), queueAll(), vpImageConvert::RGBaToGrey(), vpImageConvert::RGBToGrey(), V4L2_BGR24_FORMAT, V4L2_GREY_FORMAT, V4L2_RGB24_FORMAT, V4L2_RGB32_FORMAT, V4L2_YUYV_FORMAT, waiton(), vpFrameGrabber::width, and vpImageConvert::YUYVToGrey().
Acquire a color image.
| I | : Image data structure (32 bits image) |
| vpFrameGrabberException::initializationError | : Frame grabber not initialized. |
Implements vpFrameGrabber.
Definition at line 653 of file vpV4l2Grabber.cpp.
References acquire().
Acquire a color image.
| I | : Image data structure (32 bits image) |
| roi | : Region of interest to grab from the full resolution image. |
| vpFrameGrabberException::initializationError | : Frame grabber not initialized. |
Definition at line 672 of file vpV4l2Grabber.cpp.
References acquire().
| void vpV4l2Grabber::acquire | ( | vpImage< vpRGBa > & | I, |
| struct timeval & | timestamp, | ||
| const vpRect & | roi = vpRect() ) |
Acquire a color image.
| I | : Image data structure (32 bits image). |
| timestamp | : Timeval data structure providing the unix time at which the frame was captured in the ringbuffer. Warning: some v4l2 drivers do not return the time since 1970 (the one returned by gettimeofday() or vpTime) but rather a time that counts from the boot time (i.e. uptime). |
| roi | : Region of interest to grab from the full resolution image. By default acquire the whole image. |
| vpFrameGrabberException::initializationError | : Frame grabber not initialized. |
Definition at line 698 of file vpV4l2Grabber.cpp.
References vpImageConvert::BGRToRGBa(), vpImage< Type >::bitmap, vpFrameGrabber::close(), vpImageTools::crop(), vpRect::getHeight(), vpRect::getLeft(), vpRect::getTop(), vpRect::getWidth(), vpImageConvert::GreyToRGBa(), vpFrameGrabber::height, index_buffer, vpFrameGrabber::init, vpFrameGrabberException::initializationError, m_pixelformat, open(), queueAll(), vpImageConvert::RGBToRGBa(), V4L2_BGR24_FORMAT, V4L2_GREY_FORMAT, V4L2_RGB24_FORMAT, V4L2_RGB32_FORMAT, V4L2_YUYV_FORMAT, waiton(), vpFrameGrabber::width, and vpImageConvert::YUYVToRGBa().
|
pure virtualinherited |
This virtual function is used to de-allocate the memory used by a specific frame grabber
Implemented in vp1394CMUGrabber, vp1394TwoGrabber, vpDirectShowGrabber, vpDiskGrabber, vpFlyCaptureGrabber, vpPylonGrabber, vpPylonGrabberGigE, vpPylonGrabberUsb, and vpVideoReader.
Referenced by vpV4l2Grabber::acquire(), vpV4l2Grabber::acquire(), vpV4l2Grabber::getCapabilities(), vpV4l2Grabber::getField(), vpV4l2Grabber::open(), vpV4l2Grabber::open(), vpV4l2Grabber::setScale(), and vpV4l2Grabber::~vpV4l2Grabber().
| void vpV4l2Grabber::getCapabilities | ( | ) |
Get device capabilities.
| vpFrameGrabberException::otherError | : Can't get video parameters. |
Definition at line 1000 of file vpV4l2Grabber.cpp.
References vpFrameGrabber::close(), fd, fmt, inp, MAX_FORMAT, MAX_INPUTS, MAX_NORM, vpFrameGrabberException::otherError, std, and streamparm.
Referenced by open().
| bool vpV4l2Grabber::getField | ( | ) |
Return the field (odd or even) corresponding to the last acquired frame.
This method is to call after acquire() and has only a mean if the acquisition framerate is set to 50 fps.
| vpFrameGrabberException::otherError | : Video device returns a bad frame field. |
Definition at line 794 of file vpV4l2Grabber.cpp.
References vpFrameGrabber::close(), field, and vpFrameGrabberException::otherError.
| vpV4l2Grabber::vpV4l2FramerateType vpV4l2Grabber::getFramerate | ( | ) |
Return the framerate of the acquisition.
Definition at line 840 of file vpV4l2Grabber.cpp.
References m_framerate.
|
inlineinherited |
Return the number of rows in the image.
Definition at line 109 of file vpFrameGrabber.h.
References height.
|
inline |
Get the pixel format used for capture.
Definition at line 237 of file vpV4l2Grabber.h.
References m_pixelformat.
|
inlineinherited |
Return the number of columns in the image.
Definition at line 111 of file vpFrameGrabber.h.
References width.
| void vpV4l2Grabber::open | ( | ) |
Open the Video For Linux Two device.
| vpFrameGrabberException::initializationError | : Can't access to video device. |
| vpFrameGrabberException::otherError | : Can't query video capabilities. |
Definition at line 893 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, cap, vpFrameGrabber::close(), ctl, device, fd, fmt, getCapabilities(), vpFrameGrabberException::initializationError, inp, m_verbose, MAX_BUFFERS, MAX_CTRL, MAX_FORMAT, MAX_INPUTS, MAX_NORM, vpFrameGrabberException::otherError, std, streamparm, vpERROR_TRACE, and vpV4l2Grabber().
Referenced by acquire(), acquire(), open(), open(), vpV4l2Grabber(), and vpV4l2Grabber().
|
virtual |
Initialize image acquisition in grey format. Set the pixel format acquisition to vpV4l2Grabber::V4L2_GREY_FORMAT.
| I | : Image data structure (8 bits image). Once the device is open, the image is resized to the current acquisition size. |
| vpFrameGrabberException::settingError | : Wrong input channel. |
Implements vpFrameGrabber.
Definition at line 407 of file vpV4l2Grabber.cpp.
References vpFrameGrabber::close(), fd, getPixelFormat(), vpFrameGrabber::height, vpFrameGrabber::init, m_input, m_pixelformat, m_verbose, open(), vpFrameGrabberException::settingError, startStreaming(), V4L2_MAX_FORMAT, and vpFrameGrabber::width.
Initialize image acquisition in color RGB32 format. Set the pixel format acquisition to vpV4l2Grabber::V4L2_RGB32_FORMAT.
| I | : Image data structure (RGB32 bits image). Once the device is open, the image is resized to the current acquisition size. |
Implements vpFrameGrabber.
Definition at line 470 of file vpV4l2Grabber.cpp.
References fd, getPixelFormat(), vpFrameGrabber::height, vpFrameGrabber::init, m_input, m_pixelformat, m_verbose, open(), startStreaming(), V4L2_MAX_FORMAT, and vpFrameGrabber::width.
| vpV4l2Grabber & vpV4l2Grabber::operator>> | ( | vpImage< unsigned char > & | I | ) |
Operator that allows to capture a grey level image.
| I | : The captured image. |
Definition at line 1442 of file vpV4l2Grabber.cpp.
References acquire(), and vpV4l2Grabber().
| vpV4l2Grabber & vpV4l2Grabber::operator>> | ( | vpImage< vpRGBa > & | I | ) |
Operator that allows to capture a grey level image.
| I | : The captured image. |
Definition at line 1464 of file vpV4l2Grabber.cpp.
References acquire(), and vpV4l2Grabber().
| void vpV4l2Grabber::printBufInfo | ( | struct v4l2_buffer | buf | ) |
Get device capabilities.
Definition at line 1397 of file vpV4l2Grabber.cpp.
Referenced by startStreaming(), and stopStreaming().
| void vpV4l2Grabber::queueAll | ( | ) |
Call the queue buffer private method if needed
Definition at line 1380 of file vpV4l2Grabber.cpp.
References queue, queueBuffer(), reqbufs, and waiton_cpt.
Referenced by acquire(), acquire(), and startStreaming().
| int vpV4l2Grabber::queueBuffer | ( | ) |
Capture helpers.
Definition at line 1339 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, fd, vpFrameGrabberException::otherError, queue, reqbufs, and waiton_cpt.
Referenced by queueAll().
|
inline |
Set the device name.
| devname | : Device name (like /dev/video0). |
Definition at line 283 of file vpV4l2Grabber.h.
References device.
Referenced by vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
inline |
Set the pixel format for capture.`If the specified pixel format is out of range, we set the V4L2_RGB24_FORMAT.
| pixelformat | : Camera pixel format coding. |
*/ inline void setPixelFormat(vpV4l2PixelFormatType pixelformat) { this->m_pixelformat = pixelformat; if (this->m_pixelformat >= V4L2_MAX_FORMAT) this->m_pixelformat = V4L2_RGB24_FORMAT; }
void close();
private: void setFormat(); /*! Set the frame format.
| frameformat | :
|
Definition at line 310 of file vpV4l2Grabber.h.
References m_frameformat.
Referenced by setFramerate().
| void vpV4l2Grabber::setFramerate | ( | vpV4l2Grabber::vpV4l2FramerateType | framerate | ) |
Set the frame format depending on the framerate acquisition.
| framerate | : The framerate for the acquisition. |
Definition at line 821 of file vpV4l2Grabber.cpp.
References framerate_25fps, m_framerate, setFrameFormat(), V4L2_FRAME_FORMAT, and V4L2_IMAGE_FORMAT.
Referenced by vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
inline |
Set image height to acquire.
Definition at line 260 of file vpV4l2Grabber.h.
References vpFrameGrabber::height.
Referenced by setScale().
| void vpV4l2Grabber::setInput | ( | unsigned | input = vpV4l2Grabber::DEFAULT_INPUT | ) |
Set the video input port on the board.
Definition at line 370 of file vpV4l2Grabber.cpp.
References m_input.
Referenced by vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
inline |
Set the number of buffers required for streaming data.
For non real-time applications the number of buffers should be set to 1. For real-time applications to reach 25 fps or 50 fps a good compromise is to set the number of buffers to 3.
| nbuffers | : Number of ring buffers. |
Definition at line 275 of file vpV4l2Grabber.h.
References m_nbuffers.
Referenced by vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| void vpV4l2Grabber::setScale | ( | unsigned | scale = vpV4l2Grabber::DEFAULT_SCALE | ) |
Set the decimation factor applied to full resolution images (768x576).
| vpFrameGrabberException::settingError | : Wrong scale (should be between 1 and 16). |
| scale | : Decimation factor. If scale is set to 2, 384x288 images will be acquired. |
An other way to specify the image size is to use setWidth() and setHeight().
Definition at line 384 of file vpV4l2Grabber.cpp.
References vpFrameGrabber::close(), setHeight(), vpFrameGrabberException::settingError, setWidth(), and vpERROR_TRACE.
Referenced by vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
inline |
Activates the verbose mode to print additional information on stdout.
| verbose | : If true activates the verbose mode. |
Definition at line 246 of file vpV4l2Grabber.h.
References m_verbose.
|
inline |
Set image width to acquire.
Definition at line 255 of file vpV4l2Grabber.h.
References vpFrameGrabber::width.
Referenced by setScale().
| void vpV4l2Grabber::startStreaming | ( | ) |
Launch the streaming capture mode and map device memory into application address space.
| vpFrameGrabberException::otherError | : If a problem occurs. |
Definition at line 1160 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, device, fd, fmt, fmt_me, fmt_v4l2, m_nbuffers, m_verbose, vpFrameGrabberException::otherError, printBufInfo(), queueAll(), reqbufs, stopStreaming(), and streaming.
| void vpV4l2Grabber::stopStreaming | ( | ) |
Stops the streaming capture mode and unmap the device memory.
| vpFrameGrabberException::otherError | : if can't stop streaming. |
Definition at line 1227 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, fd, fmt_v4l2, m_verbose, vpFrameGrabberException::otherError, printBufInfo(), queue, reqbufs, streaming, and waiton_cpt.
Referenced by startStreaming().
| unsigned char * vpV4l2Grabber::waiton | ( | __u32 & | index, |
| struct timeval & | timestamp ) |
Fill the next buffer. If all the buffers are filled return NULL.
Update the buffer index. If all the buffers are filled index is set to -1.
| index | : Index in the buffer where image is available. |
| timestamp | : Timeval data structure providing the unix time [microseconds] at which the frame was captured in the ringbuffer. |
| vpFrameGrabberException::otherError | : If can't access to the frame. |
Definition at line 1267 of file vpV4l2Grabber.cpp.
References buf_me, buf_v4l2, fd, field, vpFrameGrabberException::otherError, and waiton_cpt.
| struct ng_video_buf* vpV4l2Grabber::buf_me |
Definition at line 335 of file vpV4l2Grabber.h.
Referenced by open(), queueBuffer(), startStreaming(), stopStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and waiton().
| struct v4l2_buffer* vpV4l2Grabber::buf_v4l2 |
Definition at line 334 of file vpV4l2Grabber.h.
Referenced by open(), queueBuffer(), startStreaming(), stopStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and waiton().
| struct v4l2_capability vpV4l2Grabber::cap |
Definition at line 323 of file vpV4l2Grabber.h.
Referenced by open(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| struct v4l2_queryctrl* vpV4l2Grabber::ctl |
Definition at line 328 of file vpV4l2Grabber.h.
Referenced by open(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
static |
Definition at line 135 of file vpV4l2Grabber.h.
Referenced by vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
static |
Definition at line 136 of file vpV4l2Grabber.h.
Referenced by vpV4l2Grabber(), and vpV4l2Grabber().
| std::string vpV4l2Grabber::device |
Definition at line 321 of file vpV4l2Grabber.h.
Referenced by open(), setDevice(), startStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| int vpV4l2Grabber::fd |
Definition at line 320 of file vpV4l2Grabber.h.
Referenced by getCapabilities(), open(), open(), open(), queueBuffer(), startStreaming(), stopStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and waiton().
| unsigned int vpV4l2Grabber::field |
Definition at line 342 of file vpV4l2Grabber.h.
Referenced by getField(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and waiton().
| struct v4l2_fmtdesc* vpV4l2Grabber::fmt |
Definition at line 327 of file vpV4l2Grabber.h.
Referenced by getCapabilities(), open(), startStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| struct ng_video_fmt vpV4l2Grabber::fmt_me |
Definition at line 332 of file vpV4l2Grabber.h.
Referenced by startStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| struct v4l2_format vpV4l2Grabber::fmt_v4l2 |
Definition at line 331 of file vpV4l2Grabber.h.
Referenced by startStreaming(), stopStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
static |
Definition at line 142 of file vpV4l2Grabber.h.
|
protectedinherited |
Number of rows in the image.
Definition at line 102 of file vpFrameGrabber.h.
Referenced by vp1394TwoGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpFlyCaptureGrabber::acquire(), vpFlyCaptureGrabber::acquire(), vpPylonGrabberGigE::acquire(), vpPylonGrabberGigE::acquire(), vpPylonGrabberUsb::acquire(), vpPylonGrabberUsb::acquire(), vpV4l2Grabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::dequeue(), vp1394TwoGrabber::dequeue(), vpDirectShowGrabber::getFormat(), vpVideoReader::getFrame(), vpVideoReader::getFrame(), vp1394TwoGrabber::getHeight(), vp1394TwoGrabber::getHeight(), getHeight(), vp1394CMUGrabber::open(), vp1394CMUGrabber::open(), vpDiskGrabber::open(), vpDiskGrabber::open(), vpDiskGrabber::open(), vpV4l2Grabber::open(), vpV4l2Grabber::open(), vpDirectShowGrabber::setFormat(), vp1394TwoGrabber::setFormat7ROI(), vpV4l2Grabber::setHeight(), vpDirectShowGrabber::setImageSize(), vp1394CMUGrabber::setVideoMode(), vp1394TwoGrabber::setVideoMode(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394TwoGrabber::vp1394TwoGrabber(), and vpFrameGrabber().
| __u32 vpV4l2Grabber::index_buffer |
index of the buffer in use
Definition at line 338 of file vpV4l2Grabber.h.
Referenced by acquire(), acquire(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
inherited |
Set to true if the frame grabber has been initialized.
Definition at line 99 of file vpFrameGrabber.h.
Referenced by vpV4l2Grabber::acquire(), vpV4l2Grabber::acquire(), vp1394CMUGrabber::close(), vp1394TwoGrabber::close(), vpFlyCaptureGrabber::connect(), vpPylonGrabberGigE::connect(), vpPylonGrabberUsb::connect(), vpFlyCaptureGrabber::disconnect(), vpPylonGrabberGigE::disconnect(), vpPylonGrabberUsb::disconnect(), vpDiskGrabber::open(), vpDiskGrabber::open(), vpDiskGrabber::open(), vpV4l2Grabber::open(), vpV4l2Grabber::open(), vp1394TwoGrabber::resetBus(), vpFlyCaptureGrabber::startCapture(), vpPylonGrabberGigE::startCapture(), vpPylonGrabberUsb::startCapture(), vpFlyCaptureGrabber::stopCapture(), vpPylonGrabberGigE::stopCapture(), vpPylonGrabberUsb::stopCapture(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394TwoGrabber::vp1394TwoGrabber(), vpDiskGrabber::vpDiskGrabber(), vpDiskGrabber::vpDiskGrabber(), vpDiskGrabber::vpDiskGrabber(), vpFrameGrabber(), vpV4l2Grabber::vpV4l2Grabber(), vpV4l2Grabber::vpV4l2Grabber(), vpV4l2Grabber::vpV4l2Grabber(), vpV4l2Grabber::vpV4l2Grabber(), and vpV4l2Grabber::vpV4l2Grabber().
| struct v4l2_input* vpV4l2Grabber::inp |
Definition at line 325 of file vpV4l2Grabber.h.
Referenced by getCapabilities(), open(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| vpV4l2FrameFormatType vpV4l2Grabber::m_frameformat |
Definition at line 347 of file vpV4l2Grabber.h.
Referenced by setFrameFormat(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| vpV4l2FramerateType vpV4l2Grabber::m_framerate |
Definition at line 346 of file vpV4l2Grabber.h.
Referenced by getFramerate(), setFramerate(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| unsigned vpV4l2Grabber::m_input |
Definition at line 345 of file vpV4l2Grabber.h.
Referenced by open(), open(), setInput(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| unsigned vpV4l2Grabber::m_nbuffers |
Definition at line 341 of file vpV4l2Grabber.h.
Referenced by setNBuffers(), startStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| vpV4l2PixelFormatType vpV4l2Grabber::m_pixelformat |
Definition at line 348 of file vpV4l2Grabber.h.
Referenced by acquire(), acquire(), getPixelFormat(), open(), open(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| bool vpV4l2Grabber::m_verbose |
Definition at line 340 of file vpV4l2Grabber.h.
Referenced by open(), open(), open(), setVerboseMode(), startStreaming(), stopStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
|
static |
Definition at line 141 of file vpV4l2Grabber.h.
Referenced by open().
|
static |
Definition at line 140 of file vpV4l2Grabber.h.
Referenced by open().
|
static |
Definition at line 139 of file vpV4l2Grabber.h.
Referenced by getCapabilities(), and open().
|
static |
Definition at line 137 of file vpV4l2Grabber.h.
Referenced by getCapabilities(), and open().
|
static |
Definition at line 138 of file vpV4l2Grabber.h.
Referenced by getCapabilities(), and open().
| unsigned int vpV4l2Grabber::queue |
Definition at line 336 of file vpV4l2Grabber.h.
Referenced by queueAll(), queueBuffer(), stopStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| struct v4l2_requestbuffers vpV4l2Grabber::reqbufs |
Definition at line 333 of file vpV4l2Grabber.h.
Referenced by queueAll(), queueBuffer(), startStreaming(), stopStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| struct v4l2_standard* vpV4l2Grabber::std |
Definition at line 326 of file vpV4l2Grabber.h.
Referenced by getCapabilities(), open(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| bool vpV4l2Grabber::streaming |
Definition at line 343 of file vpV4l2Grabber.h.
Referenced by startStreaming(), stopStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| struct v4l2_streamparm vpV4l2Grabber::streamparm |
Definition at line 324 of file vpV4l2Grabber.h.
Referenced by getCapabilities(), open(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and vpV4l2Grabber().
| unsigned int vpV4l2Grabber::waiton_cpt |
Definition at line 337 of file vpV4l2Grabber.h.
Referenced by queueAll(), queueBuffer(), stopStreaming(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), vpV4l2Grabber(), and waiton().
|
protectedinherited |
Number of columns in the image.
Definition at line 103 of file vpFrameGrabber.h.
Referenced by vp1394TwoGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpDiskGrabber::acquire(), vpFlyCaptureGrabber::acquire(), vpFlyCaptureGrabber::acquire(), vpPylonGrabberGigE::acquire(), vpPylonGrabberGigE::acquire(), vpPylonGrabberUsb::acquire(), vpPylonGrabberUsb::acquire(), vpV4l2Grabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::dequeue(), vp1394TwoGrabber::dequeue(), vpDirectShowGrabber::getFormat(), vpVideoReader::getFrame(), vpVideoReader::getFrame(), vp1394TwoGrabber::getWidth(), vp1394TwoGrabber::getWidth(), getWidth(), vp1394CMUGrabber::open(), vp1394CMUGrabber::open(), vpDiskGrabber::open(), vpDiskGrabber::open(), vpDiskGrabber::open(), vpV4l2Grabber::open(), vpV4l2Grabber::open(), vpDirectShowGrabber::setFormat(), vp1394TwoGrabber::setFormat7ROI(), vpDirectShowGrabber::setImageSize(), vp1394CMUGrabber::setVideoMode(), vp1394TwoGrabber::setVideoMode(), vpV4l2Grabber::setWidth(), vp1394CMUGrabber::vp1394CMUGrabber(), vp1394TwoGrabber::vp1394TwoGrabber(), and vpFrameGrabber().