Back to Adaptive Vision Library website

You are here: Start » Function Reference » WebCamera » WebCamera_GrabImage

WebCamera_GrabImage


Captures a frame from a camera using Direct Show interface.

Syntax

bool avl::WebCamera_GrabImage
(
	WebCamera_GrabImageState& ioState,
	atl::Optional<int> inCameraIndex,
	atl::Optional<avl::Size> inFrameSize,
	avl::Image& outFrame
)

Parameters

Name Type Range Default Description
ioState WebCamera_GrabImageState& Object used to maintain state of the function.
inCameraIndex Optional<int> 0 - + NIL Index number of camera device to connect with
inFrameSize Optional<Size> NIL Requested size of source frame in pixels selected from camera output formats
outFrame Image& Captured frame

Description

Filter uses DirectDraw API to acquire images from devices registered in system. Images can be acquired from many sources like: web cameras with support for DirectDraw, video grabbers and system video streams.

Input inCameraIndex selects device in order provided by the operational system.

Input inFrameSize selects output image size in pixels. If an image in requested size is not available an error occurs. If value of inFrameSize is not provided filter returns image with first available size found.

Remarks

Filter WebCamera_GrabImage reads only data from input type MEDIASUBTYPE_RGB24.

Multithreaded environment

This function is not guaranteed to be thread-safe. When used in multithreaded environment, it has to be manually synchronized.

Errors

"Unable to connect with chosen Web Camera." - error will occur when provided inCameraIndex is not valid device number.

"Unable to connect with media type of Web Camera. Required image format may not be supported. " - selected inFrameSize is not supported by selected device.