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 the outputImage output parameter.
// 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 );
This function returns the outputImage output parameter.
// Function prototype.
rescale_image_by_factor( input_image,
                         scale_factor = 2,
                         interpolation_type = RescaleImageByFactor.InterpolationType.NEAREST_NEIGHBOR,
                         output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
RescaleImageByFactor( IOLink.ImageView inputImage,
                      double scaleFactor = 2,
                      RescaleImageByFactor.InterpolationType interpolationType = ImageDev.RescaleImageByFactor.InterpolationType.NEAREST_NEIGHBOR,
                      IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name RescaleImageByFactor

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();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

rescale_image_by_factor_algo = imagedev.RescaleImageByFactor()
rescale_image_by_factor_algo.input_image = foam
rescale_image_by_factor_algo.scale_factor = 2.0
rescale_image_by_factor_algo.interpolation_type = imagedev.RescaleImageByFactor.NEAREST_NEIGHBOR
rescale_image_by_factor_algo.execute()

print( "output_image:", str( rescale_image_by_factor_algo.output_image ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

RescaleImageByFactor rescaleImageByFactorAlgo = new RescaleImageByFactor
{
    inputImage = foam,
    scaleFactor = 2.0,
    interpolationType = RescaleImageByFactor.InterpolationType.NEAREST_NEIGHBOR
};
rescaleImageByFactorAlgo.Execute();

Console.WriteLine( "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();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

result = imagedev.rescale_image_by_factor( foam, 2.0, imagedev.RescaleImageByFactor.NEAREST_NEIGHBOR )

print( "output_image:", str( result ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

IOLink.ImageView result = Processing.RescaleImageByFactor( foam, 2.0, RescaleImageByFactor.InterpolationType.NEAREST_NEIGHBOR );

Console.WriteLine( "outputImage:" + result.ToString() );