The OpenCVVideoStream protocol handler allows reading and receiving video data. It offers a lot less functionality than the FFmpeg handler, but it can access DirectShow cameras. It uses the OpenCV Java port of JavaCV and is available in the video feature.
Options
See FFmpegVideoStream protocol handler. Offers access to DirectShow cameras using the streamurl option with "camera://<x>", where <x> is the number of the attached camera (for example "camera://0" for the first available camera on the system).
Schema
The output of the handler provides the following attributes as a schema. Attributes can be in arbitrary order and will be identified by the type.
Name | Type | Description |
---|---|---|
image | IMAGEJCV | The current frame of the video stream |
starttimestamp | STARTTIMESTAMP | The start time stamp of the frame. Depends on the timestampmode option, will be omitted when set to 'none' |
endtimestamp | ENDTIMESTAMP | The end time stamp of the frame. Depends on the timestampmode option, will be omitted when set to 'none' |
Example
This example shows how to grab a video from a webcam and display it in a window:
PQL
video = ACCESS({source='Video', wrapper='GenericPull', transport='none', protocol='OpenCVVideoStream', datahandler='Tuple', options=[ ['streamUrl', 'camera://0'], ['timeStampMode', 'none'] ], schema= [ ['image', 'IMAGEJCV'] ]}) /// or shorter, as a source operator: video = OPENCVVIDEO({source='Video', options=[['streamUrl', 'camera://0'], ['timeStampMode', 'none']]}) output = UDO({class='ShowImageJCV', init='0,Video'}, video)