Operator Reference
Image Source
Introduction
The image source concept enables the HALCON user to configure and handle the usage of machine vision cameras to acquire images for their machine vision task. It replaces the framegrabber operator set (see Image / Acquisition) as HALCON's recommended way to access cameras.
This chapter gives guidance on the concept and usage of image sources.
Image Source Concept
The machine vision device and all further components that are involved in the process of acquiring image data can be controlled using an image source handle. It is designed to encapsulate the so-called modules of the image source:
-
plugins,
-
interfaces,
-
devices and
-
streams.
These modules are structured in a hierarchical parent-child configuration, with each module acting as a parent to the subsequent one. The module concept of the image sources is modeled after the GenICam GenTL standard.
To acquire images from the image source handle, an image source plugin is used to communicate to the imaging device through an interface. The imaging device provides access to one or multiple image streams. The images transmitted through that stream eventually arrive in multiple buffers in the memory of the host application. All this complexity is hidden from the user in most applications, and per default any image source handle will try to connect to a full chain of image source modules: plugin > interface > device > stream.
However, for certain applications it might be necessary to connect to a specific module. For instance, using the scheme above as a representation of an exemplary system, it might be desired to configure the parameters of a framegrabber before a camera is connected to it. Image source handles can be configured to solely connect to the parent image source plugin and the respective GenTL interface module . The interface module then allows to configure the framegrabber without a connection to a child module. Likewise, image source handles can be used to connect to any other available module or to specify a desired module if multiple options are available (e.g., whether to choose stream or of the device in the scheme above).
States of the Image Source Handle
An image source handle can be in different states. In each state a different set of operations is available. The image source operators can be used to trigger such state changes.
The three possible states are:
- Initialized
The image source handle should contain enough information to specify which device should be connected with
. The operatorsconnect_image_source
andset_image_source_param
provide access to the parameters of theget_image_source_param
'image_source'
group. These are always existent, regardless of the connection state.- Connected
-
The operator
is only available in this state.snap_from_image_source
briefly changes the image source handle to the streaming state, but resets it again when an image has arrived.snap_from_image_source
The operators
andset_image_source_param
provide access to the parameters of all different modules, including the device module. The device module allows to configure the imaging hardware, e.g., a machine vision camera.get_image_source_param
In this state typical machine vision devices are utilized exclusively, meaning other applications can discover, but not access them.
- Streaming
-
In this state the imaging device can transmit image data continuously in the background. The images arrive in an internal image buffer queue from which they can be pulled with
.fetch_from_image_source
is only available in this state.fetch_from_image_source
In the streaming state the device might prevent certain parameters from being changed. This is done to ensure a reliable image transmission. As a consequence the operator
might not be able to change all device parameters and might deliver an error instead. In that case, return to the connected state first.set_image_source_param
Parameter Groups and Their Relation to the Modules
Each module can be configured with
.
To indicate which module of the image source to configure
the parameters are divided into groups. This is how the grouped parameters
are related to the GenTL modules. Plugins that are not provided by MVTec,
might group their parameter documentation according to the GenTL module names.
get_image_source_param
Parameter Group | GenTL Module Name | Remarks |
---|---|---|
'image_source' |
- |
The parameter group 'image_source' configures the module chain
plugin > interface > device > stream
and as such it sits 'on-top' of the GenTL Modules.
These parameters are implemented by MVTec and exist all the time,
regardless of the connection state. |
'plugin' |
System | Parameters for global configuration in the loaded plugin. Parameters in this group depend on which plugin is loaded and are implemented by the provider of the loaded plugin. Plugins can be provided by MVTec or other manufacturers. |
'interface' |
Interface | Parameters for configuring the hardware component that is interfacing to the devices. Parameters in this group depend on which plugin is loaded and are implemented by the provider of the loaded plugin. Plugins can be provided by MVTec or other manufacturers. |
'local_device' |
Device | Software abstraction for the hardware device. This group exists for technical reasons of the GenTL standard and can be ignored most of the cases. Parameters in this group depend on which plugin is loaded and are implemented by the provider of the loaded plugin. Plugins can be provided by MVTec or other manufacturers. |
'device' |
Remote Device | Parameters for configuring the imaging hardware (e.g. machine vision cameras, sensors, devices). Use this to configure the most important properties of the image generation like exposure time, gain, width, height and trigger mode. Parameters in this group depend on which device is connected and are implemented by the manufacturer of the connected device. |
'stream' |
Stream | Parameters for configuring the details of the image transmission on the receiving side. Parameters in this group depend on which plugin is loaded and are implemented by the provider of the loaded plugin. Plugins can be provided by MVTec or other manufacturers. |
Migration Guide
Expand here for information on migration from framegrabber to image source operators.
The following table provides a comparison between the old framegrabber and the new image source operators. When switching an application to the newer image sources, replace each framegrabber operator with its corresponding image source operator.
Operator | Remarks concerning migration |
---|---|
old:
new: |
per default returns a string for each found
device, which can be used for .
per default returns an image source handle
for each device, which can be used for . |
old: No direct equivalent
new: |
creates an image source handle in an
unconnected state.
This is not possible with framegrabber operators. |
old:
new: |
is creating the framegrabber handle and
connecting to the imaging hardware at the same time.
Image source handles split this into two operations:
followed by .
This allows to use with handles
obtained by or by . |
old:
new: |
at the same time destroys the
framegrabber handle. It can only be re-created with
.
leaves the image source handle intact.
It can be used with to re-connect. |
old:
new: |
Works similar, but the parameter group is now specified with the
'group' instead of using the
[<GenTL module>] prefix.
Example:
old:
new:
|
old:
new: |
Works similar. The relation is analogous to
and (see above). |
old: No direct equivalent
new: |
Framegrabber handles provide parameters with the prefix
'do_'. This kind of parameters is replaced by actions available
via .
also allows to list all parameters
(previously ). |
old:
new: |
Works similar. |
old:
new: |
is automatically executed by the first
call, if
was not previously called.
is not automatically executed by the first
call. |
old: No direct equivalent
new: |
Some framegrabber handles provide the special parameter
'do_abort_grab' , which serves the same purpose that
does. |
old:
new: |
Works similar. |
old:
new: No direct equivalent |
combines the use cases covered by
and .
Additionally, meta data like buffer timestamps and frame
IDs is returned alongside and does not need to be queried separately. |
old:
new: No direct equivalent |
combines the use cases covered by
and .
Additionally, meta data like buffer timestamps and frame
IDs is returned alongside and does not need to be queried separately. |
old:
old:
old:
old:
|
No direct equivalent |
The following table shows the relations between MVTec image source plugins and classical image acquisition interfaces:
Image Source Plugin | Corresponding image acquisition interface | Remarks |
---|---|---|
'mvtec_gigevision' |
GigEVision2 |
The 'mvtec_gigevision' plugin contains the same GigE Vision
standard implementation that is contained in the GigEVision2
image acquisition interface. Despite its name (GigEVision2)
the plugin, as well as the image acquisition interface, allow
access to all GigE Vision cameras, regardless of which version
of the GigE Vision standard the camera implements. |
'mvtec_usb3vision' |
USB3Vision |
The 'mvtec_usb3vision' plugin contains the same implementation
of the USB3 Vision standard that is contained in the USB3Vision
image acquisition interface. |
'mvtec_realsense' |
RealSense |
The 'mvtec_realsense' plugin interfaces to the Intel RealSense SDK
and contains the same low-level implementation that is contained
in the RealSense image acquisition interface. |
'mvtec_mediafoundation' |
MediaFoundation |
The 'mvtec_mediafoundation' plugin interfaces to the Microsoft
Media Foundation API and contains the same low-level implementation
that is contained in the MediaFoundation image acquisition interface.
(Only available on Windows platforms) |
'mvtec_gstreamer' |
GStreamer |
The 'mvtec_gstreamer' plugin interfaces to the open source
GStreamer multimedia platform and contains the same low-level
implementation that is contained in the GStreamer Image Acquisition
Interface.
(Only available on Linux platforms)
|
More image source plugins to interface to even more image transmission technologies will be provided in the future.
Classical image acquisition interfaces not mentioned here (like “File”, “SaperaLT”, “DirectShow”) do not have a corresponding image source plugin. They must be used with the framegrabber operators.
Glossary
In the following, we describe the most important terms used in the context of image sources:
- Device
-
Device refers to the actual imaging device. This includes different kinds of sensors, ranging from conventional machine vision cameras to 3D sensors and, in special cases controllers or virtual devices.
- GenICam
-
The GenICam standard allows machine vision devices to expose their configuration properties to the connected application via a feature description XML file. HALCON image sources rely on this standard to provide access to the device configuration (see
andset_image_source_param
). Usually, HALCON users do not need to deal with these XML files directly.get_image_source_param
- GenTL
-
The GenICam GenTL standard allows machine vision applications and frameworks from different vendors to access machine vision cameras and devices from different other vendors. It specifies a clearly defined software interface that allows to hide different implementation details from the using application. An application like HALCON using different GenTL producers like the plugins might also be referred to as GenTL consumer.
- Image Source Handle
-
An image source handle provides a generic interface to a wide variety of underlying image acquisition standards and technologies. From the viewpoint of the HALCON library any image source handle provides the same basic operations. The image source handle ties together software and hardware components that are needed in order to acquire images.
- Interface
-
Interfaces refer to the hardware interfacing with the imaging device, e.g., where the cable coming from the imaging device is plugged into the host machine. Thus, in the image source context, the term “interface” does not refer to what was formerly called the image acquisition interface.
In case framegrabbers are used, each framegrabber card is typically modeled as one interface. Per default, HALCON image sources hide the complexity of multiple interface by automatically using the correct one.
- Module
-
The individual units of an image source (plugin, interface, device, stream) are called modules. Each module allows access to its parameters. The module names therefore also apply to parameter groups of the same name.
- Plugin
-
Image source plugins abstract the various technologies used to transfer images from the imaging device to the receiving application. Elsewhere, they might also be referred to as GenTL Producer. Plugins exist in form of
.cti
files on each target machine. Plugins may be selected and installed with the MVTec Software Manager. Plugins (i.e. GenTL Producers) provided by other manufacturers are automatically available after installing the manufacturer's proprietary SDK. Consult the manufacturers documentation for more in depth instructions. At runtime plugins not provided by MVTec are found by HALCON through the environment variable GENICAM_GENTL64_PATH (or GENICAM_GENTL32_PATH), which lists all the paths that contain.cti
files. - Stream
A device can allow access to none, one or multiple streams of images. The typical machine vision camera however just gives access to one stream. Per default HALCON image sources hide the complexity of multiple streams.
List of Operators
connect_image_source
- Connect to an image source.
control_image_source
- Control actions available for an image source.
create_image_source
- Create an image source handle.
disconnect_image_source
- Disconnect an image source.
fetch_from_image_source
- Fetch images and corresponding meta data from the image source buffer queue.
get_image_source_param
- Return the value of an image source parameter.
query_image_sources
- Returns handles corresponding to image sources.
set_image_source_param
- Set a parameter of an image source.
snap_from_image_source
- Acquire an image with corresponding meta data from an image source.
start_image_source
- Prepare the image source for continuously acquiring, transmitting and receiving images.
stop_image_source
- Stop the continuous acquisition, transmission and reception of images of the image source.