F_VN_ApplyColorMap

F_VN_ApplyColorMap 1:

Apply a color map to a gray-level image.

Syntax

Definition:

FUNCTION F_VN_ApplyColorMap : HRESULT
VAR_INPUT
    ipSrcImage  : ITcVnImage;
    ipDestImage : Reference To ITcVnImage;
    ipColorMap  : ITcVnContainer;
    hrPrev      : HRESULT;
END_VAR

F_VN_ApplyColorMap 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image (TCVN_ET_USINT or TCVN_ET_UINT, 1 channel)

ipDestImage

Reference To ITcVnImage

Returns the colored image (TCVN_ET_USINT, 3 channel. An appropriate image will be created if required.)

ipColorMap

ITcVnContainer

Color map to be applied to ipSrcImage (ContainerType_Vector_TcVnVector3_REAL with 256 or 65536 elements, dependent on ipSrcImage type). Can be either custom or created with F_VN_GenerateColorMap.

hrPrev

HRESULT

HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.)

F_VN_ApplyColorMap 3: Return value

HRESULT

Weiterführende Informationen

Die Funktion F_VN_ApplyColorMap wendet eine Farbtabelle auf das Eingangsbild an.

Parameter

Eingangsbild

Das Eingangsbild ipSrcImage muss ein 1-kanaliges Grauwertbild sein und als Element-Typ USINT (8 Bit) oder UINT (16 Bit) haben.

Ergebnisbild

Das Ergebnisbild ipDestImage gibt das mit der Farbtabelle transformierte, 3-kanalige RGB-Farbbild mit dem Element-Typ USINT (8 Bit) zurück.

Farbtabelle

Die Farbtabelle ipColorMap definiert, wie das Eingangsbild transformiert wird. Die Farbtabelle ist ein Container, der entweder manuell oder mit einer der beiden folgenden Funktionen erstellt werden kann:

Der Container muss je nach Element-Typ des Eingangsbilds 256 Elemente (für 8 Bit) oder 65.536 Elemente (für 16 Bit) enthalten und vom Typ ContainerType_Vector_TcVnVector3_REAL sein.

Anwendung

Die Anwendung einer typischen Heatmap auf ein 8-Bit-Bild sieht z. B. so aus:

hr := F_VN_GenerateColorMap(ipColorMap, TCVN_CMM_HOT, TCVN_CMS_256, hr);
hr := F_VN_ApplyColorMap(
    ipSrcImage      :=  ipImageIn,
    ipDestImage     :=  ipImageRes,
    ipColorMap      :=  ipColorMap,
    hrPrev          :=  hr
);

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1. 4024.44 or later

PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision