Detailed Description

A wrapper class for Video4Linux APIs.

V4LCamera class provides an interface to Video4Linux devices. Any camera that supports Video4Linux can be accessed through this class.

Warning:

V4LCamera exploits multiple memory maps if avalable. In other words, you may experience significant time delay if data is not processed fast enough. If it happens, reduce max_frames in the constructor.

Constructor & Destructor Documentation

bj::V4LCamera::V4LCamera

(

const char

device[] = "/dev/video0",

int

width = 320,

int

height = 240,

int

channel = -1,

bool

color = true,

int

max_frames = 1

)

A constructor.

Open a video device, and initialize the device using default values.

Parameters:

device

The video device name.

width

The width of input images.

height

The height of input images.

channel

An input channel. If the value is negative, the first camera-type channel will be probed.

color

The depth of input images. If true, input images will have three-layers (RGB). Otherwise, they will have a single layer, which is gray-scale.

max_frames

The maximum number of memory-map frames to be used. If negative, all available frames will be used.

A captured image format. If true, it returns a PNM image. Otherwise, it returns pixel data only in BGR or gray-scale format.

copy

A memory allocation scheme. If true, the function allocate a new memory block to store an image. A user is responsible for releasing the memory block later. Otherwise, it returns an internal memory block, which is not suppposed to be freed by a user.

This is the color depth of final (possibly converted) images. If a user requests a gray-scale image and the capture device supports only a color image, then a captured color image is converted internally into a gray-scale image. In this case, the return value of the function is 1, not 3.