Overlays

The attributes and functions explained on this page can be found in the category Overlay.

Overlays can be used to help set up the camera or position objects within the image, for example.

Predefined geometric shapes

The control provides predefined geometric objects (such as circles, rectangles, crosses, frames) that can be displayed in the center of the image. These shapes can serve, for example, as crosshairs or for frames and marks at certain positions in the image. Several objects can also be displayed at the same time (e.g. a circle and a crosshair cursor). This is done using the array property OverlayElements. The configuration of an object looks like this:

Overlays 1:

The objects are always centered in the image. They have a fixed scale defined by size and do not scale with the image.

Overlay image

If this functionality is not flexible enough for a particular application, you can specify an overlay image using the OverlaySource property. This is displayed in exactly the same place and size as the main image, i.e. the overlay image is stretched/squeezed to fit the main image. We therefore recommend that the overlay image has at least the same aspect ratio and preferably the same size as the main image and is transparent except for relevant parts.

As an example, you could draw a user-defined crosshair cursor with additional accessories on a transparent image and use it as an overlay. To create a transparent image, a 4-channel image must be created with the color value 0 at the fourth channel of the background color. The cursor lines to be drawn in then get the color value 255 at the fourth channel, so that these elements overlay the background image.

View

For example, an overlay image with a rectangle and a text might produce the following result:

Overlays 2:

In the following example, an overlay image from the PLC (green lines) was combined with two objects defined in the control:

Overlays 3:

Please note that the PNG or BMP image format must be used when transmitting transparent images with the "TwinCAT.HMI.Vision" server extension, as JPEG and Stream do not support transparent image content with an alpha channel.