F_VN_ResizeRegion_TcVnRectangle_DINT

F_VN_ResizeRegion_TcVnRectangle_DINT 1:

Expands or shrinks the given rectangle proportionally to its current size and/or by explicit absolute offsets. Horizontal and vertical scaling ratios define proportional size changes. If a scaling ratio equals 1.0, the corresponding minimum offset alone determines the size change. If a reference image is provided, the resulting rectangle is clipped to the image boundaries. If clipping occurs, the function returns S_FALSE.

Syntax

Definition:

FUNCTION F_VN_ResizeRegion_TcVnRectangle_DINT : HRESULT
VAR_IN_OUT
    stSrcRect        : TcVnRectangle_DINT;
    stDestRect       : TcVnRectangle_DINT;
END_VAR
VAR_INPUT
    fWidthRatio      : REAL;
    fHeightRatio     : REAL;
    nMinWidthOffset  : DINT;
    nMinHeightOffset : DINT;
    ipImage          : ITcVnImage;
    hrPrev           : HRESULT;
END_VAR

 Inputs

Name

Type

Description

fWidthRatio

REAL

Horizontal scaling ratio. If fWidthRatio <> 1 (> 1 expand, < 1 shrink), the absolute value of nMinWidthOffset is used as a minimum width change constraint. If fWidthRatio = 1.0, the width change is defined exclusively by nMinWidthOffset.

fHeightRatio

REAL

Vertical scaling ratio. If fHeightRatio <> 1 (> 1 expand, < 1 shrink), the absolute value of nMinHeightOffset is used as a minimum width change constraint. If fHeightRatio = 1.0, the height change is defined exclusively by nMinHeightOffset.

nMinWidthOffset

DINT

Minimum width offset (in pixels), applied symmetrically around the rectangle center. If fWidthRatio <> 1.0, the absolute value of nMinWidthOffset defines the minimum width change. If fWidthRatio = 1.0, the sign defines the operation direction ( > 0 expand, < 0 shrink, = 0 no width change).

nMinHeightOffset

DINT

Minimum height offset (in pixels), applied symmetrically around the rectangle center. If fHeightRatio <> 1.0, the absolute value of nMinHeightOffset defines the minimum height change. If fHeightRatio = 1.0, the sign defines the operation direction ( > 0 expand, < 0 shrink, = 0 no height change).

ipImage

ITcVnImage

Optional reference image that defines the cropping boundaries, set to 0 if not required.

hrPrev

HRESULT

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

 In/Outputs

Name

Type

Description

stSrcRect

TcVnRectangle_DINT

Source rectangle to be expanded or shrunk.

stDestRect

TcVnRectangle_DINT

Resulting rectangle after expansion or shrinkage.

 Return value

HRESULT

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4026 or later

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

Tc3_Vision