Image Acquisition Interface for DirectShow

Interface: DirectShow
Revision: 18.11.5
Date: 2020-10-27

General

This page provides the documentation about the HALCON DirectShow image acquisition interface for the Microsoft DirectShow application programming interface. Registered customers can download the latest revision of this interface from the MVTec WWW server.

System Requirements

Interface Versioning

MVTec interfaces for digital I/O and image acquisition are always compatible to a range of HALCON versions. Therefore, the versioning scheme both describes the compatibility of the interface and also the revision of the interface itself. An interface version always consists of three numbers, separated by dots, i.e. 18.11.5. The first two numbers describe the minimum HALCON version the interface is compatible with. For the example version 18.11.5 this means that the interface is compatible with all HALCON versions since HALCON 18.11. The last number describes the revision of the interface, in this example this is revision 5.

Installation

Only when installing or updating the interface manually follow these steps:

Features

Limitations

Parameters for info_framegrabber

Parameter Value List Type Kind Description
'bits_per_channel' [] Unused.
'camera_type' [] string pre-defined Unused.
'color_space' ['gray', 'rgb'] string pre-defined Values for color space.
'defaults' [1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1.0, 'false', 'default', '0', -1, 1] mixed pre-defined Default values for open_framegrabber.
'device' ['[[<index>]] <device_name>'] string dynamic List of available device IDs. The device ID is formed by the index of the device and the device name. This is necessary to use multiple devices with the same device name. name.
'external_trigger' ['false', 'true'] string pre-defined Values for the external trigger.
'field' [] Unused.
'general' [] string pre-defined Information about the HALCON DirectShow interface.
'generic' [] Unsupported query.
'horizontal_resolution' 1 integer pre-defined Value list for horizontal resolution.
'image_height' [] Unsupported query.
'image_width' [] Unsupported query.
'info_boards' ['device:<device index> port:<port number> camera_type:<camera type>'] string dynamic A list of available devices with corresponding ports and camera types, i.e. formats with resolution.
'parameters' ['<parameters>'] string pre-defined Pre-defined parameters of the HALCON interface.
'parameters_readonly' ['<parameters>'] string pre-defined Pre-defined read-only parameters of the HALCON interface.
'parameters_writeonly' ['<parameters>'] string pre-defined Pre-defined write-only parameters of the HALCON interface.
'port' -1 integer pre-defined Returns the values for port.
'revision' '<revision>' string pre-defined Revision number of the DirectShow interface.
'start_column' [] Unsupported query.
'start_row' [] Unsupported query.
'vertical_resolution' 1 integer pre-defined Value list for vertical resolution.

Parameters for open_framegrabber

Parameter Values Default Type Description
Name 'DirectShow' string Name of the HALCON interface.
HorizontalResolution --- Ignored.
VerticalResolution --- Ignored.
ImageWidth --- Ignored.
ImageHeight --- Ignored.
StartRow --- Ignored.
StartColumn --- Ignored.
Field --- Ignored.
BitsPerChannel --- Ignored.
ColorSpace 'gray', 'rgb' 'rgb' string Desired color space and thus the number of image channels of the resulting HALCON image.
Generic --- Ignored.
ExternalTrigger 'false', 'true' 'false' string Status of the external trigger.
CameraType '[[<index>]] [<video norm>] <type> (<widthxheight>)', 'default' 'default' string The desired video format, e.g., 'NTSC RGB24 (640x480)'.
  • [index] is used to allow a mapping of the available devices to the available formats, this is especially useful if more than one device is connected, this parameter can be omitted.
  • video norm can be one of the following: 'PAL', 'NTSC'. video norm is omitted, if the device does not support analog video.
  • type can be one of the following: RGB8, RGB555, RGB565, RGB24, RGB32, Y800, UYVY, Y411, Y41P or Y16. Other formats like mjpg, yuv or unknown ones, which are displayed using their GUID, might work if all necessary codecs are available.
  • width and height specify the used image dimensions.
Alternatively, you can pass 'default'. Then the first generally acceptable video format that the capture device proposes is chosen.

Note that when the video source (i.e., the capture device) and the video destination (i.e., the HALCON DirectShow interface) do not agree on a video format, DirectShow automatically tries to establish a connection via a transformation filter (e.g., a codec). This behavior is used by the HALCON DirectShow interface for all unsupported formats or if you specify 'default'.

Additionally, type can also be a four-character code (FOURCC). In that case, the output data of the capture device is decoded by a suitable codec, which, of course, has to be installed properly (see also Microsoft DirectShow documentation: Working with Codecs).
Attention: MVTec does by no means encourage the use of FOURCC video formats, and also does not guarantee that the HALCON DirectShow interface works correctly with all FOURCC video formats. To obtain the available FOURCC video formats you have to use, e.g., the Microsoft amcap.exe example application.
Device '0', '1', '2', ..., '9', '[[<index>]] <device name>', 'default' '0' string The index of the capture device (passed as a string!). Alternatively, you can pass the name of the capture device as it is returned by info_framegrabber(..., 'info_boards', ...). Note that it is sufficient to provide only the beginning of this string, the device which matches first is then used.
Port <port> -1 integer Number of the capture device's output pin as it is returned by get_framegrabber_param(..., 'available_pins', ...). If you pass -1, the system automatically selects a suitable pin.
LineIn --- Ignored.

Parameters for set_framegrabber_param

Note that most of the following parameters (and also the valid parameter values!) depend on the capabilities of the used capture device and/or connected camera.
Many parameters (like 'brightness' and 'white_balance') can be set by either a valid integer value or by specifying one of the following strings:
Parameter Values Default Type Description
'backlight_compensation' 'off', 'on' string Backlight compensation. If the capture device does not support backlight compensation, H_ERR_FGPARAM is returned.
'brightness' <brightness>, 'auto' mixed Brightness. 'auto' indicates that the brightness is adjusted automatically. If the capture device does not support brightness adjustment, H_ERR_FGPARAM is returned.
'color_enable' 'off', 'on' string Color enable. If the capture device does not support color enable, H_ERR_FGPARAM is returned.
'connector' <number> integer Physical connector. If the capture device does not support physical connectors, H_ERR_FGPARAM is returned. A list of the available physical connectors can be obtained by calling get_framegrabber_param(..., 'available_connectors', ...).
'contrast' <contrast>, 'auto' mixed Contrast. 'auto' indicates that the contrast is adjusted automatically. If the capture device does not support contrast adjustment, H_ERR_FGPARAM is returned.
'disconnect_graph' 'false', 'true' 'false' string Activate/deactivate automatic disconnection of the filter graph when setting camera parameters. By default (i.e. upon opening of the capture device) the filter graph stays connected while setting camera parameters to speed up the execution of set_framegrabber_param. Note, however, that numerous capture devices do not allow the setting of camera parameters while the filter graph is still connected. The behaviour of such devices is not predictable and might range from simply ignoring the new settings to crashes of your application! For these devices you must set 'disconnect_graph' to 'true' before setting parameters.
'do_force_trigger' --- Forces an event trigger from the application, when using the external trigger. This might be useful for testing purposes.
'do_open_dialog' <dialog> string Opens a dialog (property page) provided by the capture device. If the capture device does not support the specified (or any) dialog, H_ERR_FGPARAM is returned. A list of the available dialogs can be obtained by calling get_framegrabber_param(..., 'available_dialogs', ...).
'do_stop_grabbing' --- Stops the continuous grabbing of images. Note that stopping of grabbing inevitably results in the termination of the capture thread (and restarting grabbing in creating a new one respectively), which is a rather time consuming operation and might slow down your application considerably!
'exposure' <exposure>, 'auto' mixed Exposure time. 'auto' indicates that the exposure time is adjusted automatically. If the capture device does not support the setting of the exposure time, H_ERR_FGPARAM is returned.
'external_trigger' 'false', 'true' string Status of the external trigger.
'flip_horizontal' 'false', 'true' string Horizontal image flipping. If the capture device does not support horizontal flipping, H_ERR_FGPARAM is returned.
'flip_vertical' 'false', 'true' string Vertical image flipping. If the capture device does not support vertical flipping, H_ERR_FGPARAM is returned.
'focus' <focus>, 'auto' mixed Focus. 'auto' indicates that the focus is adjusted automatically. If the capture device does not support focus adjustment, H_ERR_FGPARAM is returned.
'frame_rate' 0.0 ... 60.0 15.0 float Desired frame rate in frames per second (as a float value!). A list of available frame rates can be obtained by calling get_framegrabber_param(..., 'available_frame_rates', ...).
'gamma' <gamma>, 'auto' mixed Gamma. 'auto' indicates that the gamma is adjusted automatically. If the capture device does not support gamma adjustment, H_ERR_FGPARAM is returned.
'grab_timeout' <milliseconds> 5000 integer Desired timeout (milliseconds) for aborting a pending grab. If -1 is specified, the timeout is set to INFINITE.
'hue' <hue>, 'auto' mixed Hue. 'auto' indicates that the hue is adjusted automatically. If the capture device does not support hue adjustment, H_ERR_FGPARAM is returned.
'iris' <iris>, 'auto' mixed Iris. 'auto' indicates that the iris is adjusted automatically. If the capture device does not support iris adjustment, H_ERR_FGPARAM is returned.
'pan' <pan>, 'auto' mixed Pan. 'auto' indicates that the pan setting is adjusted automatically. If the capture device does not support pan setting, H_ERR_FGPARAM is returned.
'roll' <roll>, 'auto' mixed Roll. 'auto' indicates that the roll setting is adjusted automatically. If the capture device does not support roll setting, H_ERR_FGPARAM is returned.
'saturation' <saturation>, 'auto' mixed Saturation. 'auto' indicates that the saturation is adjusted automatically. If the capture device does not support saturation adjustment, H_ERR_FGPARAM is returned.
'sharpness' <sharpness>, 'auto' mixed Sharpness. 'auto' indicates that the sharpness is adjusted automatically. If the capture device does not support sharpness adjustment, H_ERR_FGPARAM is returned.
'tilt' <tilt>, 'auto' mixed Tilt. 'auto' indicates that the tilt setting is adjusted automatically. If the capture device does not support tilt setting, H_ERR_FGPARAM is returned.
'video_gain' <gain>, 'auto' mixed Gain. 'auto' indicates that the gain is adjusted automatically. If the capture device does not support gain adjustment, H_ERR_FGPARAM is returned.
'white_balance' <white_balance>, 'auto' mixed White balance. 'auto' indicates that the white balance is adjusted automatically. If the capture device does not support white balance adjustment, H_ERR_FGPARAM is returned.
'zoom' <zoom>, 'auto' mixed Zoom. 'auto' indicates that the zoom setting is adjusted automatically. If the capture device does not support zoom setting, H_ERR_FGPARAM is returned.

Parameters for get_framegrabber_param

There may exist additional read-only parameters with the following postfixes:

All these postfixed parameter names are not returned when calling info_framegrabber(.., 'parameters', ..) and are used to enable the easy parameterization via a generic graphical user interface, particularly the HDevelop Image Acquisition Assistant.

Parameter Values Default Type Kind Description
'available_connectors' [<connector_type_1>, <connector_type_2>, ...] integer dynamic Types of the physical connectors of the device.
'available_dialogs' ['<dialog_1>', '<dialog_2>', ...] string dynamic Dialogs (property pages) provided by the device.
'available_frame_rates' [<frame_rate_1>, <frame_rate_2>, ...] float dynamic Currently available frame rates in frames per second (as float values!). This list will be empty, if the current device does not support the setting of frame rates.
'available_media_types' [<format (WxH)>, <format (WxH)>, ...] string dynamic List of the available formats and associated resolutions for the current device.
'available_pin_names' [<pin_name_1>, <pin_name_2>, ...] string dynamic Names of the connectable pins of the source filter. Note that only pins will be displayed which deliver video data.
'available_pins' [<pin_index_1>, <pin_index_2>, ...] integer dynamic Indices of the connectable pins of the source filter (as to be passed to Port in open_framegrabber). Note that only pins will be displayed which deliver video data.
'backlight_compensation' 'off', 'on' string pre-defined Backlight compensation. If the capture device does not support backlight compensation, an empty tuple is returned.
'bits_per_channel' <default> -1 integer pre-defined The value is not used, so a default value is returned.
'brightness' <brightness>, 'auto' mixed dynamic Brightness. If the capture device does not support brightness adjustment, an empty tuple is returned.
'camera_type' '[<video norm>] <type> (<widthxheight>)' 'default' string pre-defined Current camera type.
'color_enable' 'off', 'on' string pre-defined Color enable. If the capture device does not support color enable, an empty tuple is returned.
'color_space' 'gray', 'rgb' 'rgb' string pre-defined Desired color space and thus the number of image channels of the resulting HALCON image.
'connector' <number> integer dynamic Physical connector. If the capture device does not support physical connectors, an empty tuple is returned.
'contrast' <contrast>, 'auto' mixed dynamic Contrast. If the capture device does not support contrast adjustment, an empty tuple is returned.
'device' '<index>' '0' string dynamic Current capture device index.
'disconnect_graph' 'false', 'true' 'false' string pre-defined Status of the automatic disconnection of the filter graph when setting camera parameters.
'exposure' <exposure>, 'auto' mixed dynamic Exposure time. If the capture device does not support exposure time, an empty tuple is returned.
'external_trigger' 'false', 'true' 'false' string pre-defined Status of the external trigger.
'field' '<default>' 'default' string pre-defined The value is not used, so a default value is returned.
'flip_horizontal' 'false', 'true' string pre-defined Horizontal image flipping. If the capture device does not support horizontal flipping, an empty tuple is returned.
'flip_vertical' 'false', 'true' string pre-defined Vertical image flipping. If the capture device does not support vertical flipping, an empty tuple is returned.
'focus' <focus>, 'auto' mixed pre-defined Focus. If the capture device does not support focus, an empty tuple is returned.
'frame_rate' <fps> 15.0 float dynamic Frame rate in frames per second (as a float value!).
'gamma' <gamma>, 'auto' mixed dynamic Gamma. If the capture device does not support gamma adjustment, an empty tuple is returned
'generic' <default> -1 mixed pre-defined The value is not used, so a default value is returned.
'grab_timeout' <milliseconds> 5000 integer pre-defined Current grab timeout in milliseconds.
'horizontal_resolution' <resolution> 1 integer pre-defined Current value of horizontal resolution.
'hue' <hue>, 'auto' mixed dynamic Hue. If the capture device does not support hue adjustment, an empty tuple is returned
'image_height' <height> 0 integer pre-defined Height of the desired image part ('0' stands for the complete image).
'image_width' <width> 0 integer pre-defined Width of the desired image part ('0' stands for the complete image).
'iris' <iris>, 'auto' mixed dynamic Iris. If the capture device does not support iris adjustment, an empty tuple is returned
'line_in' <default> 1 integer pre-defined The value is not used, so a default value is returned.
'name' 'DirectShow' string pre-defined Name of the HALCON interface.
'pan' <pan>, 'auto' mixed dynamic Pan. If the capture device does not support pan adjustment, an empty tuple is returned
'port' <port> -1 integer pre-defined Current port number.
'revision' '<revision>' string pre-defined Revision number of the DirectShow interface.
'roll' <roll>, 'auto' mixed dynamic Roll. If the capture device does not support roll setting, an empty tuple is returned
'saturation' <saturation>, 'auto' mixed dynamic Saturation. If the capture device does not support saturation adjustment, an empty tuple is returned
'sharpness' <sharpness>, 'auto' mixed dynamic Sharpness. If the capture device does not support sharpness adjustment, an empty tuple is returned
'start_column' <column> 0 integer pre-defined Returns the current start column of the HALCON image.
'start_row' <row> 0 integer pre-defined Returns the current start row of the HALCON image.
'tilt' <tilt>, 'auto' mixed dynamic Tilt. If the capture device does not support tilt setting, an empty tuple is returned
'vertical_resolution' <resolution> 1 integer pre-defined Current value of vertical resolution.
'video_gain' <gain>, 'auto' mixed dynamic Gain. If the capture device does not support gain adjustment, an empty tuple is returned
'white_balance' <white_balance>, 'auto' mixed dynamic White balance. If the capture device does not support white balance adjustment, an empty tuple is returned
'zoom' <zoom>, 'auto' mixed dynamic Zoom. If the capture device does not support zoom setting, an empty tuple is returned

Operator set_framegrabber_lut

Not supported by this interface.

Operator get_framegrabber_lut

Not supported by this interface.

Operator set_framegrabber_callback

Not supported by this interface.

Operator get_framegrabber_callback

Not supported by this interface.

Operator grab_image_start

Starts a new asynchronous grab. See also grab_image_start.

Operator grab_image

grab_image starts a new synchronous grab. See also grab_image. Note that the interface converts the image from the device to the desired image format specified by the parameters 'image_width', 'image_height', 'start_row', 'start_column', 'bits_per_channel', and 'color_space'.

Operator grab_image_async

grab_image_async returns an image and starts the next asynchronous grab. See also grab_image_async. Note that the interface converts the image from the device to the desired image format specified by the parameters 'image_width', 'image_height', 'start_row', 'start_column', 'bits_per_channel', and 'color_space'.

Operator grab_data

Not supported by this interface.

Operator grab_data_async

Not supported by this interface.

Operator close_framegrabber

This operator closes the device. See also close_framegrabber.

HDevelop Examples

For this interface there are the following examples available:

Release Notes


Legal disclaimer regarding hyperlinks: This page may provide users with access by hypertext links to external, non-MVTec websites. Any such access is provided with the understanding that the contents of non-MVTec sites are beyond the control of MVTec Software GmbH, that MVTec Software GmbH makes no representations whatsoever about such sites, and that users shall proceed at their own risk. MVTec Software GmbH is not responsible for the privacy practices or the content of external, non-MVTec websites.
Copyright notes: © Copyright MVTec Software GmbH. All rights reserved. Unless otherwise stated, the copyright and similar rights in the contents of this page, including but not limited to all text, designs and images appearing herein, are copyrighted works owned by MVTec Software GmbH. "MVTec Software GmbH" and "HALCON" are registered trademarks of MVTec Software GmbH. All other brand names, designs, service marks and trademarks (whether or not registered) referenced or used herein are the property of their respective owners.