Back to Aurora Vision Library website

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

WebCamera_GrabImage


Header: ThirdPartySdk.h
Namespace: avl
Module: ThirdParty

Captures a frame from a camera using Direct Show interface.

Applications: Not recommended for industrial operation.

Syntax

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

Parameters

Name Type Range Default Description
Input will be modified ioState WebCamera_GrabImageState& Object used to maintain state of the function.
Input value inCameraIndex Optional<int> 0 - + NIL Index number of camera device to connect with
Input value inFrameSize Optional<Size> NIL Requested size of source frame in pixels selected from camera output formats
Input value inPixelType WebCameraInputFormat::Type Any Requested specific pixel type from camera (may change image quality)
Output value outFrame Image& Captured frame

Description

Filter uses DirectShow API to acquire images from devices registered in system. Images can be acquired from many sources like: web cameras with support for DirectShow , 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

Best quality of images can be achieved using inPixelType with values RGB24 or RGB32. Format YUY2 stores two RGB pixels using only 4 bytes.

To check which pixel types are supported you can use application GraphStudioNext

.

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.