1.17. OpenCVGrabber

Summary:

OpenCV Video Capture (USB-Cams, Firewire CMU1394…)

Type:

DataIO

License:

licensed under LGPL

Platforms:

Windows, Linux

Devices:

USB Plug&Play Cameras and further cameras supported by OpenCV

Author:

M. Gronle, ITO, University Stuttgart

1.17.1. Overview

This plugin wraps the video capture framework of OpenCV. Therefore it requires further libraries of OpenCV (core, highgui, improc and partially tbb).

Usually all ordinary USB cameras are supported. If you compiled OpenCV with the CMU1384 flag, these firewire cameras are supported as well. Currently, a queuing problem in the Windows version for USB cameras exists. Therefore the plugin requests multiple images per frame in order to finally get the newest one. Therefore this implementation is not the fastest connection to any USB cameras.

Some supported cameras are only available if OpenCV is compiled with their support, e.g. CMU1394 (not included per default in pre-compiled binaries of OpenCV.

The parameters of this plugin are double values that are directly redirected to the OpenCV drivers and might have different units / interpretations for various device types. Especially for DirectShow cameras, also use the native settings dialog (accessible via the configuration dialog) to further parameterize the plugin, especially set the manual / auto flag of parameters (not directly available via source code of OpenCV).

For some devices, an acquisition might deliver an older image. In order to get an actual image, use the parameter ‘dump_grabs’ to set a number of images that is obtained before the real image is delivered to the getVal / copyVal command (default: 0, DirectShow: recommended: 5).

1.17.2. Initialization

The following parameters are mandatory or optional for initializing an instance of this plugin:

  • cameraNumber: int, optional

    consecutive number of the connected camera (starting with 0, default)

    Value range: [0, 999], Default: 0

  • colorMode: str, optional

    color mode of camera (auto|color|red|green|blue|gray, default: auto -> color or gray)

    Match: [“auto”, “color”, “red”, “green”, “blue”, “gray”], Default: “auto”

  • filename: str, optional

    optional filename for the CVGrabber. If this is given, cameraNumber is ignored

    default: “”

1.17.3. Parameters

An instance of this plugin has the following parameters:

backlightCompensation: float

backlightCompensation [0..1]

Value range: [0:0.5:1], Default: 0.5

backlightCompensationAuto: int

auto-controlled backlightCompensation (on:1, off:0)

Value range: [0, 1], Default: 0

bpp: int

bpp

Value range: [8, 8], Default: 8

brightness: float

brightness [0..1]

Value range: [0:0.00392157:1], Default: 0.501961

brightnessAuto: int

auto-controlled brightness (on:1, off:0)

Value range: [0, 1], Default: 0

colorMode: str

color mode of camera (auto|color|red|green|blue|gray, default: auto -> color or gray)

Match: [“auto”, “color”, “red”, “green”, “blue”, “gray”], Default: “auto”

contrast: float

contrast [0..1]

Value range: [0:0.00392157:1], Default: 0.12549

contrastAuto: int

auto-controlled contrast (on:1, off:0)

Value range: [0, 1], Default: 0

deviceName: str, read-only

name of device

gamma: float

gamma [0..1]

Value range: [0:0.0166667:1], Default: 0.5

gammaAuto: int

auto-controlled gamma (on:1, off:0)

Value range: [0, 1], Default: 0

hue: float

hue [0..1]

Value range: [0:0.00277778:1], Default: 0.5

hueAuto: int

auto-controlled hue (on:1, off:0)

Value range: [0, 1], Default: 0

integrationTime: float

Integrationtime of CCD in seconds

Value range: [0.000244141, 0.125], Default: 0.015625

integrationTimeAuto: int

auto-controlled integration time of CCD (on:1, off:0)

Value range: [0, 1], Default: 1

name: str, read-only

name of the plugin

roi: Tuple[int,int,int,int] (rect [x0,y0,width,height])

ROI (x,y,width,height) [this replaces the values x0,x1,y0,y1]

Height: Value range: [0, 719], Default: [0, 0, 1280, 720]

saturation: float

saturation [0..1]

Value range: [0:0.01:1], Default: 0.64

saturationAuto: int

auto-controlled saturation (on:1, off:0)

Value range: [0, 1], Default: 0

sharpness: float

sharpness [0..1]

Value range: [0:0.142857:1], Default: 0

sharpnessAuto: int

auto-controlled sharpness (on:1, off:0)

Value range: [0, 1], Default: 0

sizex: int, read-only

width of ROI (x-direction)

Value range: [1, 1280], Default: 1280

sizey: int, read-only

height of ROI (y-direction)

Value range: [1, 720], Default: 720

whiteBalance: float

whiteBalance [0..1]

Value range: [0:0.0027027:1], Default: 0.486486

whiteBalanceAuto: int

auto-controlled whiteBalance (on:1, off:0)

Value range: [0, 1], Default: 1

x0: int

first pixel index in ROI (x-direction)

Value range: [0, 1279], Default: 0

x1: int

last pixel index in ROI (x-direction)

Value range: [0, 1279], Default: 1279

y0: int

first pixel index in ROI (y-direction)

Value range: [0, 719], Default: 0

y1: int

last pixel index in ROI (y-direction)

Value range: [0, 719], Default: 719

zoom: float

zoom [0..1]

Value range: [0:0.0333333:1], Default: 0

zoomAuto: int

auto-controlled zoom (on:1, off:0)

Value range: [0, 1], Default: 0