F_VN_ApplyColorMap
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
Inputs
Name |
Type |
Description |
---|---|---|
ipSrcImage |
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 |
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 indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
The function F_VN_ApplyColorMap
applies a color table to the input image.
Parameter
Input image
The input image ipSrcImage
must be a 1-channel grayscale image and have an element type of USINT
(8-bit) or UINT
(16-bit).
Result image
The result image ipDestImage
returns the 3-channel RGB color image with the element type USINT
(8-bit) that was transformed with the color table.
Color table
The color table ipColorMap
defines how the input image is transformed. The color table is a container that can be created either manually or with one of the following two functions:
The container must contain 256 elements (for 8-bit) or 65,536 elements (for 16-bit), depending on the element type of the input image, and must be of the type ContainerType_Vector_TcVnVector3_REAL
.
Application
The application of a typical heat map to an 8-bit image looks like this, for example:
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.54 or later | PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU | Tc3_Vision |