Save images

Images can be saved in VisionPro using the CogImageFileTool. However, there are some disadvantages associated with this:

  • The time for saving is included in the total runtime.

  • If images cannot be saved, the job goes to “error” (can only be handled differently via scripting).

  • Must be configured for each job.

  • Images should not always be saved, e.g. if they were loaded from the hard disk for analysis purposes.

For these and other reasons, images are saved automatically in Viper.NET. A distinction is made between two types of images inputimage and resultimage, each of which is handled differently. Images are stored asynchronously with the WorkerStoreImage component to avoid slowing down job runtimes due to slow disk accesses or unreachable network drives.

Configuration

Which images should be saved where depends on several factors:

  • The default for all jobs is configured in the global-settings.

  • Many of these global settings can be overridden for a single job in the job-editor.

  • Using the JobDataBlock there is also the possibility to influence the options in each execution of the job.

  • Similarly, in the SaveImagesEx ToolBlock there are terminals for the save options of a result image.

Input images (camera images)

The input images, i.e. the raw images from the camera, are lifted and saved 1:1 before passing through the manipulation-toolgroup. The filename is automatically generated so that the images can later be loaded into RunFromDir and assigned to their respective image sources:

{Job.TgItem}#{TimeStamp}#{ResultTag}#{ImageIdx}.bmp
  • Job.TgItem: Name of the job (not the DisplayName) and name of the ToolGroupItem.

  • TimeStamp: Time stamp in the format “yyyyMMdd_HHmmssfff”.

  • ResultTag: Result of the evaluation (“pass”, “warn” or “fail”)

  • ImageIdx: Index of the image source in the image source list from which the image originates, e.g. “Img0”.

Optionally, the image name can contain additional elements:

{Prefix}#{Job.TgItem}#{TimeStamp}#{ResultTag}#{ImageIdx}{Category}.bmp
  • Prefix: Can be set in JobDataBlock, e.g. to the part ID.

  • Category: Image source type when extension image sources from plugins are used (e.g. in the Halcon plugin).

The images are normally stored directly in the images folder. With the JobDataBlock a subfolder structure can optionally be defined.

Warning

The JPEG image format stores images in a compressed but lossy form. A later re-evaluation of the images can therefore lead to changed results. For compressed saving of input images PNG should be used.

Hint

The image format for CogImage16Range is always IDB, regardless of the configuration.

Result images (SaveImagesEx)

Result images are stored using special tool blocks. Further details are described in chapter SaveImagesEx.

WorkerStoreImage

The images to be stored are normally entered into a queue and stored asynchronously by the WorkerStoreImage component. In the configuration of the Vision plugin the behavior of WorkerStoreImage can be adjusted with some parameters. After changing the parameters a restart is required.

Warning

Errors when saving images are logged without the application going into error. Images should therefore always be cached to local folders, as network drives are not always accessible. With WatchDir the files can be moved to network drives afterwards.

Memory limitation

The destination folder for the images is not monitored by Viper.NET, i.e. images are stored until no more space is available. Therefore the tool Gefasoft WatchDir for monitoring folders and files is installed during the installation of Viper.NET. The WatchDir runs as a Windows service and is configured via a separate tool. The tool can be extended via plugins, e.g. to send data to external interfaces like MQTT or AMQP.

By default, WatchDir provides the following functions:

  • Limit directories to a maximum number of files, folders or total size, always deleting the oldest files.

  • Move files to one or more destination folders.

For WatchDir a separate documentation is available inside, which is also installed.

Warning

The image folder of Viper.NET should always be monitored.