Page tree
Skip to end of metadata
Go to start of metadata

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.

NameTypeDescription
imageIMAGEJCVThe current frame of the video stream
starttimestampSTARTTIMESTAMPThe start time stamp of the frame. Depends on the timestampmode option, will be omitted when set to 'none'
endtimestampENDTIMESTAMPThe 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

VideoStream Protocol Handler
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)

 

 

  • No labels