Skip to content

Scaling#

The Scaling camera feature allows you to scale images from sensor size to the size of the image ROI.

For example, assume your camera sensor has a resolution of 2592 x 1944 pixels. Also assume you set the image ROI to 640 x 480 pixels. Now, if you enable scaling, images will be downscaled from 2592 x 1944 to 640 x 480 pixels.

If the aspect ratio of the image ROI doesn't match the aspect ratio of the sensor, output images will be cropped to avoid distortion. For example, assume the aspect ratio of the sensor is 4:3 (e.g., 2592 x 1944 pixels). Also assume you set the image ROI to 500 x 300 pixels. Keeping an aspect ratio of 4:3 would require a resolution of 500 x 375. Therefore, to avoid distortion, the camera crops 75 pixels from the width.

To enable scaling, set the BslScalingEnable parameter to true.

Sample Code#

// Enable scaling
camera.BslScalingEnable.SetValue(true);
INodeMap& nodemap = camera.GetNodeMap();
// Enable scaling
CBooleanParameter(nodemap, "BslScalingEnable").SetValue(true);
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK;  /* Return value of pylon methods */
/* Enable scaling */
errRes = PylonDeviceSetBooleanFeature(hdev, "BslScalingEnable", 1);
CHECK(errRes);

You can also use the pylon Viewer to easily set the parameters.