ImageDev

RescaleImageByFactor

Rescales the dimensions of a two-dimensional or three-dimensional image.

Access to parameter description

This algorithm generates a resampled image in accordance with a user-defined zoom factor and interpolation mode.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > rescaleImageByFactor( std::shared_ptr< iolink::ImageView > inputImage, double scaleFactor, RescaleImageByFactor::InterpolationType interpolationType, std::shared_ptr< iolink::ImageView > outputImage = NULL );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
scaleFactor
The zoom factor. Float64 [0.01, 40] 2
input
interpolationType
The interpolation mode. Method used to calculate the intensity of each pixel in the result image.
NEAREST_NEIGHBOR Assign the gray level of the nearest pixel.
LINEAR Assign the bilinear interpolation from the four nearest pixels.
SPLINE Assign the cubic interpolation from the nearest pixels.
Enumeration NEAREST_NEIGHBOR
output
outputImage
The output image. Its type is forced to the same value as the input. Its dimensions depend on the scale factor parameter. Image nullptr

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

RescaleImageByFactor rescaleImageByFactorAlgo;
rescaleImageByFactorAlgo.setInputImage( foam );
rescaleImageByFactorAlgo.setScaleFactor( 2.0 );
rescaleImageByFactorAlgo.setInterpolationType( RescaleImageByFactor::InterpolationType::NEAREST_NEIGHBOR );
rescaleImageByFactorAlgo.execute();

std::cout << "outputImage:" << rescaleImageByFactorAlgo.outputImage()->toString();

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

auto result = rescaleImageByFactor( foam, 2.0, RescaleImageByFactor::InterpolationType::NEAREST_NEIGHBOR );

std::cout << "outputImage:" << result->toString();