42#ifndef vpV4l2Grabber_hh
43#define vpV4l2Grabber_hh
45#include <visp3/core/vpConfig.h>
50#include <linux/videodev2.h>
53#include <visp3/core/vpFrameGrabber.h>
54#include <visp3/core/vpImage.h>
55#include <visp3/core/vpRGBa.h>
56#include <visp3/core/vpRect.h>
150 } vpV4l2FramerateType;
158 } vpV4l2FrameFormatType;
170 } vpV4l2PixelFormatType;
172#ifndef DOXYGEN_SHOULD_SKIP_THIS
173 struct ng_video_fmt {
174 unsigned int pixelformat;
177 unsigned int bytesperline;
180 struct ng_video_buf {
181 struct ng_video_fmt fmt;
212 explicit vpV4l2Grabber(
bool verbose);
216 virtual ~vpV4l2Grabber();
219 void open(vpImage<unsigned char> &I);
220 void open(vpImage<vpRGBa> &I);
222 void acquire(vpImage<unsigned char> &I);
223 void acquire(vpImage<unsigned char> &I,
const vpRect &roi);
224 void acquire(vpImage<unsigned char> &I,
struct timeval ×tamp,
const vpRect &roi = vpRect());
225 void acquire(vpImage<vpRGBa> &I);
226 void acquire(vpImage<vpRGBa> &I,
const vpRect &roi);
227 void acquire(vpImage<vpRGBa> &I,
struct timeval ×tamp,
const vpRect &roi = vpRect());
229 vpV4l2FramerateType getFramerate();
247 void setFramerate(vpV4l2FramerateType framerate);
292 inline void setPixelFormat(vpV4l2PixelFormatType pixelformat)
294 this->m_pixelformat = pixelformat;
295 if (this->m_pixelformat >= V4L2_MAX_FORMAT)
296 this->m_pixelformat = V4L2_RGB24_FORMAT;
312 void getCapabilities();
313 void startStreaming();
314 void stopStreaming();
315 unsigned char *waiton(__u32 &index,
struct timeval ×tamp);
318 void printBufInfo(
struct v4l2_buffer buf);
323 struct v4l2_capability
cap;
326 struct v4l2_standard *
std;
328 struct v4l2_queryctrl *
ctl;
virtual void open(vpImage< unsigned char > &I)=0
unsigned int height
Number of rows in the image.
unsigned int width
Number of columns in the image.
virtual void acquire(vpImage< unsigned char > &I)=0
Definition of the vpImage class member functions.
Class that is a wrapper over the Video4Linux2 (V4L2) driver.
void setFrameFormat(vpV4l2FrameFormatType frameformat)
@ framerate_50fps
50 frames per second
@ framerate_25fps
25 frames per second
void setWidth(unsigned w)
static const __u32 MAX_NORM
vpV4l2FrameFormatType m_frameformat
__u32 index_buffer
index of the buffer in use
static const unsigned int MAX_CTRL
static const unsigned int MAX_BUFFERS
static const __u32 MAX_INPUTS
vpV4l2PixelFormatType m_pixelformat
void setVerboseMode(bool verbose)
vpV4l2PixelFormatType getPixelFormat()
static const unsigned int FRAME_SIZE
struct v4l2_format fmt_v4l2
vpV4l2FramerateType m_framerate
struct v4l2_queryctrl * ctl
struct v4l2_capability cap
static const unsigned int DEFAULT_SCALE
static const unsigned int DEFAULT_INPUT
struct v4l2_buffer * buf_v4l2
static const __u32 MAX_FORMAT
struct v4l2_fmtdesc * fmt
struct v4l2_requestbuffers reqbufs
void setHeight(unsigned h)
struct v4l2_streamparm streamparm
struct v4l2_standard * std
void setNBuffers(unsigned nbuffers)
struct ng_video_buf * buf_me
void setDevice(const std::string &devname)
struct ng_video_fmt fmt_me