F_VN_CopyImageRegionToRegion

F_VN_CopyImageRegionToRegion 1:

Copy an image region into another image region.

Syntax

Definition:

FUNCTION F_VN_CopyImageRegionToRegion : HRESULT
VAR_INPUT
    ipSrcImage  : ITcVnImage;
    nXSrc       : UDINT;
    nYSrc       : UDINT;
    nWidth      : UDINT;
    nHeight     : UDINT;
    ipDestImage : ITcVnImage;
    nXDest      : UDINT;
    nYDest      : UDINT;
    hrPrev      : HRESULT;
END_VAR

F_VN_CopyImageRegionToRegion 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image

nXSrc

UDINT

Left boundary in ipSrcImage (inclusive 0-based index)

nYSrc

UDINT

Upper boundary in ipSrcImage (inclusive 0-based index)

nWidth

UDINT

ROI width

nHeight

UDINT

ROI height

ipDestImage

ITcVnImage

Destination image (same type as ipSrcImage)

nXDest

UDINT

Left boundary in ipDestImage (inclusive 0-based index)

nYDest

UDINT

Upper boundary in ipDestImage (inclusive 0-based index)

hrPrev

HRESULT

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

F_VN_CopyImageRegionToRegion 3: Return value

HRESULT

Further information

The function F_VN_CopyImageRegionToRegion copies an image region of the input image ipSrcImage to a place in the destination image ipDestImage. The image region is specified by a rectangle with position and size, as with an ROI.

Application

The copying of an image area with a size [100, 100] at the position aPosition in the top left corner of the result image ipImageRes looks like this, for example:

hr := F_VN_CopyImageRegionToRegion(
    ipSrcImage  :=  ipImageWork,
    nXSrc       :=  aPosition[0],
    nYSrc       :=  aPosition[1],
    nWidth      :=  100,
    nHeight     :=  100,
    ipDestImage :=  ipImageRes,
    nXDest      :=  0,
    nYDest      :=  0,
    hrPrev      :=  hr
);

Samples

Related functions

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