F_VN_CopyImageRegion

F_VN_CopyImageRegion 1:

Deep copy the specified region of interest into a new image.

Syntax

Definition:

FUNCTION F_VN_CopyImageRegion : HRESULT
VAR_INPUT
    ipSrcImage  : ITcVnImage;
    nX          : UDINT;
    nY          : UDINT;
    nWidth      : UDINT;
    nHeight     : UDINT;
    ipDestImage : Reference To ITcVnImage;
    hrPrev      : HRESULT;
END_VAR

F_VN_CopyImageRegion 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image

nX

UDINT

Left boundary (inclusive 0-based index)

nY

UDINT

Upper boundary (inclusive 0-based index)

nWidth

UDINT

ROI width

nHeight

UDINT

ROI height

ipDestImage

Reference To ITcVnImage

Destination image (An appropriate destination image will be created if required.)

hrPrev

HRESULT

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

F_VN_CopyImageRegion 3: Return value

HRESULT

Further information

The function F_VN_CopyImageRegion creates a deep copy of an image region of the input image ipSrcImage. The image region is specified by a rectangle with position and size, as with an ROI.

F_VN_CopyImageRegion 4:

Computing time optimization

With regard to computing time optimization, check each image copy for its necessity.

If a copy is not required, but instead only the image region is to be reduced in size, a Region of Interest can be set instead.

Application

The copying of an image region of the size [240, 120] with the top left corner at the position [50, 50] looks like this, for example:

hr := F_VN_CopyImageRegion(
    ipSrcImage  :=  ipImageIn,
    nX          :=  50,
    nY          :=  50,
    nWidth      :=  240,
    nHeight     :=  120,
    ipDestImage :=  ipImageWork,
    hrPrev      :=  hr,
);

Related functions

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