Classes and functions to manage video streams and present them as images. More...
|exposes the V4L2 API to set parameters on a capture device. More...|
|template<class T >|
|VideoBuffer< T > *||CVD::open_video_source (std::istream &in)|
|template<class T >|
|VideoBuffer< T > *||CVD::open_video_source (const std::string &src)|
Classes and functions to manage video streams and present them as images.
|VideoBuffer<T>* CVD::open_video_source||(||std::istream &||in||)|
|VideoBuffer< T > * CVD::open_video_source||(||const std::string &||src||)|
opens a video device described by a video source url.
This allows to decide at runtime what kind of video input your program is using. Basic use is to call open_video_source<T>(url) to get a VideoBuffer<T>*.
In many cases, the VideoBuffer returned by open_video_source() is a wrapper around the video buffer dealing with the hardware and so does not provide access to the controls. The underlying buffer can be accessed with VideoBuffer::root_buffer().
Threre are also several pseudo buffers (such as deinterlacing and colorspace conversion) which are chained to other buffers by taking a URL as an argument.
The url syntax is the following:
url := protocol ':' [ '[' options ']' ] // identifier protocol := "files" | "file" | "v4l2" | "v4l1" | "jpegstream" | "dc1394" | "qt" | "colourspace" | "deinterlace" options := option [ ',' options ] option := name [ '=' value ]
identifier and values can be quoted literals with escapes, all other text is unquoted. Some Examples:
Open a DiskBuffer2 for *.pgm in /local/capture/:
files:[read_ahead=40, fps=30, on_end=loop]///local/capture/ *.pgm
Open a V4L2 device at /dev/video0:
Open a V4L2 device with fields on input 2:
Open firewire camera 1 with the default fps:
Open firewire camera 1, capturing in YUV411, at 30fps: colourspace:[from=yuv411]//dc1394:[fps=30]//1
Open an avi file relative to the current directory:
Open the first QuickTime camera and show the settings dialog
Open an HTTP camera. First create a named pipe from the shell, and start grabbing video:
mkfifo /tmp/video wget http//my.camera/file_representing_video -O /tmp/video
then open a source with:
If the argument is provided from a shell such as BASH, then then redirection can be used:
jpegstream://<(wget http//my.camera/file_representing_video -O - )
Fields are: bool = true | yes | 1 ! false | no | 0 offset = <width>x<height> size = <offset> | qvga | vga | pal | ntsc | xga
Options supported by the various protocols are:
'files' protocol (DiskBuffer2): identifier is glob pattern fps = <number> read_ahead [= <number>] (default is 50 if specified without value) on_end = repeat_last | unset_pending | loop (default is repeat_last) 'file' protocol (VideoFileBuffer): identifier is path to file read_ahead [= <number>] (default is 50 if specified without value) on_end = repeat_last | unset_pending | loop (default is repeat_last) 'v4l1' protocol (V4L1Buffer): identifier is device name size = <size> (default is 0x0) 'v4l2' protocol (V4LBuffer): identifier is device name size = <size> (default vga) input = <number> interlaced | fields [= <bool> ] verbose [ = <bool> ] 'dc1394' protocol (DVBuffer): identifier is camera number fps = <number> (default is camera default) size = <size> offset = <offset> verbose [ = <bool> ] reset [ = <bool> ] mode | format7 | format7_mode = <number> 'qt' protocol (QTBuffer): identifier is camera number size = vga | qvga | <width>x<height> (default vga) showsettings [ = <bool> ] (default 0) verbose [ = <bool> ] (default 0) 'jpegstream' protocol (ServerPushJpegBuffer): identifier is path to file read_ahead [= <number>] (default is 50 if specified without value) 'deinterlace' protcol (DeinterlaceBuffer): identifier is a video URL oddonly [ = <bool> ] evenonly [ = <bool> ] oddeven [ = <bool> ] (default) evenodd [ = <bool> ] double [ = <bool> ] (perform line doubling by averaging) 'colourspace' protcol (ColourspaceBuffer): identifier is a video URL from = byte | mono | gray | grey | yuv411 | yuv422 | rgb<byte> | rgb | bayer_bggr | bayer_gbrg | bayer_grbg | bayer_rggb (default mono)