V4L2Input

Input object reading images from a V4L2-capable device.

Inherits

See also

Summary
V4L2InputInput object reading images from a V4L2-capable device.
Constants
Control typesConstants denoting different types of controls.
Camera featuresConstants for accessing the different features of the camera.
Properties
widthGet width of images.
heightGet height of images.
Functions
V4L2Input.newConstructor.
inspectReturn string with information about this object.
closeClose the device.
readRead an image.
status?Indicates whether the device is still open.
feature_exist?Check whether a certain feature is supported by the camera.
feature_readRead the value of a feature.
feature_writeChange the value of a feature.
feature_typeType of feature.
feature_nameName of feature.
feature_minGet lower boundary of feature value.
feature_maxGet upper boundary of feature value.
feature_stepGet step size for feature value.
feature_default_valueGet default value for feature.

Constants

Control types

Constants denoting different types of controls.

See also

V4L2_CTRL_TYPE_INTEGERInteger control
V4L2_CTRL_TYPE_BOOLEANBoolean control
V4L2_CTRL_TYPE_MENUMenu of choices
V4L2_CTRL_TYPE_BUTTONControl performing an action
V4L2_CTRL_TYPE_CTRL_CLASSID is a control class code

Camera features

Constants for accessing the different features of the camera.

See also

V4L2_CID_BASEfirst feature
V4L2_CID_USER_BASEfirst standard feature
V4L2_CID_PRIVATE_BASEfirst private feature
V4L2_CID_BRIGHTNESSpicture brightness
V4L2_CID_CONTRASTpicture contrast
V4L2_CID_SATURATIONpicture colour saturation
V4L2_CID_HUEcolour balance
V4L2_CID_AUDIO_VOLUMEaudio volumen
V4L2_CID_AUDIO_BALANCEaudio stereo balance
V4L2_CID_AUDIO_BASSaudio bass adjustment
V4L2_CID_AUDIO_TREBLEaudio treble adjustment
V4L2_CID_AUDIO_MUTEmute audio
V4L2_CID_AUDIO_LOUDNESSbass boost
V4L2_CID_BLACK_LEVELsame as brightness?
V4L2_CID_AUTO_WHITE_BALANCEautomatic white balance
V4L2_CID_DO_WHITE_BALANCEperform a single white balance
V4L2_CID_RED_BALANCEred chroma balance
V4L2_CID_BLUE_BALANCEblue chroma balance
V4L2_CID_GAMMAgamma adjustment
V4L2_CID_WHITENESSwhiteness (same as gamma)
V4L2_CID_EXPOSUREexposure
V4L2_CID_AUTOGAINautomatic gain/exposure
V4L2_CID_GAINgain control
V4L2_CID_HFLIPmirror picture horizontally
V4L2_CID_VFLIPmirror picture vertically
V4L2_CID_HCENTERphysical horizontal image centering
V4L2_CID_VCENTERphysical vertical image centering
V4L2_CID_LASTP1ID of last standard control + 1

Properties

width

Get width of images.

height

Get height of images.

Functions

V4L2Input.new

def V4L2Input.new(device =  "/dev/video0",
width =  -1,
height =  -1,
preferredColourSpace =  '')

Constructor.

Parameters

deviceFilename of input device.
widthPreferred width (-1 for maximum width).
heightPreffered height (-1 for maximum height).
preferredColourSpacePreferred colourspace.  Colourspaces supported by HornetsEye are UBYTERGB, YUY2, UYVY, I420, MJPG and UBYTE.  Specify ‘’ for automatic selection.

inspect

def inspect

Return string with information about this object.

Returns

Something like this: “V4LInput( \”/dev/video0\” )”

close

def close

Close the device.

read

def read

Read an image.

Returns

An object of type Frame_ or Sequence_

status?

def status?

Indicates whether the device is still open.

feature_exist?

def feature_exist?(feature)

Check whether a certain feature is supported by the camera.

Parameters

featureindex of feature

Returns

A boolean

feature_read

def feature_read(feature)

Read the value of a feature.

Note that not all features are readable.

Parameters

featureindex of feature

Returns

Current value of feature

feature_write

def feature_write(feature,
value)

Change the value of a feature.

Note that some features may not exist on the camera.

Parameters

featureindex of feature
valuenominal value of feature

feature_type

def feature_type(feature)

Type of feature.

Parameters

featureindex of feature

Returns

Type of feature

See also

feature_name

def feature_name(feature)

Name of feature.

Parameters

featureindex of feature

Returns

Name of feature

feature_min

def feature_min(feature)

Get lower boundary of feature value.

Parameters

featureindex of feature

Returns

Minimum value of feature

feature_max

def feature_max(feature)

Get upper boundary of feature value.

Parameters

featureindex of feature

Returns

Maximum value of feature

feature_step

def feature_step(feature)

Get step size for feature value.

Parameters

featureindex of feature

Returns

Step size for feature value

feature_default_value

def feature_default_value(feature)

Get default value for feature.

Parameters

featureindex of feature

Returns

Default value for feature value

def V4L2Input.new(device =  "/dev/video0",
width =  -1,
height =  -1,
preferredColourSpace =  '')
Constructor.
def inspect
Return string with information about this object.
def close
Close the device.
def read
Read an image.
def status?
Indicates whether the device is still open.
def feature_exist?(feature)
Check whether a certain feature is supported by the camera.
def feature_read(feature)
Read the value of a feature.
def feature_write(feature,
value)
Change the value of a feature.
def feature_type(feature)
Type of feature.
def feature_name(feature)
Name of feature.
def feature_min(feature)
Get lower boundary of feature value.
def feature_max(feature)
Get upper boundary of feature value.
def feature_step(feature)
Get step size for feature value.
def feature_default_value(feature)
Get default value for feature.
Base class for different types of input sources for images.
HornetsEye allows you to capture images using a V4L-capable (video for linux) device (for example a USB webcam).
24-bit unsigned RGB-triplet
YUY2 data
UYVY data
I420 data
Motion JPEG data
8-bit signed integer
This class provides fast (multi-dimensional) Ruby arrays where all elements are of the same type.
Constants denoting different types of controls.
Close