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 = nullptr );
This function returns outputImage.
// Function prototype.
rescale_image_by_factor(input_image: idt.ImageType,
                        scale_factor: float = 2,
                        interpolation_type: RescaleImageByFactor.InterpolationType = RescaleImageByFactor.InterpolationType.NEAREST_NEIGHBOR,
                        output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// 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

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
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Binary, Label, Grayscale or Multispectral None
input
scale_factor
The zoom factor. float64 [0.01, 40] 2
input
interpolation_type
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
output_image
The output image. Its type is forced to the same value as the input. Its dimensions depend on the scale factor parameter. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral null
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 null

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() );