CaptureImage.changeAspectRatio Method

Module: CaptureImage

Definition

Changes the aspect ratio of the image using an interpolation between cropping and padding.

The function blends between cropCenter (alpha=0) and padCenter (alpha=1) operations.

For intermediate alpha values, the result is an interpolation between the two operations.

For example, alpha=0.2 means 80% crop effect and 20% pad effect.

Note

Only BGR 24-bit, RGB 24-bit, and Grayscale 8-bit images are supported.

The result uses black padding (RGB 0,0,0).

CaptureImage changeAspectRatio(double aspectRatio, double alpha)

Parameters

aspectRatio double
in Target aspect ratio (width/height) for the result image. Must be positive.

alpha double
in Interpolation factor (0.0 to 1.0). 0=pure crop, 1=pure pad.

Returns

The resulting image with the specified aspect ratio.

Exceptions

An error has occurred during Devices Library execution.