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:

HRESULT ResizeRegion(
    HRESULT             hrPrev,
    TcVnRectangle_DINT& stSrcRect,
    TcVnRectangle_DINT& stDestRect,
    float               fWidthRatio,
    float               fHeightRatio,
    LONG                nMinWidthOffset,
    LONG                nMinHeightOffset,
    ITcVnImage*         ipImage
)

Parameters

Name

Type

Description

hrPrev

HRESULT

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

stSrcRect

TcVnRectangle_DINT&

Source rectangle to be expanded or shrunk.

stDestRect

TcVnRectangle_DINT&

Resulting rectangle after expansion or shrinkage.

fWidthRatio

float

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

float

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

LONG

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

LONG

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.

 Return value

HRESULT

Required License

TC3 Vision Base