create_image_source🔗
Short description🔗
create_image_source — Create an image source handle.
Signature🔗
create_image_source( string PluginName, string DeviceID, attribute.name GenParamName, attribute.value GenParamValue, out image_source ImageSourceHandle )
Description🔗
create_image_source creates an image source handle and returns it
in ImageSourceHandle. The created handle is in an unconnected
state. The parameters PluginName and DeviceID can be used
to specify the plugin and device module of the image source handle.
Alternatively, the generic parameters GenParamName and
GenParamValue can be used to specify modules using identifiers
other than plugin name and device ID.
The image source handle can also be created with its modules already
specified by reading an image source configuration file. Other parameters
in the image source handle will also be set to the values configured
in this file. The image source configuration files can also store
the values of the persistable parameters of the image source modules
(device, plugin, …), which will be applied during the call to
connect_image_source. To write such configuration files
(for later use) refer to control_image_source.
For further information about the image source concept see Image Source. See the MVTec Interfaces Reference Documentation for the documentation of individual MVTec image source plugins.
The following options exist for PluginName.
-
<plugin name> Specify an image source plugin by setting the plugin name in
PluginName. You can usequery_image_sourcesto retrieve the 'plugin_name' of all available plugins. -
'none' No plugin will be specified in
ImageSourceHandle. -
'ignore' Set
PluginNameto 'ignore', when specifying the plugin using generic parameters (see below).
The following options exist for DeviceID.
-
<device ID> Specify a device by setting its device ID in
DeviceID. You can usequery_image_sourcesto retrieve the 'device_id' of all available devices. -
'none' No device will be specified in
ImageSourceHandle. -
'ignore' Set
DeviceIDto 'ignore', when specifying the device using generic parameters (see below).
You can also specify modules of the ImageSourceHandle by providing
one of the following options for GenParamName:
-
'plugin_path': Create a handle specifying a plugin by providing the path to the
.ctiplugin file as the correspondingGenParamValue.PluginNameneeds to be set to 'ignore'.DeviceIDneeds to be set to 'none' or a device ID. -
'interface_id': Create a handle specifying an interface by providing the interface ID as the corresponding
GenParamValue.PluginNameneeds to be set to 'none' or a plugin name.DeviceIDneeds to be set to 'none' or a device ID. -
'device_user_name': Create a handle specifying a device by providing the device user name as the corresponding
GenParamValue.PluginNameneeds to be set to a plugin name.DeviceIDneeds to be set to 'ignore'. -
'device_serial_number': Create a handle specifying a device by providing the device serial number as the corresponding
GenParamValue.PluginNameneeds to be set to a plugin name.DeviceIDneeds to be set to 'ignore'. -
'stream_id': Create a handle specifying a stream by providing the stream ID as the corresponding
GenParamValue.PluginNameneeds to be set to a plugin name.DeviceIDneeds to be set to a device ID. -
'read_config_file': Create a handle by reading an image source configuration file, providing the path to the file as the corresponding
GenParamValue. The default HALCON file extension for image source configuration files is.hisc.The settings of the 'image_source' group are applied immediately when the configuration is loaded. The settings of all other modules are applied after the subsequent call to
connect_image_source.PluginNameneeds to be set to 'ignore'.DeviceIDneeds to be set to 'ignore'.
You can use query_image_sources to retrieve the values for
all available image sources.
An empty image source handle can be created by setting both
PluginName and DeviceID to 'none' and not
specifying any generic parameters. The empty image source handle can be
extended using set_image_source_param.
Execution information🔗
Execution information
-
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
-
Multithreading scope: global (may be called from any thread).
-
Processed without parallelization.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
Parameters🔗
PluginName (input_control) string → (string)
Name of an image source plugin.
Default: 'none'
Suggested values: 'none', 'ignore', 'mvtec_gigevision', 'mvtec_usb3vision', 'mvtec_realsense', 'mvtec_gstreamer', 'mvtec_mediafoundation', '<plugin_name>'
DeviceID (input_control) string → (string)
ID of the image source device.
Default: 'none'
Suggested values: 'none', 'ignore'
GenParamName (input_control) attribute.name-array → (string)
Generic parameter name.
Default: []
Suggested values: 'plugin_path', 'interface_id', 'device_user_name', 'device_serial_number', 'stream_id', 'read_config_file'
GenParamValue (input_control) attribute.value-array → (integer / real / string)
Generic parameter value.
Default: []
ImageSourceHandle (output_control) image_source → (handle)
Created image source handle storing module identifiers.
Example🔗
(HDevelop)
* Specify the plugin for GigE Vision devices via its name.
create_image_source ('mvtec_gigevision', 'none', [], [], ImageSourceHandle)
* Specify a plugin by providing its path.
create_image_source ('ignore', 'none', 'plugin_path', 'path/to/plugin.cti', ImageSourceHandle)
*
* Specify a GigE Vision device by providing its unique ID.
create_image_source ('mvtec_gigevision', '00305324c805_Basler_acA244020gc', [], [], ImageSourceHandle)
* Specify a GigE Vision camera by providing its user name.
create_image_source ('mvtec_gigevision', 'ignore', 'device_user_name', 'MyDevice', ImageSourceHandle)
Result🔗
If the parameter values are correct, create_image_source
returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.
Combinations with other operators🔗
Combinations
Possible successors
connect_image_source, get_image_source_param, set_image_source_param
Alternatives
See also
Module🔗
Foundation