Interface Documentation
Image Acquisition Interface for Media Foundation
Interface: | MediaFoundation |
Revision: | 20.11.3 |
Date: | 2024-03-05 |
- General
- System Requirements
- Interface Versioning
- Installation
- Features
- Limitations
- Identifying and Opening a Device
- GenICam GenApi
- Selection of GenICam Feature Description File(s)
- Parameters – Naming Conventions
- Parameters – Device Parameters Control
- Parameters – MVTec EasyParams
- Parameters – GenICam Data Types
- Parameters – Persisting Device Status
- Acquisition – Overview, Device Control
- Acquisition – Configuring the Microsoft Media Foundation media type
- Acquisition – Buffer Handling
- Acquisition – Grab Operators
- Raw Output Format – Custom Pixel Formats, Non-image Buffers
- Feature Change Notifications
- Event Data
- Event Message Queues
- Using HDevelop Image Acquisition Assistant
- Using Internal Color Conversion
- Parameters for info_framegrabber
- Parameters for open_framegrabber
- Parameters for set_framegrabber_param
- Parameters for get_framegrabber_param
- Operator set_framegrabber_lut
- Operator get_framegrabber_lut
- Operator set_framegrabber_callback
- Operator get_framegrabber_callback
- Operator grab_image_start
- Operator grab_image
- Operator grab_image_async
- Operator grab_data
- Operator grab_data_async
- Operator close_framegrabber
- HDevelop Examples
- Troubleshooting
- Usage of third-party libraries
- Release Notes
General
The interface internally contains a GenTL producer based on Microsoft Media Foundation which is referred to as 'Media Foundation Producer' in this document.
System Requirements
- Windows 10 or newer operating system.
- HALCON image acquisition interface hAcqMediaFoundation.dll or hAcqMediaFoundationxl.dll, respectively. If you have properly installed the interface, all these DLLs should reside in bin\%HALCONARCH% within the HALCON base directory %HALCONROOT% you have chosen during the installation of HALCON.
- GenICam GenApi. The corresponding files are part of the HALCON MediaFoundation package and are located in the directory genicam within the HALCON base directory %HALCONROOT%. See section GenICam GenApi for more details.
- A Media Foundation compatible capture device and a successfully installed driver for that device.
Interface Versioning
Installation
- Windows: Extract the archive containing the interface files to the HALCON base directory %HALCONROOT% (Note: Administrator privileges may be required for this step). Additionally, you have to move the interface examples to the directory %HALCONEXAMPLES% manually.
Features
- Multiple capture devices.
- Synchronous and asynchronous grabbing.
- Support of feature persistence.
- Support camera settings control.
Limitations
- Only the following Microsoft Media Foundation video formats are fully supported: MFVideoFormat_L8, MFVideoFormat_L16, MFVideoFormat_RGB24, MFVideoFormat_RGB32, MFVideoFormat_YUY2, MFVideoFormat_NV12, MFVideoFormat_NV21, and MFVideoFormat_MJPG.
- No triggering.
- Only AcquisitionMode 'Continuous' is available.
- The following SFNC features are read-only: Height, Width and AcquisitionFrameRate.
Identifying and Opening a Device
A connection to the device accessible through the MediaFoundation interface is established using the device ID which is guaranteed to be unique per device and stays persistent across multiple sessions, as long as the device remains connected to the same system and USB port. The list of all devices currently available in the system can be obtained using info_framegrabber parameter 'device' or 'info_boards' – see corresponding section. Both parameters return a list of devices, each specified using entities in the format ' | device:<device id> | unique_name:<unique name> | ... '. To increase compatibility with other HALCON image acquisition Interfaces they are both listed. The full string (obtained from the info_framegrabber call) can be directly used for the 'Device' parameter of open_framegrabber, which uses the same format. Only the ' | device:<device id>' string entry is mandatory for open_framegrabber, the others might be omitted.
When a pure string without any 'token:' and without the ' | ' separator is used, it is interpreted directly as the device ID.
As a special case, the string 'default' can be used – in this case the HALCON acquisition interface will use the first available device (devices currently reported as non-accessible will be skipped). However this can result in non deterministic opening of devices when multiple devices are connected to the system.
GenICam GenApi
- This interface uses GenApi version 3.4.2, for more details refer to the GenICam homepage. The corresponding files are part of the HALCON runtime installation and are located in the directory genicam within the HALCON base directory %HALCONROOT% or $HALCONROOT, respectively. This version is the same as the officially released version at the time of writing.
- The HALCON MediaFoundation interface sets all necessary environment
variables on its own and ignores other installed GenICam
packages by default.
If you want to use another GenICam package, you need to set the environment variable HALCON_USE_EXTERNAL_GENAPI. This skips the step of setting all necessary variables and paths internally, so you have to make sure they are set correctly. Please note that it might not be possible to use different GenApi versions with different interfaces at the same time and that you must use the required GenApi version for this interface. - The caching of device XML files is activated to speed up processing, writing to a temporary directory subject to availability of %TEMP%, %TMP%, $TMPDIR, /tmp or %HALCONROOT%.
- The remote device control features as well as the Media Foundation Producer control features of this interface are controlled via GenApi.
Selection of GenICam Feature Description File(s)
- Features of the connected device are wrapped by the Media Foundation Producer and presented via a GenICam compatible XML file. Names for those features follow the SFNC recommendation as far as applicable.
- Features of the Media Foundation Producer are exposed through
a set of GenICam description files, one for each internal entity to control
the device tree:
- The "system" – representing the overall behavior of the acquisition interface
- The interface used to connect the device to the system.
- A proxy (called "local device") to the device, controlling the Media Foundation Producer view of the device.
- The data stream used for the acquisition (if the device provides any data streams).
RemoteFile=%PATH_TO_GENICAM_FILE_OF_THE_DEVICE% SystemFile=%PATH_TO_GENICAM_FILE_OF_THE_SYSTEM_MODULE% InterfaceFile=%PATH_TO_GENICAM_FILE_OF_THE_INTERFACE_MODULE% DeviceFile=%PATH_TO_GENICAM_FILE_OF_THE_LOCAL_DEVICE_MODULE% StreamFile=%PATH_TO_GENICAM_FILE_OF_THE_STREAM_MODULE%The same ini-file format can be reused to force the HALCON acquisition interface to load an alternative XML file for one or more of these entities. This can be useful, e.g., for updates or troubleshooting. The files listed in the ini file will be used for the given entity instead of the original ones. For the entities excluded from the ini file, the GenICam description file will be searched and loaded the usual way. To apply the ini file, pass its full path to open_framegrabber in the 'CameraType' parameter.
Note that the ini-file can be reused also for other purposes such as storing/restoring configuration as described in Parameters – Persisting Device Status. Be aware that when persistence files are specified, they have priority over other explicit settings passed to open_framegrabber.
Parameters – Naming Conventions
- Internal parameters of the MVTec GenTL Consumer itself (GenICamTL acquisition interface). These are named following the "underscore" naming style, e.g., color_space, and are all lowercase. However, MVTec EasyParams are prefixed with "[Consumer]", e.g., [Consumer]gain.
- GenICam-based parameters of the device, usually a camera, use by convention the "CamelCase" style, e.g., ExposureTime.
- GenICam-based parameters of the individual Media Foundation Producer
modules (system, interface, device and data stream) use by convention
the same style but are prefixed with the module name in square brackets.
Beware that the system and interface modules might potentially be shared by
multiple opened devices, so changing their configuration might have side
effects on other connections as well. The following prefixes are used:
- "[System]", e.g., [System]TLVendorName.
- "[Interface]", e.g., [Interface]InterfaceType.
- "[Device]", e.g., [Device]DeviceID.
- "[Stream]", e.g., [Stream]StreamBufferHandlingMode.
Parameters – Device Parameters Control
The availability of the parameters depends on the connected device.
For detailed information, check the parameter description in the parameters list.
Parameters – MVTec EasyParams
The list of EasyParams can be obtained calling 'available_easyparam_names'. Note that 'available_param_names' does not include the EasyParams. The MVTec EasyParams start with the prefix [Consumer], indicating they are internal parameters of the HALCON GenTL consumer itself.
Since HALCON 22.11 they are available via an own tab in the HDevelop Image Acquisition Assistant.
If your device does not support one of the EasyParams, querying its access will return 'ni' (not implemented). If instead 'na' (not available) is returned, the EasyParam is supported but currently not available, e.g., it depends on the current state of another EasyParam or the access of one or more GenICam features, or because the image acquisition is running. In the latter case, use set_framegrabber_param(..., 'do_abort_grab', ...) to stop the acquisition.
List of MVTec EasyParams:
- General device information:
- [Consumer]info_general
- Exposure feature:
- [Consumer]exposure_auto
- [Consumer]exposure
- Gain feature:
- [Consumer]gain_auto
- [Consumer]gain
Parameters – GenICam Data Types
- integer – signed integer, 64-bit on 64-bit platforms, 32-bit on 32-bit ones
- real – floating point type
- string – classical string
- IInteger – integer value, mapped directly to HALCON's integer parameter type. It will also accept real parameters. When the GenICam feature in question has a representation associated that identifies it as IPV4Address, MACAddress or HexNumber, the corresponding string representation will also be accepted. It should be highlighted that a problem can occur when running HALCON on a 32-bit platform (where integer parameters are 32-bit wide) and accessing a GenICam feature that is naturally 64-bit. In such cases the full range of the feature will not be available to the application and its value might be truncated. Also the sign of the parameter might be misinterpreted. To solve this problem, the parameter 'split_param_values_into_dwords' can be used. This maps the 64-bit IInteger value into two 32-bit integer values and vice versa.
- IFloat – floating point value, mapped directly to HALCON's real parameter type. It will also accept integer parameters.
- IString – string value, mapped directly to HALCON's string parameter type.
- IBoolean – boolean type is handled through HALCON's integer parameters, a value of 0 (zero) means logical false, other values mean logical true.
- IEnumeration – enumeration is a type that allows selecting from a set of values that are primarily identified by their name (the values are called 'enum entries'). Enumerations are interfaced through HALCON's string parameter type, while the enum entry names are used as the parameter values.
- ICommand – The command type allows to "execute" actions. To execute a command, use set_framegrabber_param with an integer parameter of any value (the value is ignored). Some commands' execution might take longer time and the command provides feedback when it is done. To query the status, use get_framegrabber_param for that command. It will return an integer value of 1 if it "is done" (command execution has finished), 0 if it has not finished yet. Note that if some other features are designed to be dependent on the command, querying the "is done" status might be essential to get the depending features invalidated (and updated with new values) as soon as the command execution finishes.
- IRegister – The register data type is used for plain memory blobs that cannot be mapped to any other data type. They are interfaced through HALCON's string parameter type, the register value is the hexadecimal string representation of the register's memory.
Parameters – Persisting Device Status
Note that while the format of the files is intentionally human readable and the files can be hand-modified if desired, such modifications should be done with care by someone familiar with the GenICam persistence functionality internals and given device. Improper modifications of the files can lead to errors when using it.
The persistence related operations might be blocked by the device and/or Media Foundation Producer based on the current state, for example while an acquisition is in progress.
The same persistence files can be applied to the entire set of devices of the same type and firmware version. Applying the persistence files to a device of another type or using even different firmware version will probably lead to inconsistencies or will even fail completely .
Apart from the 'do_write_settings', the feature persistence file will also be written together with the ini file documented in the section Selection of GenICam Feature Description File(s) - using parameter 'do_write_configuration'. This command will generate extended version of the persistence file, storing not only the current device configuration, but also contents of its user sets and sequencer sets (if the device supports them). Additionally, it will also generate persistence files for all the Media Foundation Producer modules (system, interface, device and data stream). The persistence file entries in the ini file will have the format
RemotePersistence=%PATH_TO_PERSISTENCE_FILE_OF_THE_DEVICE% SystemPersistence=%PATH_TO_PERSISTENCE_FILE_OF_THE_SYSTEM_MODULE% InterfacePersistence=%PATH_TO_PERSISTENCE_FILE_OF_THE_INTERFACE_MODULE% DevicePersistence=%PATH_TO_PERSISTENCE_FILE_OF_THE_LOCAL_DEVICE_MODULE% StreamPersistence=%PATH_TO_PERSISTENCE_FILE_OF_THE_STREAM_MODULE%
Acquisition – Overview, Device Control
The interface fully configures and controls the acquisition process on the camera. Note that some of the camera features might be locked by GenICam when an acquisition is active.
With synchronous grab (grab_image/grab_data), a new acquisition is started internally for each image, so that the application always gets a new image. Before delivering the image, the acquisition is stopped again, so between individual grab_image/grab_data calls, all acquisition related features remain unlocked.
With asynchronous grabbing, started explicitly by grab_image_start or implicitly by grab_image_async/grab_data_async, the interface keeps the acquisition running internally, collecting further images to be delivered through future grab_image_async/grab_data_async calls. The acquisition related features are locked, until the acquisition is stopped using set_framegrabber_param(..., 'do_abort_grab', ...).
The HALCON acquisition interface properly recognizes the 'Continuous', 'SingleFrame' and 'MultiFrame' acquisition modes configured on the device and adjusts the acquisition control logic accordingly.
Furthermore, the interface takes over exclusive access to several remote device features essential for the acquisition control (AcquisitionStart, AcquisitionStop, AcquisitionAbort, TLParamsLocked). The user application has no direct way to control these features.
The differences between the "image" and "data" version of the grab operators is documented in Acquisition – Grab Operators.
Acquisition – Configuring the Microsoft Media Foundation media type
Acquisition – Buffer Handling
Whenever a new image is acquired successfully and passed to the application as a HALCON image, the interface keeps the buffer locked (not returning it to the acquisition engine) until a new grab-related operator is called by the application or the acquisition is aborted using set_framegrabber_param(..., 'do_abort_grab', ...). During this period, it is fully safe to query information about this "last acquired" buffer – for example query buffer properties through get_framegrabber_param parameters such as 'buffer_timestamp', 'buffer_is_incomplete', 'image_width' and 'image_height'.
When a new grab-related operator is called by the application, the interface returns the buffer to the acquisition engine and buffer-related queries are not valid anymore.
It can happen, that the camera is temporarily or constantly acquiring data in higher speed than the application is processing them. In such case the streaming engine of the Media Foundation Producer decides how to treat the acquired buffers based on the '[Stream]StreamBufferHandlingMode' parameter.
Acquisition – Grab Operators
The "traditional" grab_image/grab_image_async operators are still well suitable in simple use cases when just a single 2D image is acquired from the device. It is also currently used e.g. by the HDevelop's Image Acquisition Assistant. However, in case when the device is streaming more complex data structures, such as 3D data, multi-AOI or similar data, grab_image/grab_image_async is not able to provide all the outputs. In all these cases it will simply provide the first image found in the acquired data.
The "extended" grab_data/grab_data_async operators allow to output arbitrary number of HALCON images and also arbitrary number of control data. It is therefore suitable for use in advanced use cases when more than just a single HALCON image should be output. An important use case is acquisition from 3D devices () when the operators can build and output the 3D object model through the control data output. It can be also used in other (possibly even device-specific) situations when the device outputs multiple images for a single acquisition.
The structure of the provided outputs can be queried with help of the 'image_contents', 'data_contents' and related parameters.
The grab_data/grab_data_async can also be used in the simple single-image use cases - in that case they will simply provide a single HALCON image and zero control data outputs. They can thus be used as full replacement of the traditional grab_image/grab_image_async operators.
Raw Output Format – Custom Pixel Formats, Non-image Buffers
To offer a basic support of custom pixel formats (i.e., pixel formats not defined by PFNC or not supported by HALCON), the ColorSpace value 'raw' can be used. In this case the image acquisition interface delivers the buffer to the application without any format conversions.
Note that the same principle is applied whenever a buffer containing other than image data is acquired. Examples of such buffers can be files (e.g., compressed images) or raw data (results of smart camera processing). Such buffers are not real "images", but can still be delivered to the application as 'raw' HALCON images. It is the responsibility of the application to know how to interpret such data.
Last but not least, the 'raw' color space can also be used if the user explicitly wishes to receive raw input data without any conversions. For example when acquiring Bayer encoded images, specifying 'raw' means that the interface should not attempt to decode them to RGB or monochrome format, but deliver the data directly to the application.
It is important to know that when the interface does not have full information about the image format (dimensions and pixel format), it has to choose an artificial one. In such a case it delivers always an 8-bit image with dimensions matching the buffer size (square root of the image size). Eventually an unused tail of the HALCON image (if such an artificial image is bigger than the source buffer) will be padded with zeroes. The fact whether the last acquired buffer contained an image of known properties or a blob of other data (so that the artificial HALCON image size had to be used) as well as the size of the eventual tail padding can be queried using 'image_raw_buffer_type' and 'image_raw_buffer_padding_bytes' parameters.
Feature Change Notifications
Note that the notifications might be raised in various circumstances, including:
- The application (you) explicitly changed that feature.
- Another feature has changed and the notified feature "depends" on the changed feature (the dependencies are defined in the GenICam description file).
- Access mode or current range for the feature has changed.
- As a result of regular "polling" in case of uncached features.
- As a result of device event delivery if the feature is connected to that event.
- As a result of new buffer delivery for features corresponding to chunk data.
Notification callbacks can be registered for individual features using set_framegrabber_callback - see corresponding operator documentation. Additionally, it is possible to use message queues to receive the event notification. In those cases it is necessary to create a message queue and then register the individual feature - see event message queues.
Event Data
The decoding of the event data and matching them to the corresponding features, including potential notifications, is performed transparently by the interface.
The actual values might be read through the regular parameter reading mechanism like get_framegrabber_param or by get_message_tuple if you are using message queues to receive events. The choice of the event types to be generated is device-specific. The names of the event related features usually start by convention with a prefix 'Event' (examples might be 'EventFrameTrigger' and 'EventFrameTriggerTimestamp'), however, the device documentation should contain all the information about supported events and their corresponding feature names.
Although the data corresponding to the last delivered event can be in general read at any time, when using callback to receive events it is highly recommended that reading the event data is synchronized to notifications for corresponding event feature(s). Only in such a case it is guaranteed that the read data correspond exactly to the very event instance being notified – and that the feature values are not just being modified through a new instance of the same event. Note that the notifications are raised from context of the event handling/dispatching thread, so when processing the user callback, the event handling mechanism is paused. If multiple data items are associated with the same event, it is enough to register notification just for the actual event feature and read all the data during the callback.
If using message queues to receive events, you can decide to add additional data to be delivered with the corresponding event feature(s), see Event Message Queues. For this case the interface will read all the specified event features as soon as the event is generated and add it to the corresponding message. This guarantees that the delivered information corresponds with the actual value at the time the event was generated.
Besides the asynchronous events generated by the actual device, asynchronous events (optionally including additional data) can be generated by any module of the Media Foundation Producer (system, interface, device and data stream). The information provided above about handling of the device events applies similarly also to the Media Foundation Producer events, including enabling/disabling them (typically using 'EventSelector'/'EventNotification' features provided by given module, i.e. with corresponding module prefix in the feature name). For SFNC-compliant events, this is done automatically if the parameter 'event_notification_helper' is enabled.
Event Message Queues
Create a message queue at which you want to receive the notifications with create_message_queue and assign it to the selected feature with set_framegrabber_param(..., 'event_message_queue', QueueHandle).
The message queue can be registered for any GenICam based features, i.e., features published by the device and Media Foundation Producer or for internal features of the acquisition interface. On top of that, the notification can be registered also for internal events occurring within the acquisition interface, in particular 'event_new_buffer' which gets fired whenever the information about last acquired buffer is updated (new buffer grabbed or last buffer info invalidated when restarting the acquisition).
The list of supported targets can be queried by calling get_framegrabber_param(..., 'available_event_names', ...).
One of the important use cases for feature change callbacks is the device event delivery mechanism, see details in Event Data and Feature Change Notifications sections.
A new message would be added to the specified queue whenever a given feature is potentially changed (including its other properties such as range or access mode). Note that it does not necessarily always mean that the feature actually has a new value. A call to set_framegrabber_param(..., 'event_message_queue', 0) unregisters the previously registered message queue from the specified event. Note that the interface keeps just a single registration for every feature, if you attempt to register a new message queue for a feature that already had a message queue registered, the previous registration will be replaced with the new one.
The messages incoming on an event can be retrieved with dequeue_message and will contain at least three tuples. The first tuple (key 'id') is a unique identifier of the acquisition instance the event is coming from. It is a string composed as '<interface>:<unique_name>'. The second tuple (key 'event_name') is the name of the corresponding feature previously specified by 'event_selector'. The third tuple (key 'event_value') contains the value if the corresponding feature if available and readable.
If you decide to add additional data to be delivered with the corresponding event feature(s), add the features of interest with set_framegrabber_param(..., 'event_data', ...). Each event data feature will be appended to the event message with the key being its name and the tuple its value if readable. Note that duplicities possibly specified through 'event_data' are ignored The value of the notified feature itself (already reported in 'event_value') would also be considered as a duplicity and not reported again.
Using HDevelop Image Acquisition Assistant
- Some parameters depend on special conditions, e.g., a valid buffer or another parameter activated. After opening the camera these conditions may not yet be fulfilled, so the depending parameters are not shown. By using the 'Refresh' button, all parameters are read again and the depending parameters should appear if the conditions are fulfilled then.
- There are also some parameters regarding the image size and the payload size, which can only be changed if no acquisition takes place. The safest way to ensure this is to apply the action parameter 'do_abort_grab'. Please note that 'Update Image' has to be disabled first.
- The behavior of allowing changes to parameters while streaming is active depends on the capabilities of the device. It is possible that some cameras give you control over, e.g., the exposure time, while streaming and others do not.
Using Internal Color Conversion
Following transformations from the camera color space (see also PFNC) to the interface color space (see also 'color_space' parameter in this document) are supported:
- Bayer pattern to 'rgb':
Bayer_LMMN R
G1
G2
B
⇾ [R,G,B]
[R,G,B]
[R,G,B]
[R,G,B]
Bayer_NMML B
G1
G2
R
⇾ [R,G,B]
[R,G,B]
[R,G,B]
[R,G,B]
G = (G1 + G2) / 2
. - Y'CbCr to 'rgb' (Note: gamma correction is not considered):
R = Y' + 1.4020 * (Cr- M)
G = Y' - 0.34414 * (Cb- M) -0.71414 * (Cr- M)
B = Y' + 1.7720 * (Cb - M) - RGB to 'yuv' ('yuv' corresponds to Y'CbCr of PFNC, Note: gamma correction is not considered):
Y' = 0.299 * R + 0.587 * G + 0.114 * B
Cb = -0.16874 * R - 0.33126 * G + 0.5 * B + M
Cr = 0.5 * R - 0.41869 * G - 0.08131 * B + M - RGB to 'gray':
Y' = 0.299 * R + 0.587 * G + 0.114 * B
M = 128
for 8 bit raw data, and M = 32768
for 16 bit raw data.The accuracy of the results is limited due to internal 16.16 fix-point arithmetic for 8 bit ( 0...255), and 24.8 fix-point arithmetic for 16 bit raw data.
Parameters for info_framegrabber
Parameter | Value List | Type | Kind | Description |
---|---|---|---|---|
'bits_per_channel' | [-1, 8, 10, 12, 14, 16] | integer | pre-defined | Values for bits per channel. |
'camera_type' | ['CAMFILE:', 'ini;xml', '<path>', 'default'] | string | pre-defined | Syntax for connection configuration file and default value. |
'color_space' | ['default', 'gray', 'raw', 'rgb', 'rgbx', 'yuv'] | string | pre-defined | Values for color space. |
'defaults' | [0, 0, 0, 0, 0, 0, 'progressive', -1, 'default', -1.0, 'false', 'default', '0', 0, 0] | mixed | pre-defined | Default values for open_framegrabber. |
'device' | [' | device:<device id> | unique_name:<unique name> | interface:<interface id> | producer:Masimov'] | string | dynamic | List of discovered devices in the system with information about their device ID, unique name, interface ID and producer. This corresponds to the devices plugged to USB ports on the machine. See the full description in section about device opening. |
'external_trigger' | [] | Ignored. | ||
'field' | [] | Unused. | ||
'general' | [] | string | pre-defined | Information about the HALCON MediaFoundation interface. |
'generic' | ['', 'num_buffers=<num>' ] | string | pre-defined | Value list for the Generic parameter. |
'horizontal_resolution' | [] | integer | pre-defined | Used. |
'image_height' | [] | Unsupported query. | ||
'image_width' | [] | Unsupported query. | ||
'info_boards' | [' | device:<device_id> | unique_name:<unique_name> | interface:<interface_id> | producer:Masimov | vendor:<vid_xxx> | model:<pid_xxx> | tl_type:Custom | status:<device_status>'] | string | dynamic | List of devices discovered in the system. This corresponds to the MediaFoundation compatible devices plugged to USB ports on the machine.
|
'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' | [] | Unused. | ||
'revision' | '<revision>' | string | pre-defined | Revision number of the MediaFoundation interface. |
'start_column' | [] | Unsupported query. | ||
'start_row' | [] | Unsupported query. | ||
'vertical_resolution' | [] | integer | pre-defined | Used. |
Parameters for open_framegrabber
Parameter | Values | Default | Type | Description |
---|---|---|---|---|
Name | 'MediaFoundation' | string | Name of the HALCON interface. | |
HorizontalResolution | 0, resolution | 0 | integer | Ignored. |
VerticalResolution | 0, resolution | 0 | integer | Ignored. |
ImageWidth | --- | 0 | Ignored. | |
ImageHeight | --- | 0 | Ignored. | |
StartRow | --- | 0 | Ignored. Configure the image size through device parameters. | |
StartColumn | --- | 0 | Ignored. Configure the image size through device parameters. | |
Field | --- | Ignored. | ||
BitsPerChannel | -1, 8, 10, 12, 14, 16 | -1 | integer | Number of bits per channel of the resulting HALCON image. In case of -1 the bit depth of each respective acquired buffer is used. By specifying a value greater than 8 the grabbed images are delivered as uint2 images. |
ColorSpace | 'default', 'gray', 'raw', 'rgb', 'rgbx', 'yuv' | 'default' | string | Specify the desired color space and thus the number of image channels of the resulting HALCON image. In case of 'default' for Mono pixel formats, ColorSpace is set to 'gray', otherwise to 'rgb' (and for unknown pixel formats to 'raw'). If the input pixel format is a supported 4 channel PFNC pixel format, the parameter 'rgbx' can be used to get all 4 channels. |
Generic | '', ['num_buffers=<num>' ], -1 | -1 | mixed | With the Generic parameter some important values can be set before the camera is initialized. Note that the parameter names including the values
must be strings, e.g., 'num_buffers=5' sets the number of buffers to 5. The following parameters are available:
|
ExternalTrigger | --- | Ignored. To configure the trigger mode please use set_framegrabber_param with the generic (SFNC) trigger parameters of the camera. | ||
CameraType | 'default', <ini/xml filename> | 'default' | string | Full path to the configuration file with the specification of alternative GenICam description files to be loaded for the device and Media Foundation Producer, see detailed description in the section about device opening. |
Device | ' | device:<device id> | unique_name:<unique name> | interface:<interface id> | producer:Masimov' | string | To open a capture device, the device name as shown in info_framegrabber(...'device'...) or info_framegrabber(...'info_boards'...) can be used. Some of the string entries might be skipped or set as 'default'. To open a specific sensor, either device or unique_name has to be set. As a shortcut, only the device ID or the string 'default' can be used. See full description in the section about device opening. | |
Port | --- | Unused. | ||
LineIn | --- | Ignored. |
Parameters for set_framegrabber_param
To set e.g. the current gain of the camera AcqHandle refers to (after calling open_framegrabber), the user can call set_framegrabber_param(AcqHandle, 'Gain', 6.0).
Please note that the interface sets the value of a parameter only if the value is valid. Integer and float values not matching the allowed range for given feature are aligned to the closest valid value. Invalid values of other feature types are refused.
Additionally to the GenICam parameters of the camera and of the Media Foundation Producer, the following HALCON interface parameters are supported by set_framegrabber_param:
Parameter | Values | Default | Type | Description |
---|---|---|---|---|
'[Consumer]exposure' | real | Specifies the exposure time. Usually the exposure time is specified in microseconds. However, cameras might deviate from this standard. Consult the documentation of your camera for more detailed information. If [Consumer]exposure_auto is not set to 'Off', [Consumer]exposure access is either read-only or not available. Besides, this EasyParam depends on the camera parameter ExposureMode. If [Consumer]exposure is not available, you might need to change ExposureMode manually to 'Timed'. | ||
'[Consumer]exposure_auto' | 'Off', 'Continuous', 'Once' | string | Specifies if the exposure time is set manually by the user or automatically by the camera.
|
|
'[Consumer]gain' | real | Allows to increase the image brightness by applying an amplification factor. Consult the documentation of your camera for more detailed information. If [Consumer]gain_auto is not set to 'Off', [Consumer]gain access is either read-only or not available. | ||
'[Consumer]gain_auto' | 'Off', 'Continuous', 'Once' | string | Specifies if the gain is set manually by the user or automatically by the camera.
|
|
'[Device]DeviceEventsThreadApplyPriority' | --- | integer | Applies the thread priority and scheduling policy (if applicable on given operating system) configured through the '[Device]DeviceEventsThreadPriority'
and '[Device]DeviceEventsThreadSchedulingPolicy' parameters to the event
processing thread.
If the thread is running, the values are directly applied. If the thread is
not running in the moment, the values are stored and will be applied as soon
as the thread is started again.
It is responsibility of the application to ensure that the calling process
has sufficient privileges. The feature is not available for devices not supporting device events or if the event handling was disabled using the 'device_event_handling=0' generic parameter. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'[Device]DeviceEventsThreadPriority' | <thread_priority> | integer | OS-specific thread priority value to be used for the internal event processing thread. The actual values are directly the priority identifiers
of the operating system, e.g. THREAD_PRIORITY_HIGHEST under Windows
or a real-time priority value under Linux. The actual priority is applied only after executing the '[Device]DeviceEventsThreadApplyPriority' command parameter, possibly together with the '[Device]DeviceEventsThreadSchedulingPolicy' value if applicable on given system. It is the responsibility of the application to ensure that the calling process has sufficient privileges to apply the priority change and that the value written to the parameter is a valid priority identifier. After applying '[Device]DeviceEventsThreadApplyPriority', the application can read back the priority value to verify if it was properly applied. Note that when opening the device, the Media Foundation Producer attempts itself to elevate the thread priority to a suitable value. The feature is not available for devices not supporting device events or if the event handling was disabled using the 'device_event_handling=0' generic parameter. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'[Device]DeviceEventsThreadSchedulingPolicy' | <scheduling_policy> | integer | OS-specific scheduling policy value to be used for the internal event processing thread. The actual values are directly the priority identifiers
of the operating system, e.g. SCHED_FIFO under Linux.
Note that this feature is not available under Windows. The actual scheduling policy is applied only after executing the '[Device]DeviceEventsThreadApplyPriority' command parameter, together with the '[Device]DeviceEventsThreadPriority' value. It is the responsibility of the application to ensure that the calling process has sufficient privileges to apply the scheduling policy and that the value written to the parameter is a valid scheduling policy identifier. After applying '[Device]DeviceEventsThreadApplyPriority', the application can read back the scheduling policy value to verify if it was properly applied. The feature is not available for devices not supporting device events or if the event handling was disabled using the 'device_event_handling=0' generic parameter. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'[Stream]StreamBufferHandlingMode' | 'OldestFirst', 'OldestFirstOverwrite', 'NewestOnly' | 'OldestFirst' | string | Selects the mode the streaming engine uses to handle newly acquired data, in particular when the camera runs faster than the application processing.
The parameter is writeable only if no acquisition is active.
Supported values are:
|
'[Stream]StreamThreadApplyPriority' | --- | integer | Applies the thread priority and scheduling policy (if applicable on the given operating system) configured through
'[Stream]StreamThreadPriority' and '[Stream]StreamThreadSchedulingPolicy'
parameters to the stream processing thread.
If the thread is running (acquisition started), the values are directly
applied. If the thread is not running in the moment, the values are
stored and will be applied as soon as the thread is started again.
It is the responsibility of the application to ensure that the calling
process has sufficient privileges. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'[Stream]StreamThreadPriority' | <thread_priority> | integer | OS-specific thread priority value to be used for the internal stream processing thread. The actual values are directly the priority identifiers
of the operating system, e.g. THREAD_PRIORITY_HIGHEST under Windows
or a real-time priority value under Linux. The actual priority is applied only after executing the '[Stream]StreamThreadApplyPriority' command parameter, possibly together with the '[Stream]StreamThreadSchedulingPolicy' value if applicable on given system. It is the responsibility of the application to ensure that the calling process has sufficient privileges to apply the priority change and that the value written to the parameter is a valid priority identifier. After applying '[Stream]StreamThreadApplyPriority', the application can read back the priority value to verify if it was properly applied. Note that when opening the device, the Media Foundation Producer attempts itself to elevate the thread priority to a suitable value. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'[Stream]StreamThreadSchedulingPolicy' | <scheduling_policy> | integer | OS-specific scheduling policy value to be used for the internal stream processing thread. The actual values are directly the priority identifiers
of the operating system, e.g. SCHED_FIFO under Linux.
Note that this feature is not available under Windows. The actual scheduling policy is applied only after executing the '[Stream]StreamThreadApplyPriority' command parameter, together with the '[Stream]StreamThreadPriority' value. It is the responsibility of the application to ensure that the calling process has sufficient privileges to apply the scheduling policy and that the value written to the parameter is a valid scheduling policy identifier. After applying '[Stream]StreamThreadApplyPriority', the application can read back the scheduling policy value to verify if it was properly applied. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'add_objectmodel3d_overlay_attrib' | 'disable', 'enable' | 'disable' | string | This parameter has no effect. |
'Aperture' | real | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's aperture setting This parameter corresponds to the CameraControl_Iris property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'ApertureAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic aperture mode This parameter corresponds to the CameraControl_Iris capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Aperture is not available. The availability of this parameter depends on the connected device. | |
'BacklightCompensation' | 'Off', 'On' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's backlight compensation setting This parameter corresponds to the VideoProcAmp_BacklightCompensation property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | |
'bits_per_channel' | -1, 8, 10, 12, 14, 16 | integer | Number of bits per channel of the resulting HALCON image. In case of -1 the bit depth of each respective acquired buffer is used. By specifying a value greater than 8 the grabbed images are delivered as uint2 images. | |
'BlackLevel' | real | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's black level setting This parameter corresponds to the VideoProcAmp_Brightness property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'BlackLevelAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic black level mode This parameter corresponds to the VideoProcAmp_Brightness capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', BlackLevel is not available. The availability of this parameter depends on the connected device. | |
'buffer_reallocation_mode' | 'only_increase_size', 'follow_payloadsize' | 'only_increase_size' | string | Defines the strategy to follow when reallocating the buffers for a new acquisition. In case of 'only_increase_size', the buffers will be only reallocated when the payload size increases. In case of 'follow_payloadsize', the buffers will be reallocated every time the payload size changes. |
'clear_buffer' | 'disable', 'enable' | 'disable' | string | If enabled, each buffer content is cleared before re-queueing (all bytes set to 0xF0 regardless the expected pixel format), so you can see which parts of an image are missing, in case e.g. the transfer of some image packets failed. This parameter adds of course a runtime overhead to write the 0xF0 data every time a buffer is queued. It is mainly useful for debugging in combination with transport layers which do not guarantee the transfer of complete images. Please note, that this parameter does not modify the buffer queue, only the content of a buffer will be set to a defined state. |
'color_space' | 'default', 'gray', 'raw', 'rgb', 'rgbx', 'yuv' | string | Specify the desired color space and thus the number of image channels of the resulting HALCON image. In case of 'default' for Mono pixel formats, ColorSpace is set to 'gray', otherwise to 'rgb' (and for unknown pixel formats to 'raw'). If the input pixel format is a supported 4 channel PFNC pixel format, the parameter 'rgbx' can be used to get all 4 channels. | |
'ColorEnable' | 'Off', 'On' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's color enable setting This parameter corresponds to the VideoProcAmp_ColorEnable property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | |
'confidence_mode' | 'off', 'object_model_3d' | 'off' | string | This parameter has no effect. |
'confidence_threshold' | [0.0, 1.0] | 0.5 | float | This parameter has no effect. |
'Contrast' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's contrast setting This parameter corresponds to the VideoProcAmp_Contrast property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'ContrastAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic contrast mode This parameter corresponds to the VideoProcAmp_Contrast capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Contrast is not available. The availability of this parameter depends on the connected device. | |
'coordinate_transform_mode' | 'none', 'cartesian', 'reference' | 'reference' | string | This parameter has no effect. |
'create_objectmodel3d' | 'disable', 'enable' | 'disable' | string | This parameter has no effect. |
'delay_after_stop' | <milliseconds> | 0 | integer | The time to wait (in milliseconds) between stopping the acquisition on the device (AcquisitionStop command) and Media Foundation Producer. |
'do_abort_grab' | --- | Aborts the current image acquisition and unlocks parameters, that might be locked when acquisition is active. See acquisition overview. | ||
'do_load_settings' | <input_file> | string | Restores the previously stored settings of the opened device. The parameter 'settings_selector' specifies if the settings of the actual (remote) device, one of the Media Foundation Producer modules or the Consumer parameters (internal parameters of MediaFoundation image acquisition interface) are to be restored. See detailed description in section Parameters - Persisting Device Status. | |
'do_write_configuration' | <output_file> | string | Writes a configuration (ini) file and additionally writes GenICam description files and persistence files with the current configuration
of the device into the same directory. The string parameter must be the filename (including full path) of the target ini file. The path must exist prior to writing. The written ini file contains a list of paths to the written description and persistence files. GenICam description files are written for the remote device and each Media Foundation Producer module associated with currently opened device. Persistence files are written for the remote device and each Media Foundation Producer module as well as for the internal parameters of the MediaFoundation image acquisition interface. The complete configuration can be loaded using the 'CameraType' parameter of open_framegrabber operator, see detailed description in the section about device opening. The persisted values of the internal parameters override the corresponding parameters passed to 'open_framegrabber' (in particular 'BitsPerChannel' and 'ColorSpace'). Instead of specifying the full name of the output ini file, 'default' or an empty string can be used. In this case the files will be written to a temporary directory (subject to availability of %TEMP%, %TMP%, $TMPDIR, /tmp or %HALCONROOT%) and the filename of the configuration file will be halcon_gentl_config.ini. This default option will also apply when using the Image Acquisition Assistant. See also related sections Selection of GenICam Feature Description File(s) and Parameters – Persisting Device Status. |
|
'do_write_settings' | <output_file> | string | Writes the current settings of the opened device to be able to restore the settings later. The parameter 'settings_selector' specifies if the settings of the actual (remote) device, one of the Media Foundation Producer modules or the Consumer parameters (internal parameters of MediaFoundation image acquisition interface) are to be written. See detailed description in section Parameters - Persisting Device Status. | |
'event_data' | '<list of genicam_feature/internal_parameter>' | string | Configures GenICam features and/or internal parameters (free mix) to be added to the message queue specified by 'event_message_queue'
for feature change notifications for feature selected in 'event_selector'. Features can be added individually or as a tuple - each 'set' operation for this parameter appends to the current list of event_data. To remove individual features, prepend them with a '~'. To clear all currently added features, call set_framegrabber_param(..., 'event_data', []). Read more about the usage of this mechanism at Event Message Queues. |
|
'event_message_queue' | 0, '<queue_handle>' | handle | Selects a message queue to which the acquisition interface should send feature change notifications (see further details in
Event Message Queues). The corresponding feature/parameter needs to be previously selected by 'event_selector'. Setting 0 (NULL) unregisters the previously selected message queue from notifications about given feature/parameter. |
|
'event_notification_helper' | 'disable', 'enable' | 'disable' | string | Controls if the acquisition interface should attempt to automatically (un)set 'EventNotification' during set_framegrabber_callback if the callback is being (un)registered on an SFNC-compliant event. Note that this will only work if the callback is being registered on the actual event feature (e.g. 'EventExposureEnd'), not on one of the event data features (e.g. 'EventExposureEndTimestamp'). For further information on events, see Event Data. |
'event_selector' | '<genicam_feature/internal_parameter>' | 'grab_timeout' | string | Selects a GenICam feature or internal parameter for which feature change notifications through message queues
should be configured. They are sent to the message queue specified by 'event_message_queue', together with additional data configured in 'event_data'. Read more about the usage of this mechanism at Event Message Queues (which is another alternative to notifications through callbacks, Feature Change Notifications). |
'ExposureAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic exposure mode This parameter corresponds to the CameraControl_Exposure capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', ExposureTime is not available. The availability of this parameter depends on the connected device. | |
'ExposureTime' | <us> | real | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's exposure setting in microseconds This parameter corresponds to the CameraControl_Exposure property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | |
'Focus' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's focus setting This parameter corresponds to the CameraControl_Focus property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'FocusAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic focus mode This parameter corresponds to the CameraControl_Focus capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Focus is not available. The availability of this parameter depends on the connected device. | |
'Gain' | real | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's gain setting This parameter corresponds to the VideoProcAmp_Gain property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'GainAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic gain mode This parameter corresponds to the VideoProcAmp_Gain capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Gain is not available. The availability of this parameter depends on the connected device. | |
'Gamma' | real | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's gamma setting This parameter corresponds to the VideoProcAmp_Gamma property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'GammaAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic gamma mode This parameter corresponds to the VideoProcAmp_Gamma capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Gamma is not available. The availability of this parameter depends on the connected device. | |
'grab_timeout' | <milliseconds> | 5000 | integer | Desired timeout (milliseconds) for aborting a pending grab. If -1 is specified, the timeout is set to INFINITE. |
'Hue' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's hue setting This parameter corresponds to the VideoProcAmp_Hue property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'HueAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic hue mode This parameter corresponds to the VideoProcAmp_Hue capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Hue is not available. The availability of this parameter depends on the connected device. | |
'image_height' | --- | 0 | Unsupported (read-only parameter). | |
'image_width' | --- | 0 | Unsupported (read-only parameter). | |
'MFMediaType' | <video_subtype>_<width>x<height>_<framerate>fps | string | Media Foundation Remote Device Parameter: configures the Microsoft Media Foundation video subtype, image resolution and frame rate. The values are in the form
<video_subtype>_<width>x<height>_<framerate>fps, for example
'YUY2_1280x720_10fps'. If the video subtype is unknown, the 'MFMediaType' value starts with its Globally
Unique Identifier (GUID), for instance: {3131564E-0000-0010-8000-00AA00389B71}. When opening the device,
by default, an RGB (if available) video subtype is chosen, with best settings, meaning the widest width,
highest height and fastest frame rate combination. The feature 'PixelFormat' and the read only features
'Width', 'Height' and 'AcquisitionFrameRate' reflect the selected combination. When changing the
'PixelFormat', the 'MFMediaType' is switched to the corresponding video subtype with best settings.
Additionally, the following situations need to be considered:
|
|
'Pan' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's pan setting This parameter corresponds to the CameraControl_Pan property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'PanAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic pan mode This parameter corresponds to the CameraControl_Pan capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Pan is not available. The availability of this parameter depends on the connected device. | |
'PixelFormat' | string | Media Foundation Remote Device Parameter: sets the pixel format and changes 'MFMediaType' feature to the corresponding Microsoft Media Foundation video subtype with best settings. See 'MFMediaType' parameter for further information. | ||
'Roll' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's roll setting This parameter corresponds to the CameraControl_Roll property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'RollAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic roll mode This parameter corresponds to the CameraControl_Roll capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Roll is not available. The availability of this parameter depends on the connected device. | |
'Saturation' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's saturation setting This parameter corresponds to the VideoProcAmp_Saturation property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'SaturationAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic saturation mode This parameter corresponds to the VideoProcAmp_Saturation capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Saturation is not available. The availability of this parameter depends on the connected device. | |
'settings_selector' | 'RemoteDevice', 'Stream', 'Device', 'System', 'Interface', 'Consumer' | 'RemoteDevice' | string | Selects for which component (set of parameters) the streamable parameters are persisted into a file or restored from a file when using set_framegrabber_param(..., 'do_write_settings', []) and set_framegrabber_param(..., 'do_load_settings', []). Selects among the actual (remote) device, one of the Media Foundation Producer modules or the Consumer parameters (internal parameters of MediaFoundation image acquisition interface). Read more about the usage of this mechanism at Parameters – Persisting Device Status. |
'Sharpness' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's sharpness setting This parameter corresponds to the VideoProcAmp_Sharpness property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'SharpnessAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic sharpness mode This parameter corresponds to the VideoProcAmp_Sharpness capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Sharpness is not available. The availability of this parameter depends on the connected device. | |
'split_param_values_into_dwords' | 'disable', 'enable' | 'disable' | string | Enables a special mode allowing the treatment of integer parameters as tuple of two 32-bit integers. For compatibility with the single-parameter mode, the first tuple element carries always the low 32-bit part of the value, second element carries the high 32-bit part. It is user's responsibility to combine the two parts correctly. This mode is intended especially to help to overcome the problem of 32-bit HALCON featuring only 32-bit integer parameters but having to face up to 64-bit wide GenICam features. In this mode, the get_framegrabber_param returns always a tuple of two integers, set_framegrabber_param accepts both a single parameter or a tuple. Note that this mode affects only integer parameters and only the GenICam based ones, not the internal parameters of HALCON MediaFoundation image acquisition interface - with few exceptions, the 'buffer_timestamp', 'buffer_timestamp_ns', 'device_timestamp_frequency' and 'buffer_frameid' internal parameters. |
'start_async_after_grab_async' | 'disable', 'enable' | 'enable' | string | By default a new asynchronous grab command is automatically given to the acquisition device at the end of grab_image_async. If the parameter 'start_async_after_grab_async' is set to 'disable', this new grab command is omitted. |
'start_column' | --- | 0 | Unsupported (read-only parameter). Configure the image size through device parameters. | |
'start_row' | --- | 0 | Unsupported (read-only parameter). Configure the image size through device parameters. | |
'Tilt' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's tilt setting This parameter corresponds to the CameraControl_Tilt property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'TiltAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic tilt mode This parameter corresponds to the CameraControl_Tilt capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Tilt is not available. The availability of this parameter depends on the connected device. | |
'volatile' | 'disable', 'enable' | 'disable' | string | When enabled, switches on the volatile mode in which the image buffers are used directly to create HALCON images. This is the fastest mode avoiding
the copy of raw images in memory. However, be aware that older images
might be overwritten by the acquisition engine with new data at any time.
When changing the device configuration in a way that acquisition buffers
must be reallocated, the older HALCON images would even become invalid
(pointing to no more existing memory). See also
details about acquisition buffer handling.
Please note that the volatile mode can be switched on at any time, regardless of the current configuration. However, at runtime only the acquired images compatible with the volatile mode will be delivered to the application (the others will be discarded). Compatible means in particular that the PixelFormat of the acquired image matches the color_space and bits_per_channel settings configured for HALCON image output format. |
'WhiteBalance' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's white balance setting This parameter corresponds to the VideoProcAmp_WhiteBalance property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'WhiteBalanceAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic white balance mode This parameter corresponds to the VideoProcAmp_WhiteBalance capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', WhiteBalance is not available. The availability of this parameter depends on the connected device. | |
'Zoom' | integer | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's zoom setting This parameter corresponds to the CameraControl_Zoom property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'ZoomAuto' | 'Off', 'Continuous' | string | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic zoom mode This parameter corresponds to the CameraControl_Zoom capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Zoom is not available. The availability of this parameter depends on the connected device. |
Parameters for get_framegrabber_param
- '_access': These parameters provide the access permissions of the corresponding parameter as a string. Possible values are 'ro' (read-only), 'wo' (write-only), 'rw' (read/write), 'na' (not available), and 'ni' (not implemented).
- '_category': These parameters provide the category of the corresponding parameter as a string.
- '_description': These parameters provide the tool-tip of the corresponding parameter as a string.
- '_displayname': These parameters provide the displayname of the corresponding parameter as a string.
- '_longdescription': These parameters provide the description of the corresponding parameter as a string.
- '_range': These parameters provide the minimum, maximum, step width, and current values for the corresponding integer or float parameter as a tuple with 4 elements, e.g., get_framegrabber_param(.., 'Shutter_range', ..) will return the output tuple [min, max, step, current].
- '_representation': These parameters provide the GenICam representation of the corresponding parameter as a string. They only exist for integer-parameters. Possible values are 'Linear', 'Logarithmic', 'Boolean', 'PureNumber', 'HexNumber', 'IPV4Address' and 'MACAddress'. The purpose of the representation is to aid in GUI design.
- '_streamable': These parameters provide the persistence of the corresponding parameter as an integer. Possible values are 0 if false or 1 if true.
- '_string': These parameters provide the integer values formatted as a string according to the '_representation' postfix. Especially useful for the '_representation' values 'IPV4Address', 'MACAddress' and 'HexNumber'.
- '_type': These parameters provide the type of the corresponding parameter as string.
- '_values': These parameters provide the valid value list for the corresponding parameter as a tuple, e.g., get_framegrabber_param(.., 'volatile_values', ..) will return the output tuple ['enable', 'disable'].
- '_visibility': These parameters provide the visibility of the corresponding parameter as a string. Possible values are 'beginner', 'expert', and 'guru'.
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 |
---|---|---|---|---|---|
'[Consumer]exposure' | real | pre-defined | Specifies the exposure time. Usually the exposure time is specified in microseconds. However, cameras might deviate from this standard. Consult the documentation of your camera for more detailed information. If [Consumer]exposure_auto is not set to 'Off', [Consumer]exposure access is either read-only or not available. Besides, this EasyParam depends on the camera parameter ExposureMode. If [Consumer]exposure is not available, you might need to change ExposureMode manually to 'Timed'. | ||
'[Consumer]exposure_auto' | 'Off', 'Continuous', 'Once' | string | pre-defined | Specifies if the exposure time is set manually by the user or automatically by the camera.
|
|
'[Consumer]gain' | real | pre-defined | Allows to increase the image brightness by applying an amplification factor. Consult the documentation of your camera for more detailed information. If [Consumer]gain_auto is not set to 'Off', [Consumer]gain access is either read-only or not available. | ||
'[Consumer]gain_auto' | 'Off', 'Continuous', 'Once' | string | pre-defined | Specifies if the gain is set manually by the user or automatically by the camera.
|
|
'[Consumer]info_general' | handle | pre-defined | Returns a dictionary handle containing general information about the device. Each key in the dictionary maps a GenICam device information
feature. If one key is not implemented on your device, its value will
be set to 'ni' (i.e. not implemented). Contained keys:
|
||
'[Device]DeviceEventsThreadPriority' | <thread_priority> | integer | pre-defined | OS-specific thread priority value to be used for the internal event processing thread. The actual values are directly the priority identifiers
of the operating system, e.g. THREAD_PRIORITY_HIGHEST under Windows
or a real-time priority value under Linux. The actual priority is applied only after executing the '[Device]DeviceEventsThreadApplyPriority' command parameter, possibly together with the '[Device]DeviceEventsThreadSchedulingPolicy' value if applicable on given system. It is the responsibility of the application to ensure that the calling process has sufficient privileges to apply the priority change and that the value written to the parameter is a valid priority identifier. After applying '[Device]DeviceEventsThreadApplyPriority', the application can read back the priority value to verify if it was properly applied. Note that when opening the device, the Media Foundation Producer attempts itself to elevate the thread priority to a suitable value. The feature is not available for devices not supporting device events or if the event handling was disabled using the 'device_event_handling=0' generic parameter. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'[Device]DeviceEventsThreadSchedulingPolicy' | <scheduling_policy> | integer | pre-defined | OS-specific scheduling policy value to be used for the internal event processing thread. The actual values are directly the priority identifiers
of the operating system, e.g. SCHED_FIFO under Linux.
Note that this feature is not available under Windows. The actual scheduling policy is applied only after executing the '[Device]DeviceEventsThreadApplyPriority' command parameter, together with the '[Device]DeviceEventsThreadPriority' value. It is the responsibility of the application to ensure that the calling process has sufficient privileges to apply the scheduling policy and that the value written to the parameter is a valid scheduling policy identifier. After applying '[Device]DeviceEventsThreadApplyPriority', the application can read back the scheduling policy value to verify if it was properly applied. The feature is not available for devices not supporting device events or if the event handling was disabled using the 'device_event_handling=0' generic parameter. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'[Stream]StreamBufferHandlingMode' | 'OldestFirst', 'OldestFirstOverwrite', 'NewestOnly' | 'OldestFirst' | string | pre-defined | Selects the mode the streaming engine uses to handle newly acquired data, in particular when the camera runs faster than the application processing.
The parameter is writeable only if no acquisition is active.
Supported values are:
|
'[Stream]StreamThreadPriority' | <thread_priority> | integer | pre-defined | OS-specific thread priority value to be used for the internal stream processing thread. The actual values are directly the priority identifiers
of the operating system, e.g. THREAD_PRIORITY_HIGHEST under Windows
or a real-time priority value under Linux. The actual priority is applied only after executing the '[Stream]StreamThreadApplyPriority' command parameter, possibly together with the '[Stream]StreamThreadSchedulingPolicy' value if applicable on given system. It is the responsibility of the application to ensure that the calling process has sufficient privileges to apply the priority change and that the value written to the parameter is a valid priority identifier. After applying '[Stream]StreamThreadApplyPriority', the application can read back the priority value to verify if it was properly applied. Note that when opening the device, the Media Foundation Producer attempts itself to elevate the thread priority to a suitable value. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'[Stream]StreamThreadSchedulingPolicy' | <scheduling_policy> | integer | pre-defined | OS-specific scheduling policy value to be used for the internal stream processing thread. The actual values are directly the priority identifiers
of the operating system, e.g. SCHED_FIFO under Linux.
Note that this feature is not available under Windows. The actual scheduling policy is applied only after executing the '[Stream]StreamThreadApplyPriority' command parameter, together with the '[Stream]StreamThreadPriority' value. It is the responsibility of the application to ensure that the calling process has sufficient privileges to apply the scheduling policy and that the value written to the parameter is a valid scheduling policy identifier. After applying '[Stream]StreamThreadApplyPriority', the application can read back the scheduling policy value to verify if it was properly applied. BEWARE: Setting this parameter can lead to an unusable or poorly performing system, use with care. |
|
'AcquisitionFrameRate' | real | dynamic | Media Foundation Remote Device Parameter: returns the frame rate selected in 'MFMediaType'. Contrary to the SFNC behaviour of this feature, for the Media Foundation Producer this parameter is a read only parameter. | ||
'add_objectmodel3d_overlay_attrib' | 'disable', 'enable' | 'disable' | string | pre-defined | This parameter has no effect. |
'Aperture' | real | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's aperture setting This parameter corresponds to the CameraControl_Iris property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'ApertureAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic aperture mode This parameter corresponds to the CameraControl_Iris capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Aperture is not available. The availability of this parameter depends on the connected device. | |
'available_callback_types' | ['<callback_types>'] | string | dynamic | Returns a list containing all parameters, for which a callback can be registered. This includes all parameters published by the device and Media Foundation Producer via the GenICam interface, including those temporarily unavailable, because availability change might be coupled with the callback. | |
'available_easyparam_names' | '[Consumer]exposure_auto', '[Consumer]exposure', '[Consumer]gain_auto', '[Consumer]gain', '[Consumer]info_general' | string | pre-defined | Returns a list containing all MVTec EasyParams (see MVTec EasyParams). | |
'available_param_names' | ['<names>'] | string | dynamic | Returns a list containing all available parameters, i.e. those used by the HALCON MediaFoundation image acquisition interface and those published by the device and Media Foundation Producer via the GenICam interface (see parameter naming conventions). The availability of some parameters might depend on acquisition status, values of other parameters or other conditions, so the list dynamically changes during runtime. | |
'BacklightCompensation' | 'Off', 'On' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's backlight compensation setting This parameter corresponds to the VideoProcAmp_BacklightCompensation property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | |
'bits_per_channel' | -1, 8, 10, 12, 14, 16 | -1 | integer | pre-defined | Number of bits per channel of the resulting HALCON image. In case of -1 the bit depth of each respective acquired buffer is used. By specifying a value greater than 8 the grabbed images are delivered as uint2 images. |
'BlackLevel' | real | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's black level setting This parameter corresponds to the VideoProcAmp_Brightness property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'BlackLevelAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic black level mode This parameter corresponds to the VideoProcAmp_Brightness capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', BlackLevel is not available. The availability of this parameter depends on the connected device. | |
'buffer_frameid' | <frame_id> | integer | dynamic | Frame ID attached to the last grabbed (image) buffer by the device (or Media Foundation Producer). Typically sequentially incremented number of the frame. Skipped ID's in the sequence could indicate that one or more frames was dropped in the device or Media Foundation Producer, for example due to acquisition engine overflow reasons. Note that on 32-bit systems only the lower 32-bit part of up to 64-bit timestamp is delivered (unless 'split_param_values_into_dwords' parameter is enabled). See acquisition buffer handling. | |
'buffer_is_incomplete' | 0, 1 | integer | dynamic | Shows if the last grabbed image is incomplete (e.g. due to lost packets). See acquisition buffer handling. | |
'buffer_reallocation_mode' | 'only_increase_size', 'follow_payloadsize' | 'only_increase_size' | string | pre-defined | Defines the strategy to follow when reallocating the buffers for a new acquisition. In case of 'only_increase_size', the buffers will be only reallocated when the payload size increases. In case of 'follow_payloadsize', the buffers will be reallocated every time the payload size changes. |
'buffer_timestamp' | <timestamp> | integer | dynamic | Timestamp attached to the last grabbed (image) buffer by the device (or Media Foundation Producer). The unit and actual meaning of the timestamp (when it is generated) is device specific. If the frequency of the timestamp counter is known, the value in nanoseconds can be read from 'buffer_timestamp_ns'. Note that on 32-bit systems only the lower 32-bit part of up to 64-bit timestamp is delivered (unless 'split_param_values_into_dwords' parameter is enabled). See acquisition buffer handling. | |
'buffer_timestamp_ns' | <timestamp> | integer | dynamic | Timestamp attached to the last grabbed (image) buffer by the device (or Media Foundation Producer). The value is in nanoseconds, but might not be available if the timestamp frequency is unknown (refer also to 'buffer_timestamp' and 'device_timestamp_frequency'). Note that on 32-bit systems only the lower 32-bit part of up to 64-bit timestamp is delivered (unless 'split_param_values_into_dwords' parameter is enabled). See acquisition buffer handling. | |
'camera_type' | 'default', <ini/xml filename> | 'default' | string | pre-defined | Returns the path to the configuration file used for the CameraType parameter in open_framegrabber. |
'clear_buffer' | 'disable', 'enable' | 'disable' | string | pre-defined | If enabled, each buffer content is cleared before re-queueing (all bytes set to 0xF0 regardless the expected pixel format), so you can see which parts of an image are missing, in case e.g. the transfer of some image packets failed. This parameter adds of course a runtime overhead to write the 0xF0 data every time a buffer is queued. It is mainly useful for debugging in combination with transport layers which do not guarantee the transfer of complete images. Please note, that this parameter does not modify the buffer queue, only the content of a buffer will be set to a defined state. |
'color_space' | 'default', 'gray', 'raw', 'rgb', 'rgbx', 'yuv' | 'default' | string | pre-defined | Returns the current color space. |
'ColorEnable' | 'Off', 'On' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's color enable setting This parameter corresponds to the VideoProcAmp_ColorEnable property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | |
'confidence_mode' | 'off', 'object_model_3d' | 'off' | string | pre-defined | This parameter has no effect. |
'confidence_threshold' | [0.0, 1.0] | 0.5 | float | pre-defined | This parameter has no effect. |
'Contrast' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's contrast setting This parameter corresponds to the VideoProcAmp_Contrast property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'ContrastAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic contrast mode This parameter corresponds to the VideoProcAmp_Contrast capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Contrast is not available. The availability of this parameter depends on the connected device. | |
'coordinate_transform_mode' | 'none', 'cartesian', 'reference' | 'reference' | string | pre-defined | This parameter has no effect. |
'create_objectmodel3d' | 'disable', 'enable' | 'disable' | string | pre-defined | This parameter has no effect. |
'data_contents' | 'unknown', 'object_model_3d', 'text_report' | 0 | string | pre-defined | Tuple describing logical type of the control data outputs returned by the last grab operator. Not applicable if last successful grab was performed through grab_image/grab_image_async.
In case of grab_data/grab_data_async it returns a tuple of the size
corresponding to the number of control data values returned through those operators.
Possible values are:
|
'data_purpose_id' | --- | 0xFFFFFFFFFFFFFFFF | integer | pre-defined | Tuple of integer values allowing to track data purpose IDs associated to individual control data outputs returned by the last grab operator. Intended for advanced use cases when the data should be matched with the device configuration. The use of the parameter is application specific and requires knowledge of the GenICam SFNC data model and specific device. Not applicable if last successful grab was performed through grab_image/grab_image_async. In case of grab_data/grab_data_async it returns a tuple of the size corresponding to the number of control data values returned through those operators. If the ID could not be identified (e.g. because the underlying communication protocol does not provide such information), invalid value will be returned (max value of given integer range). |
'data_region_id' | --- | 0xFFFFFFFFFFFFFFFF | integer | pre-defined | Tuple of integer values allowing to track region IDs associated to individual control data outputs returned by the last grab operator. Intended for advanced use cases when the data should be matched with the device configuration. The use of the parameter is application specific and requires knowledge of the GenICam SFNC data model and specific device. Not applicable if last successful grab was performed through grab_image/grab_image_async. In case of grab_data/grab_data_async it returns a tuple of the size corresponding to the number of control data values returned through those operators. If the ID could not be identified (e.g. because the underlying communication protocol does not provide such information), invalid value will be returned (max value of given integer range). |
'data_source_id' | --- | 0xFFFFFFFFFFFFFFFF | integer | pre-defined | Tuple of integer values allowing to track source IDs associated to individual control data outputs returned by the last grab operator. Intended for advanced use cases when the data should be matched with the device configuration. The use of the parameter is application specific and requires knowledge of the GenICam SFNC data model and specific device. Not applicable if last successful grab was performed through grab_image/grab_image_async. In case of grab_data/grab_data_async it returns a tuple of the size corresponding to the number of control data values returned through those operators. If the ID could not be identified (e.g. because the underlying communication protocol does not provide such information), invalid value will be returned (max value of given integer range). |
'delay_after_stop' | <milliseconds> | 0 | integer | pre-defined | The time to wait (in milliseconds) between stopping the acquisition on the device (AcquisitionStop command) and Media Foundation Producer. |
'device' | ' | device:<device id> | unique_name:<unique name> | interface:<interface id> | producer:Masimov' | string | dynamic | Returns the Device parameter string used when opening the device (open_framegrabber). | |
'device_event_handling' | 0, 1 | 1 | integer | pre-defined | Value of the device_event_handling generic parameter specified in open_framegrabber. The device_event_handling is by default switched on for devices with event delivery (message channel) support and off for devices without the event capability. The generic parameter device_event_handling explicitly allows switching the event handling functionality off even for devices with event support. |
'device_timestamp_frequency' | <frequency_hz> | integer | dynamic | Frequency of the timestamp counter of the device, in ticks per second (Hz). The frequency might not be known for all devices. The counter is used for example to attach timestamps to acquired buffers. Note that on 32-bit systems only the lower 32-bit part of up to 64-bit timestamp is delivered (unless 'split_param_values_into_dwords' parameter is enabled). | |
'DeviceModelName' | <pid_xxx> | string | dynamic | Media Foundation Remote Device Parameter: returns the device USB product ID. | |
'DeviceVendorName' | <vid_xxx> | string | dynamic | Media Foundation Remote Device Parameter: returns the device USB vendor ID. | |
'event_data' | '<list of genicam_feature/internal_parameter>' | string | pre-defined | Configures GenICam features and/or internal parameters (free mix) to be added to the message queue specified by 'event_message_queue'
for feature change notifications for feature selected in 'event_selector'. Features can be added individually or as a tuple - each 'set' operation for this parameter appends to the current list of event_data. To remove individual features, prepend them with a '~'. To clear all currently added features, call set_framegrabber_param(..., 'event_data', []). Read more about the usage of this mechanism at Event Message Queues. |
|
'event_message_queue' | 0, '<queue_handle>' | handle | pre-defined | Selects a message queue to which the acquisition interface should send feature change notifications (see further details in
Event Message Queues). The corresponding feature/parameter needs to be previously selected by 'event_selector'. Setting 0 (NULL) unregisters the previously selected message queue from notifications about given feature/parameter. |
|
'event_notification_helper' | 'disable', 'enable' | 'disable' | string | pre-defined | Controls if the acquisition interface should attempt to automatically (un)set 'EventNotification' during set_framegrabber_callback if the callback is being (un)registered on an SFNC-compliant event. Note that this will only work if the callback is being registered on the actual event feature (e.g. 'EventExposureEnd'), not on one of the event data features (e.g. 'EventExposureEndTimestamp'). For further information on events, see Event Data. |
'event_selector' | '<genicam_feature/internal_parameter>' | 'grab_timeout' | string | pre-defined | Selects a GenICam feature or internal parameter for which feature change notifications through message queues
should be configured. They are sent to the message queue specified by 'event_message_queue', together with additional data configured in 'event_data'. Read more about the usage of this mechanism at Event Message Queues (which is another alternative to notifications through callbacks, Feature Change Notifications). |
'ExposureAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic exposure mode This parameter corresponds to the CameraControl_Exposure capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', ExposureTime is not available. The availability of this parameter depends on the connected device. | |
'ExposureTime' | <us> | real | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's exposure setting in microseconds This parameter corresponds to the CameraControl_Exposure property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | |
'external_trigger' | <default> | 'false' | string | pre-defined | The value is not used, so a default value is returned. |
'field' | '<default>' | 'progressive' | string | pre-defined | The value is not used, so a default value is returned. |
'Focus' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's focus setting This parameter corresponds to the CameraControl_Focus property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'FocusAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic focus mode This parameter corresponds to the CameraControl_Focus capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Focus is not available. The availability of this parameter depends on the connected device. | |
'Gain' | real | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's gain setting This parameter corresponds to the VideoProcAmp_Gain property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'GainAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic gain mode This parameter corresponds to the VideoProcAmp_Gain capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Gain is not available. The availability of this parameter depends on the connected device. | |
'Gamma' | real | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's gamma setting This parameter corresponds to the VideoProcAmp_Gamma property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'GammaAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic gamma mode This parameter corresponds to the VideoProcAmp_Gamma capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Gamma is not available. The availability of this parameter depends on the connected device. | |
'generic' | '', ['num_buffers=<num>' ], -1 | -1 | mixed | pre-defined | Values of the Generic parameter. |
'grab_timeout' | <milliseconds> | 5000 | integer | pre-defined | Current grab timeout in milliseconds. |
'Height' | integer | dynamic | Media Foundation Remote Device Parameter: reflects the image height selected in 'MFMediaType'. Contrary to the SFNC behaviour of this feature, for the Media Foundation Producer this parameter is a read only parameter. | ||
'horizontal_resolution' | 0, resolution | 1 | integer | pre-defined | Current value of horizontal resolution. |
'Hue' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's hue setting This parameter corresponds to the VideoProcAmp_Hue property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'HueAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic hue mode This parameter corresponds to the VideoProcAmp_Hue capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Hue is not available. The availability of this parameter depends on the connected device. | |
'image_available' | 0, 1 | integer | dynamic | Shows if there is currently an image waiting for delivery by the Media Foundation Producer. | |
'image_contents' | 'unknown', 'image' | 0 | string | pre-defined | Tuple describing the logical type of the image data returned by the last grab operator. If the last successful grab was performed through grab_image/grab_image_async, the parameter
returns always single value. In case of grab_data/grab_data_async it returns a tuple of the size
corresponding to the number of images returned through those operators.
Possible values are:
|
'image_height' | <height> | 0 | integer | pre-defined | Height of the last acquired image. See acquisition buffer handling. If there is no valid last buffer available, the last queried value of the 'Height' parameter of the remote device is returned. |
'image_pixel_format' | --- | 0 | integer | pre-defined | Tuple of integer values representing the ID of the original pixel formats of the source data used to generate individual image outputs. This is typically the PFNC 32-bit ID of given pixel format - if unknown or if the data used to generate given image output is not naturally an image, zero will be reported. If the source data is a multi-component image (such as RGB or multi-component 3D coordinate format), the original multi-component pixel format is reported, no matter if all of the components were used to generate given image output (such as an RGB image) or if the image output reflects only one of the components (such as individual 3D coordinate planes, output as separate HALCON images). The original multi-component pixel format might be planar format or not. Note that the color space and bit depth of the actual HALCON image might significantly differ from the source format if the user requests color space conversion through the 'bits_per_channel' and 'color_space' parameters. |
'image_purpose_id' | --- | 0xFFFFFFFFFFFFFFFF | integer | pre-defined | Tuple of integer values allowing to track data purpose IDs associated to individual image outputs returned by the last grab operator. Intended for advanced use cases when the data should be matched with the device configuration. The use of the parameter is application specific and requires knowledge of the GenICam SFNC data model and specific device. If the last successful grab was performed through grab_image/grab_image_async, the parameter returns always single value. In case of grab_data/grab_data_async it returns a tuple of the size corresponding to the number of images returned through those operators. If the ID could not be identified (e.g. because the underlying communication protocol does not provide such information), invalid value will be returned (max value of given integer range). |
'image_raw_buffer_padding_bytes' | --- | 0 | integer | pre-defined | Tuple of integers reporting for raw buffers of type 'blob' (see 'image_raw_buffer_type') the size of unused padding bytes at the end of such grabbed HALCON image. Because artificial dimensions need to be chosen for the resulting HALCON image in this case, the size of such image might not exactly equal the size of the buffer data and thus the padding might be needed. Zero is reported for buffers of type 'image'. Applies only in case of the 'raw' color format. See raw output format chapter. If the last successful grab was performed through grab_image/grab_image_async, the parameter returns always single value. In case of grab_data/grab_data_async it returns a tuple of the size corresponding to the number of images returned through those operators. |
'image_raw_buffer_type' | 'image', 'blob' | 0 | string | pre-defined | Tuple of strings showing whether the last grabbed HALCON image(s) is created from buffer containing real image data with known properties (in particular image size and pixel format) or if it is created from a blob of other data (non-image data or image data of unknown format). Note that in case of the blob data the dimensions of the HALCON image are meaningless. Applies mainly in case of the 'raw' color format. Possible values are 'image' and 'blob'. See raw output format chapter. If the last successful grab was performed through grab_image/grab_image_async, the parameter returns always single value. In case of grab_data/grab_data_async it returns a tuple of the size corresponding to the number of images returned through those operators. |
'image_region_id' | --- | 0xFFFFFFFFFFFFFFFF | integer | pre-defined | Tuple of integer values allowing to track region IDs associated to individual image outputs returned by the last grab operator. Intended for advanced use cases when the data should be matched with the device configuration. The use of the parameter is application specific and requires knowledge of the GenICam SFNC data model and specific device. If the last successful grab was performed through grab_image/grab_image_async, the parameter returns always single value. In case of grab_data/grab_data_async it returns a tuple of the size corresponding to the number of images returned through those operators. If the ID could not be identified (e.g. because the underlying communication protocol does not provide such information), invalid value will be returned (max value of given integer range). |
'image_source_id' | --- | 0xFFFFFFFFFFFFFFFF | integer | pre-defined | Tuple of integer values allowing to track source IDs associated to individual image outputs returned by the last grab operator. Intended for advanced use cases when the data should be matched with the device configuration. The use of the parameter is application specific and requires knowledge of the GenICam SFNC data model and specific device. If the last successful grab was performed through grab_image/grab_image_async, the parameter returns always single value. In case of grab_data/grab_data_async it returns a tuple of the size corresponding to the number of images returned through those operators. If the ID could not be identified (e.g. because the underlying communication protocol does not provide such information), invalid value will be returned (max value of given integer range). |
'image_width' | <width> | 0 | integer | pre-defined | Width of the last acquired image. See acquisition buffer handling. If there is no valid last buffer available, the last queried value of the 'Width' parameter of the remote device is returned. |
'line_in' | <default> | 0 | integer | pre-defined | The value is not used, so a default value is returned. |
'MFMediaType' | <video_subtype>_<width>x<height>_<framerate>fps | string | dynamic | Media Foundation Remote Device Parameter: configures the Microsoft Media Foundation video subtype, image resolution and frame rate. The values are in the form
<video_subtype>_<width>x<height>_<framerate>fps, for example
'YUY2_1280x720_10fps'. If the video subtype is unknown, the 'MFMediaType' value starts with its Globally
Unique Identifier (GUID), for instance: {3131564E-0000-0010-8000-00AA00389B71}. When opening the device,
by default, an RGB (if available) video subtype is chosen, with best settings, meaning the widest width,
highest height and fastest frame rate combination. The feature 'PixelFormat' and the read only features
'Width', 'Height' and 'AcquisitionFrameRate' reflect the selected combination. When changing the
'PixelFormat', the 'MFMediaType' is switched to the corresponding video subtype with best settings.
Additionally, the following situations need to be considered:
|
|
'name' | 'MediaFoundation' | string | pre-defined | Name of the HALCON interface. | |
'num_buffers' | <number> | 4 | integer | pre-defined | Number of buffers used for the image acquisition. |
'num_buffers_await_delivery' | <number> | integer | dynamic | Number of (image) buffers waiting for delivery by the Media Foundation Producer. | |
'num_buffers_underrun' | <number> | integer | dynamic | Number of lost buffers due to buffer queue underrun since opening the device. Queue underrun occurs when the Media Foundation Producer has a new image data available, but it has no free buffer to store them. | |
'Pan' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's pan setting This parameter corresponds to the CameraControl_Pan property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'PanAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic pan mode This parameter corresponds to the CameraControl_Pan capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Pan is not available. The availability of this parameter depends on the connected device. | |
'PixelFormat' | string | dynamic | Media Foundation Remote Device Parameter: current pixel format corresponding to the Microsoft Media Foundation video subtype selected in 'MFMediaType'. If the access of 'PixelFormat' is 'na' (not available), the current selected video subtype has no equivalent GenICam pixel format, and raw data is expected to be returned. See 'MFMediaType' parameter for further information. | ||
'port' | <port> | -1 | integer | pre-defined | The value is not used, so a default value is returned. |
'revision' | '<revision>' | string | pre-defined | Revision number of the MediaFoundation interface. | |
'Roll' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's roll setting This parameter corresponds to the CameraControl_Roll property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'RollAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic roll mode This parameter corresponds to the CameraControl_Roll capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Roll is not available. The availability of this parameter depends on the connected device. | |
'Saturation' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's saturation setting This parameter corresponds to the VideoProcAmp_Saturation property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'SaturationAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic saturation mode This parameter corresponds to the VideoProcAmp_Saturation capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Saturation is not available. The availability of this parameter depends on the connected device. | |
'settings_selector' | 'RemoteDevice', 'Stream', 'Device', 'System', 'Interface', 'Consumer' | 'RemoteDevice' | string | pre-defined | Selects for which component (set of parameters) the streamable parameters are persisted into a file or restored from a file when using set_framegrabber_param(..., 'do_write_settings', []) and set_framegrabber_param(..., 'do_load_settings', []). Selects among the actual (remote) device, one of the Media Foundation Producer modules or the Consumer parameters (internal parameters of MediaFoundation image acquisition interface). Read more about the usage of this mechanism at Parameters – Persisting Device Status. |
'Sharpness' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's sharpness setting This parameter corresponds to the VideoProcAmp_Sharpness property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'SharpnessAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic sharpness mode This parameter corresponds to the VideoProcAmp_Sharpness capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', Sharpness is not available. The availability of this parameter depends on the connected device. | |
'split_param_values_into_dwords' | 'disable', 'enable' | 'disable' | string | pre-defined | Enables a special mode allowing the treatment of integer parameters as tuple of two 32-bit integers. For compatibility with the single-parameter mode, the first tuple element carries always the low 32-bit part of the value, second element carries the high 32-bit part. It is user's responsibility to combine the two parts correctly. This mode is intended especially to help to overcome the problem of 32-bit HALCON featuring only 32-bit integer parameters but having to face up to 64-bit wide GenICam features. In this mode, the get_framegrabber_param returns always a tuple of two integers, set_framegrabber_param accepts both a single parameter or a tuple. Note that this mode affects only integer parameters and only the GenICam based ones, not the internal parameters of HALCON MediaFoundation image acquisition interface - with few exceptions, the 'buffer_timestamp', 'buffer_timestamp_ns', 'device_timestamp_frequency' and 'buffer_frameid' internal parameters. |
'start_async_after_grab_async' | 'disable', 'enable' | 'enable' | string | pre-defined | Status of 'start_async_after_grab_async'. |
'start_column' | <column> | 0 | integer | pre-defined | Unsupported, returns always 0. |
'start_row' | <row> | 0 | integer | pre-defined | Unsupported, returns always 0. |
'streaming_mode' | 0, 1 | 1 | integer | pre-defined | Value of the streaming_mode generic parameter specified in open_framegrabber. The streaming_mode is by default switched on for devices with streaming support and off for peripheral devices (devices without any data streams). The generic parameter streaming_mode explicitly allows switching the streaming functionality off, even for devices with streaming support. |
'Tilt' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's tilt setting This parameter corresponds to the CameraControl_Tilt property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'TiltAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic tilt mode This parameter corresponds to the CameraControl_Tilt capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Tilt is not available. The availability of this parameter depends on the connected device. | |
'vertical_resolution' | 0, resolution | 1 | integer | pre-defined | Current value of vertical resolution. |
'volatile' | 'disable', 'enable' | 'disable' | string | pre-defined | Current value of the volatile mode. |
'WhiteBalance' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's white balance setting This parameter corresponds to the VideoProcAmp_WhiteBalance property of the DirectShow's IAMVideoProcAmp interface. The availability of this parameter depends on the connected device. | ||
'WhiteBalanceAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic white balance mode This parameter corresponds to the VideoProcAmp_WhiteBalance capability VideoProcAmpFlags. of the DirectShow's IAMVideoProcAmp interface. If set to 'Continuous', WhiteBalance is not available. The availability of this parameter depends on the connected device. | |
'Width' | integer | dynamic | Media Foundation Remote Device Parameter: reflects the image width selected in 'MFMediaType'. Contrary to the SFNC behaviour of this feature, for the Media Foundation Producer this parameter is a read only parameter. | ||
'Zoom' | integer | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's zoom setting This parameter corresponds to the CameraControl_Zoom property of the DirectShow's IAMCameraControl interface. The availability of this parameter depends on the connected device. | ||
'ZoomAuto' | 'Off', 'Continuous' | string | dynamic | Media Foundation Remote Device Parameter: if supported by the device, it specifies the camera's automatic zoom mode This parameter corresponds to the CameraControl_Zoom capability CameraControlFlags of the DirectShow's IAMCameraControl interface. If set to 'Continuous', Zoom is not available. The availability of this parameter depends on the connected device. |
Operator set_framegrabber_lut
Operator get_framegrabber_lut
Operator set_framegrabber_callback
The callback can be registered for any GenICam based features, i.e., features published by the device and Media Foundation Producer through the GenICam description files as well as for internal parameters of the acquisition interface.
The list of supported callback targets can be queried by calling get_framegrabber_param(..., 'available_callback_types', ...).
One of the important use cases for feature change callbacks is the device event delivery mechanism, see details in event data and feature notifications sections. The 'CallbackType' parameter of set_framegrabber_callback defines the feature for which the callback is registered. It is the same plain feature name as used with set_framegrabber_param, including a possible prefix, such as '[Device]' (refer to the parameter naming convention).
The registered callback function would be called whenever a given feature is potentially changed (including its other properties such as range or access mode). Note that it does not necessarily always mean that the feature actually has a new value. If the callback function is set to NULL, the corresponding callback will be unregistered. Note that the interface keeps just a single registration for every feature, if you attempt to register a new callback for a feature that already had a callback registered, the previous registration will be replaced with the new one.
The signature of the callback function is Herror (__stdcall *HAcqCallback)(void *AcqHandle, void *Context, void *UserContext) and uses the following parameters:
- AcqHandle: Acquisition handle of the corresponding image acquisition instance.
- Context: Optional context data of the specific callback. Up to now, this parameter is not used, i.e., Context is set to NULL.
- UserContext: Optional context data of the specific callback. Up to now, this parameter is not used, i.e., UserContext is set to NULL.
Note that the execution time of a user-specific callback function must
always be as short as possible since during the execution of a callback
function the handling of further internal callbacks might be blocked.
This can be achieved by removing the current processing from the
user-specific callback function to a separate thread that is controlled
via signals or events. The callback function is executed in the context
of the underlying interface or driver.
It is also important to understand that the callbacks might be fired as
a side-effect of parameter-setting or grab operations, ie. it might be
called from within their respective locks. The user is responsible
to take this into account in the callback handler to avoid risk of
a deadlock.
Operator get_framegrabber_callback
Operator grab_image_start
Operator grab_image
Operator grab_image_async
The 'MaxDelay' parameter of the grab_image_async operator is ignored by the HALCON MediaFoundation acquisition interface, because there is no way to support it reliably . If needed, the application needs to implement alternative functionality on its own.
Operator grab_data
Operator grab_data_async
The 'MaxDelay' parameter of the grab_image_async operator is ignored by the HALCON MediaFoundation acquisition interface, because there is no way to support it reliably . If needed, the application needs to implement alternative functionality on its own.
Operator close_framegrabber
HDevelop Examples
- mediafoundation_mediatypes.hdev - Changing pixel format, image resolution and frame rate.
Troubleshooting
General:
- Check if the latest revision of the HALCON MediaFoundation interface is used.
- Check the System Requirements.
- Check if the device has the latest firmware.
- Enable low-level error messages in HALCON to query more information about the problem (and check the output console in HDevelop if applicable).
- Check if the correct GenICam binaries are in use. HALCON uses the official binaries in a private installation (folder genicam in the HALCONROOT directory). If other GenICam binaries are in your path or in some system path (for Windows e.g. in c:\Windows\System32\ for Linux e.g. in /usr/lib or similar directories) make sure these are the official ones by comparing them with the ones in the HALCON installation. Using unofficial binaries might result in strange problems.
The following information is needed for your support request to avoid unnecessary inquiries.
- Used HALCON and acquisition interface versions.
- Used HALCON architecture (especially 32 or 64 bit).
- Low-level error messages if there are any.
- Camera manufacturer, model and firmware version.
- Details about computer system, like operating system, RAM and CPU.
- Minimal sample code (e.g. HDevelop script) to reproduce the issue.
- Description of observed and expected behavior.
Usage of third-party libraries
You can request the source for those third-party libraries licensed under GPL or LGPL via email to info@mvtec.com with the subject "Request source code of third-party libraries".
Release Notes
- Revision 20.11.3 (Mar 5, 2024):
- The underlying GenApi version has been updated to the latest official release 3.4.2. This fixes a compatibility break with certain persistence files introduced in version 3.4.1.
- Loading of configuration files during open_framegrabber (with the parameter CameraType) did not raise an exception, even when the file could not be read. This problem has been fixed.
- When passing GenICam persistence files to open_framegrabber, the remote device was silently ignored. This problem has been fixed.
- Revision 20.11.2 (Aug 7, 2023):
- The underlying GenApi version has been updated to the latest official release 3.4.1. This improves the validation of the string representation of parameters written through the '_string' postfix.
- This interface is now compiled against the Windows SDK version 10.0.22000.0.
- Camera settings control is now supported.
- Pixel formats 'YCbCr420_8_YY_CbCr_Semiplanar', 'YCbCr420_8_YY_CrCb_Semiplanar', 'YCbCr422_8_YY_CbCr_Semiplanar', and 'YCbCr422_8_YY_CrCb_Semiplanar' are now supported.
- Microsoft Media Foundation video format MFVideoFormat_NV12, MFVideoFormat_NV21, and MFVideoFormat_MJPG are now supported.
- Bottom-up images were not correctly interpreted. This problem has been fixed.
- The first access to an MVTec EasyParam could change the value of its equivalent GenICam device parameter. This problem has been fixed.
- Accessing an MVTec EasyParam could lead to a crash if any of the underlying GenICam parameters had an unexpected type. This problem has been fixed.
- Querying the '_representation' of an MVTec EasyParam could in some cases lead to a crash. This problem has been fixed.
- In rare cases, the access of not implementable MVTec EasyParams was erroneously set to 'na', instead of 'ni'. This problem has been fixed.
- Revision 20.11.1 (Apr 5, 2023):
- First official release.