F_VN_ResizeRegion_TcVnRectangle_DINT
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_VARInputs
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 | Optional reference image that defines the cropping boundaries, set to 0 if not required. | |
hrPrev | HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
In/Outputs
Name | Type | Description |
|---|---|---|
stSrcRect | Source rectangle to be expanded or shrunk. | |
stDestRect | Resulting rectangle after expansion or shrinkage. |
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 |