Skip to content

Image Source Plugin for the Image Files

The File Image Source Plugin provides access to image files stored on disk and supports replaying image data for testing, development, and offline analysis. It can be used as a virtual camera to simulate image acquisition without requiring physical hardware. The plugin is installed by default as part of the HALCON installation via the MVTec Software Manager (SOM).

Plugin Name mvtec_file
Version
Date 2026-10-30
Available Architectures x64-win64 x64-linux aarch64-linux

Features

  • Support for camera simulation mode (default) and software triggering mode.
  • Support for continuous image playback (default) and one-time playback of image sequences using the MultiFrame feature.
  • Support for different image caching modes using the ImageCachingMode feature.
  • Support of following image formats: JPEG, PNG.

Limitations

  • Reading of monochrome images with alpha channel or transparency is not supported because an adequate PFNC format does not exist.
  • Setting of a target PFNC format or any color conversion is not supported. PFNC formats are determined from the image format.
  • Reading of JPEG images is limited to RGB 8 bit per pixel images.

Installation

The mvtec_file plugin is installed by default via the MVTec Software Manager (SOM).

System requirements

The same system requirements as for the HALCON installation apply.

Usage and concepts

The mvtec_file plugin provides virtual image acquisition devices. These devices emulate area scan cameras and deliver images from the filesystem.

Identifying/Connecting devices

The mvtec_file plugin implements a single GenTL interface module. HALCON image sources provide shortcuts to discover all available device instances with just one operator call.

Device identifier

The mvtec_file plugin identifies virtual devices using a device ID. Device IDs are generated dynamically as needed. By default, the device ID FILE_DEV_0 will be available. As soon as the device handle using the device ID with the largest index gets connected, a new device ID with an incremented index will be created, e.g. FILE_DEV_1.

HDevelop: Using the unique ID to specify your virtual camera
create_image_source ('mvtec_file', 'FILE_DEV_0', [], [], ImageSourceHandle)
connect_image_source (ImageSourceHandle, [], [])

Additionally, a special device ID in the format '#IMAGEPATH#/C:/temp/' may be used to generate a device for a dedicated image path. The image path may be changed after connection via the ImagePath parameter.

Device discovery

When using the HALCON operator query_image_sources, image source handles for all connected and unconnected virtual devices are returned. The image source handle for the device with the largest device ID index is always unconnected and can be used for connecting directly.

HDevelop: Discover devices and connect to one of them
query_image_sources ('mvtec_file', [], [], ImageSourceHandles)
FirstCam := ImageSourceHandles[0]
connect_image_source (FirstCam, [], [])

Device usage

Each device operates on a directory given by the parameter ImagePath. By default, ImagePath is determined from the HALCONEXAMPLES environment variable or the current working directory if HALCONEXAMPLES is not set. The ImagePath may be set via set_image_source_param or provided by a special device ID, e.g. '#IMAGEPATH#/C:/temp/' for create_image_source.

HDevelop: Create an image source with a custom image path
create_image_source ('mvtec_file', '#IMAGEPATH#/C:/temp/', [], [], TempDirHandle)
connect_image_source (TempDirHandle, [], [])

Image file inspection

The image directory is scanned for image files when calling connect_image_source or whenever the ImagePath or the parameter ImageFileNameFilter is changed. Files are inspected for compatibility and a list of alphabetically sorted files is stored internally.

The image format determines the PFNC format of frames generated from each image according to the following table.

Image format PFNC format
PNG Monochrome with 1, 2, 4 or 8 bit per pixel Mono8
JPEG Monochrome 8 bit per pixel Mono8
PNG image with monochrome palette Mono8
PNG Monochrome with 16 bit per pixel Mono16
PNG or JPEG RGB 8 bit RGB8
PNG image with non-monochrome palette RGB8
PNG RGB 16 bit RGB16
PNG RGB 8 bit with alpha channel or transparency RGB8a
PNG RGB 16 bit with alpha channel or transparency RGB16a

Frame generation

By default, the mvtec_file plugin emulates a free-running camera acquiring frames with a constant frame rate into buffers. The frame rate can be configured via the AcquisitionFrameRate parameter. The number of available buffers can be queried with the parameter StreamAnnouncedBufferCount. Note that frames will be dropped when free buffers are not available.

For strict sequential acquisition of images, software triggering may be used by setting the parameter TriggerMode to 'On' and executing the parameter TriggerSoftware for each acquisition.

Refer to the example mvtec_file_sequential.hdev for further information.

By default, when the end of the image directory is reached it wraps around to the start. This behavior may be changed with the parameter AcquisitionMode. Refer to the example mvtec_file_multiframe.hdev for detailed information.

Image file loading

Image files will be loaded when the acquisition is started by calling start_image_source. The loading and caching behavior can be controlled using the ImageCachingMode parameter. By default, images will not be cached and continuously loaded as required. Stopping the acquisition will free cached image buffers.

Configuration parameters

The mvtec_file plugin implements the GenICam GenTL standard, which specifies a set of five configurable modules. These are the plugin (in GenTL referred to as System), interface, local_device, device, and stream modules (1). Refer to the HALCON Operator Reference for more information about these modules. In the following section all configuration parameters of the different modules are listed.

  1. Image title

Plugin

Only one instance of the plugin module exists per plugin. This module serves mostly informational purposes. Its parameters can be grouped broadly in two different categories:

  1. Generic information about the plugin itself (such as TLType, TLModelName, and TLVendorName).

  2. Generic information about the available interfaces on the given system (e.g. InterfaceID)

HDevelop: How to access parameters for the plugin module
get_image_source_param (ImageSourceHandle, <ParamName>, ['group'], ['plugin'], ValueReturned)
set_image_source_param (ImageSourceHandle, <ParamName>, ['group'], ['plugin'], ValueToSet)
Parameter Description type read-only values default
GenTLSFNCVersionMajor Major version number of the GenTL Standard Features Naming Convention used to create this GenTL Producer's XML.
integer read-only
GenTLSFNCVersionMinor Minor version number of the GenTL Standard Features Naming Convention used to create this GenTL Producer's XML.
integer read-only
GenTLVersionMajor Major version number of the GenTL specification this GenTL Producer complies with.
integer read-only
GenTLVersionMinor Minor version number of the GenTL specification this GenTL Producer complies with.
integer read-only
InterfaceID GenTL Producer wide unique identifier of the selected interface.
This interface list only changes on execution of InterfaceUpdateList.
string read-only
InterfaceSelector Selector for the different GenTL Producer interfaces.
This interface list only changes on execution of InterfaceUpdateList.
integer 0
InterfaceUpdateList Updates the internal interface list.
command
InterfaceUpdateTimeout Specifies timeout for the InterfaceUpdateList Command.
integer 0 ms
TLFileName File name including extension of the library.
string read-only
TLID Unique identifier of this GenTL Producer.
string read-only
TLModelName Name of this GenTL Producer to distinguish different kinds of GenTL Producer implementations from one vendor.
string read-only
TLPath Full path to this GenTL Producer including name and extension.
string read-only
TLType Transport layer type of this GenTL Producer.

Custom: Custom transport layer

enumeration read-only Custom
TLVendorName Name of the GenTL Producer vendor.
string read-only
TLVersion Vendor specific version string.
string read-only

Interface

The mvtec_file plugin provides unified access to all devices through a single interface module. Note that some of the listed parameters are not applicable to this plugin and will appear as not available.

HDevelop: How to access parameters for the interface module
get_image_source_param (ImageSourceHandle, <ParamName>, ['group'], ['interface'], ValueReturned)
set_image_source_param (ImageSourceHandle, <ParamName>, ['group'], ['interface'], ValueToSet)
Parameter Description type read-only values default
DeviceAccessStatus Access status of the selected device at the moment of the last execution of DeviceUpdateList.
This value only changes on execution of DeviceUpdateList.

Unknown: Unknown status
ReadWrite: Full access
ReadOnly: Read-only access
NoAccess: The device is seen but unreachable
Busy: The device is open by another entity
OpenReadWrite: The device is open by this GenTL Producer with RW access
OpenReadOnly: The device is open by this GenTL Producer with RO access

enumeration read-only Unknown, ReadWrite, ReadOnly, NoAccess, Busy, OpenReadWrite, OpenReadOnly
DeviceID Interface wide unique identifier of the selected device.
This value only changes on execution of DeviceUpdateList.
string read-only
DeviceModelName Name of the device model of the selected device.
This value only changes on execution of DeviceUpdateList.
string read-only
DeviceSelector Selector for the different devices on this interface.
This value only changes on execution of DeviceUpdateList.
integer 0
DeviceSerialNumber Serial number of the selected device.
This value only changes on execution of DeviceUpdateList.
string read-only
DeviceTLVersionMajor Major version number of the transport layer specification of the selected device.
integer read-only
DeviceTLVersionMinor Minor version number of the transport layer specification of the selected device.
integer read-only
DeviceUpdateList Updates the internal device list.
command
DeviceUpdateTimeout Specifies timeout for the DeviceUpdateList Command.
integer 0 ms
DeviceUserID User-programmable device identifier of the selected device.
This value only changes on execution of DeviceUpdateList.
string read-only
DeviceVendorName Name of the device vendor of the selected device.
This value only changes on execution of DeviceUpdateList.
string read-only
InterfaceID GenTL Producer wide unique identifier of the selected interface.
string read-only
InterfaceTLVersionMajor Major version number of the transport layer specification this GenTL Producer interface complies with.
The TL version of the Interface can be compared with the TL version of the device to assure compatibility.
integer read-only
InterfaceTLVersionMinor Minor version number of the transport layer specification this GenTL Producer interface complies with.
The TL version of the Interface can be compared with the TL version of the device to assure compatibility.
integer read-only
InterfaceType Transport layer type of the interface.

Custom: Custom transport layer

enumeration read-only Custom

Local Device

As mandated by the GenTL standard, for each detected physical device, the mvtec_file plugin also instantiates a so called 'local device' module. This provides information and configuration parameters for the device as it is seen by the File image source plugin. The list of available parameters therefore is independent of the actual device.

The parameters of the local device module can be grouped broadly in two different categories:

  1. Information about the virtual device as seen by the mvtec_file plugin (such as DeviceAccessStatus and DeviceModelName).

  2. Information about the discovered streams on this device (StreamSelector and StreamID). However, the mvtec_file plugin only supports streaming images from the first stream.

HDevelop: How to access parameters for the local_device module
get_image_source_param (ImageSourceHandle, <ParamName>, ['group'], ['local_device'], ValueReturned)
set_image_source_param (ImageSourceHandle, <ParamName>, ['group'], ['local_device'], ValueToSet)
Parameter Description type read-only values default
DeviceAccessStatus Gets the access status the GenTL Producer has on the device.

Unknown: Unknown status
OpenReadWrite: The device is open by this GenTL Producer with RW access
OpenReadOnly: The device is open by this GenTL Producer with RO access

enumeration read-only Unknown, OpenReadWrite, OpenReadOnly
DeviceEventsThreadApplyPriority Applies desired thread priority parameter(s) to the internal event handling thread.
Also triggers a re-read of the actual values. The values must be configured with the DeviceEventsThreadPriority and DeviceEventsThreadSchedulingPolicy parameters beforehand. Executing this command and changing the thread priority parameter(s) might require administrative privileges.
Only available if the device supports device events.
Use with care.
command
DeviceEventsThreadPriority OS-specific thread priority value used for the internal event handling thread.
The value can be applied with the DeviceEventsThreadApplyPriority command. Afterwards the value in effect can be read back. The value must fall within the range of values expected by the operating system, i.e. as expected in the struct sched_param under Linux or in the call to SetThreadPriority under Windows. Even per default the implementation tries to apply a higher-than-normal priority to this thread.
Only available if the device supports device events.
Use with care.
integer
DeviceEventsThreadSchedulingPolicy OS-specific scheduling policy value used for the internal event handling thread.
The value can be applied with the DeviceEventsThreadApplyPriority command. Afterwards the value in effect can be read back. The value must be one of the values of the priority identifiers of the operating system, e.g. SCHED_FIFO, SCHED_RR and so on.
Only available on Linux systems.
Only available if the device supports device events.
Use with care.
integer
DeviceID Interface-wide unique identifier of this device.
string read-only
DeviceManufacturerInfo Manufacturer information about the remote device.
string read-only
DeviceModelName Name of the remote device model.
string read-only
DeviceSerialNumber Serial number of the remote device.
string read-only
DeviceType Transport layer type of the device.

Custom: Custom transport layer

enumeration read-only Custom
DeviceUserID User-programmable device identifier of the remote device.
string read-only
DeviceVendorName Name of the remote device vendor.
string read-only
DeviceVersion Name of the version of the remote device model.
string read-only
StreamID Device unique ID for the stream.
For example a GUID.
string read-only
StreamSelector Selector for the different stream channels.
integer 0

Device

In plugins such as mvtec_gigevision and mvtec_usb3vision, the available parameters in the device module are defined by the GenICam feature description file provided by the connected device and automatically retrieved by the plugin. However, the mvtec_file plugin interfaces with virtual devices that do not expose such a file. Instead, it dynamically queries the device's settings at runtime and exposes a custom GenICam-compliant feature description file.

HDevelop: How to access parameters for the device module

The parameters of the device module are selected per default. Therefore specifying the generic parameter group==device can be omitted.

get_image_source_param (ImageSourceHandle, <ParamName>, [], [], ValueReturned)
set_image_source_param (ImageSourceHandle, <ParamName>, [], [], ValueToSet)

Parameter Description type read-only values default
AcquisitionFrameCount Provides the number of frames to acquire in MultiFrame Acquisition mode.
This value will automatically be set to the number of available image files and cannot be changed.
integer read-only
AcquisitionFrameRate Controls the acquisition rate (in Hertz) at which the frames are captured.
float 20.0
AcquisitionMode Sets the acquisition mode of the device.

Continuous: Frames are captured continuously until stopped with the AcquisitionStop command. If the end of the image directory is reached it wraps around to the start.
MultiFrame: Frames are captured continuously until the end of the image directory is reached. Each image will be delivered only once.

enumeration Continuous, MultiFrame Continuous
DeviceSFNCVersionMajor Major version of the Standard Features Naming Convention that was used to create the device's GenICam XML.
integer read-only
DeviceSFNCVersionMinor Minor version of the Standard Features Naming Convention that was used to create the device's GenICam XML.
integer read-only
DeviceSFNCVersionSubMinor Sub minor version of Standard Features Naming Convention that was used to create the device's GenICam XML.
integer read-only
ImageCachingMode Image caching mode.
Selects when images are read and if images are kept in memory.

Off: Images are read one-by-one during each acquisition and not cached in memory.
Preload: Images are pre-loaded when the acquisition is started and each image is cached in memory.
Cached: Images are read one-by-one during each acquisition and cached in memory.

enumeration Off, Preload, Cached Off
ImageFileNameFilter Glob expression to filter image file names.
Specifies a glob expression filter that is applied to file names found in ImagePath.
string
ImagePath Configured image path.
Specifies the path where images will be read from image files. The initial value is determined by the HALCONIMAGES environment variable, or will be set to the current working directory otherwise.
string
PayloadSize Provides the number of bytes transferred for each image or chunk on the stream channel.
This includes any end-of-line, end-of-frame statistics or other stamp data. This is the total size of data payload for a data block.
integer
TriggerMode Controls if the selected trigger is active.

Off: Disables the selected trigger.
On: Enable the selected trigger.

enumeration Off, On Off
TriggerSelector Selects the type of trigger to configure.

FrameStart: Selects a trigger starting the capture of one frame.

enumeration FrameStart
TriggerSoftware Generates a software trigger signal.
The software trigger signal will be used if the TriggerSource parameter is set to TriggerSoftware.
command
TriggerSource Specifies the internal signal or physical input Line to use as the trigger source.
The selected trigger must have its TriggerMode set to On.

Software: Specifies that the trigger source will be generated by software using the TriggerSoftware command.

enumeration Software

Stream

The mvtec_file plugin automatically instantiates one stream module per connected device. The purpose of the stream module is to configure parameters related to the transmission and receiving of image data.

HDevelop: How to access parameters for the stream module
get_image_source_param (ImageSourceHandle, <ParamName>, ['group'], ['stream'], ValueReturned)
set_image_source_param (ImageSourceHandle, <ParamName>, ['group'], ['stream'], ValueToSet)
Parameter Description type read-only values default
FileErrorMessage Error message generated for the file selected by FileIndex.
string
FileIndex Index of the file selected to query further info.
Index of the file used in FileName, FilePath and FileErrorMessage.
integer
FileName Name of the file selected by FileIndex.
string
FilePath Full path of the file selected by FileIndex.
string
PayloadSize Size of the expected data in bytes.
Note that this feature "overwrites" the PayloadSize of the remote device, see corresponding sections of the GenICam GenTL standard.
integer read-only
StreamAnnounceBufferMinimum Minimal number of buffers to announce to enable selected buffer handling mode.
integer read-only 0
StreamAnnouncedBufferCount Number of announced (known) buffers on this stream.
This value is volatile. It may change if additional buffers are announced and/or buffers are revoked by the GenTL Consumer.
integer read-only
StreamAuxiliaryBufferCount Number of auxiliary buffers the acquisition engine will allocate to keep the stream going when not enough user buffers are available.
integer
StreamBufferHandlingMode Selects the buffer handling mode in use for this Data Stream.
This influences how the streaming engine handles new complete transmissions, especially when they arrive faster than the application is processing them.
Not writeable while streaming is active.

OldestFirst: The acquired buffers are delivered to the application in a FIFO manner. New data will be discarded if no free buffers are available. Typically used when each image must be processed, even when short load-spikes slow down processing momentarily.
OldestFirstOverwrite: The acquired buffers are delivered to the application in a FIFO manner. New data will overwrite the oldest buffer if no free buffers are available. Typically used when each image must be processed, even when short load-spikes slow down processing momentarily.
NewestOnly: The application always receives the newest acquired buffer. New data will replace any other one already received and not yet given to the application. Typically used for displaying or when having the latest results is more important than having all results.

enumeration OldestFirst, OldestFirstOverwrite, NewestOnly OldestFirst
StreamID Device unique ID for the data stream.
For example a GUID.
string read-only
StreamThreadApplyPriority Applies desired thread priority parameter(s) to the internal stream processing thread.
Also triggers a re-read of the actual values. The values must be configured with the StreamThreadPriority and StreamThreadSchedulingPolicy parameters beforehand. Executing this command and changing the thread priority parameter(s) might require administrative privileges.
Use with care.
command
StreamThreadPriority OS-specific thread priority value used for the internal stream processing thread.
The value can be applied with the StreamThreadApplyPriority command. Afterwards the value in effect can be read back. The value must fall within the range of values expected by the operating system, i.e. as expected in the struct sched_param under Linux or in the call to SetThreadPriority under Windows. Even per default the implementation tries to apply a higher-than-normal priority to this thread.
Use with care.
integer
StreamThreadSchedulingPolicy OS-specific scheduling policy value used for the internal stream processing thread.
The value can be applied with the StreamThreadApplyPriority command. Afterwards the value in effect can be read back. The value must be one of the values of the priority identifiers of the operating system, e.g. SCHED_FIFO, SCHED_RR and so on.
Only available on Linux systems.
Use with care.
integer
StreamType Transport layer type of the Data Stream.

Custom: Custom transport layer

enumeration read-only Custom

Examples

Bundled with the mvtec_file plugin are example scripts in the HDevelop programming language, that highlight important concepts when using the plugin. These examples can be opened in HDevelop with the HDevelop Example Browser (1):

  1. Image title
  • mvtec_file_directory_information.hdev
    This example demonstrates how to use the Image Source File Plugin to access image files stored on disk, how to retrieve file information and use them as a virtual camera.

  • mvtec_file_image_path.hdev
    This example demonstrates how to configure the image directory with the feature ImagePath and filter images by file name.

  • mvtec_file_multiframe.hdev
    This example demonstrates how the feature AcquisitionMode affects the delivery of images from the configured image directory.

  • mvtec_file_sequential.hdev
    This example demonstrates the available acquisition behaviors non-sequential acquisition (free-running) and sequential acquisition (software-triggered).

Troubleshooting

In case of image acquisition problems with the mvtec_file plugin, the following hints might help to solve them.

  • Check if the latest revision of the mvtec_file plugin is used.
  • Check the System Requirements.
  • Check the extended error messages for detailed error descriptions. These are automatically displayed in HDevelop, but might need to be queried explicitly when programming in HALCON/C++ or HALCON/C# for example.
  • If the plugin cannot be loaded (1), it might not be properly installed.
    Check if it is installed via the SOM (see installation).
    Verify manually that the file 'mvtec_file.cti' is present in the folder %HALCONROOT%\bin\%HALCONARCH% () or $HALCONROOT/lib/$HALCONARCH ().

    1. Error
      "Image source module not found (HALCON error code: 5809)"
      or extended error message containing
      "Cannot identify producer to open"
      while using query_image_sources or connect_image_source.

Requesting help

If you experience problems not solvable with the tips of the previous section, MVTec and its worldwide partner network are ready to help. Please refer to www.mvtec.com/support for directions.

Include the following in your support request for maximum efficiency

  • Used HALCON and image source plugin version.
  • Used HALCON architecture (e.g. x64-win64, x64-linux, aarch64-linux or armv7a-linux).
  • Details about the host machine, like operating system, RAM and CPU.
  • Description of the observed and expected behavior.
  • Minimal sample code (if possible HDevelop script) to reproduce the issue.
  • If applicable, any error codes and error messages observed.

FOSS libraries

The mvtec_file plugin depends on free and open-source software (FOSS) libraries. See the file third_party_mvtec_file.txt in the HALCON base directory for copyright and license information. Libraries are used without modifications unless explicitly stated in the file.

You can request the source for those third-party libraries licensed under LGPL via email to info@mvtec.com with the subject "Request source code of third-party libraries".

Release notes

  • Version 1.0.0 (2026-10-30)
    • First official version of the MVTec File image source plugin.
mvtec_file 1.0.0 Doc generated: 2026-11-16T12:24:02