Resize an input image. More...

Functions

AFAPI array resize (const array &in, const dim_t odim0, const dim_t odim1, const interpType method=AF_INTERP_NEAREST)
 C++ Interface for resizing an image to specified dimensions. More...
 
AFAPI array resize (const float scale0, const float scale1, const array &in, const interpType method=AF_INTERP_NEAREST)
 C++ Interface for resizing an image to specified scales. More...
 
AFAPI array resize (const float scale, const array &in, const interpType method=AF_INTERP_NEAREST)
 C++ Interface for resizing an image to specified scale. More...
 
AFAPI af_err af_resize (af_array *out, const af_array in, const dim_t odim0, const dim_t odim1, const af_interp_type method)
 C Interface for resizing an image to specified dimensions. More...
 

Detailed Description

Resize an input image.

Resizing an input image can be done using either AF_INTERP_NEAREST, AF_INTERP_BILINEAR or AF_INTERP_LOWER, interpolations. Nearest interpolation will pick the nearest value to the location, bilinear interpolation will do a weighted interpolation for calculate the new size and lower interpolation is similar to the nearest, except it will use the floor function to get the lower neighbor.

This function does not differentiate between images and data. As long as the array is defined and the output dimensions are not 0, it will resize any type or size of array.

array in = iota(dim4(5, 3));
// in [5 3 1 1]
// 0.0000 5.0000 10.0000
// 1.0000 6.0000 11.0000
// 2.0000 7.0000 12.0000
// 3.0000 8.0000 13.0000
// 4.0000 9.0000 14.0000
//
// resize(2, in, AF_INTERP_NEAREST) [10 6 1 1]
// 0.0000 5.0000 5.0000 10.0000 10.0000 10.0000
// 1.0000 6.0000 6.0000 11.0000 11.0000 11.0000
// 1.0000 6.0000 6.0000 11.0000 11.0000 11.0000
// 2.0000 7.0000 7.0000 12.0000 12.0000 12.0000
// 2.0000 7.0000 7.0000 12.0000 12.0000 12.0000
// 3.0000 8.0000 8.0000 13.0000 13.0000 13.0000
// 3.0000 8.0000 8.0000 13.0000 13.0000 13.0000
// 4.0000 9.0000 9.0000 14.0000 14.0000 14.0000
// 4.0000 9.0000 9.0000 14.0000 14.0000 14.0000
// 4.0000 9.0000 9.0000 14.0000 14.0000 14.0000
//
// resize(2, in, AF_INTERP_BILINEAR) [10 6 1 1]
// 0.0000 2.5000 5.0000 7.5000 10.0000 10.0000
// 0.5000 3.0000 5.5000 8.0000 10.5000 10.5000
// 1.0000 3.5000 6.0000 8.5000 11.0000 11.0000
// 1.5000 4.0000 6.5000 9.0000 11.5000 11.5000
// 2.0000 4.5000 7.0000 9.5000 12.0000 12.0000
// 2.5000 5.0000 7.5000 10.0000 12.5000 12.5000
// 3.0000 5.5000 8.0000 10.5000 13.0000 13.0000
// 3.5000 6.0000 8.5000 11.0000 13.5000 13.5000
// 4.0000 6.5000 9.0000 11.5000 14.0000 14.0000
// 4.0000 6.5000 9.0000 11.5000 14.0000 14.0000

Function Documentation

AFAPI af_err af_resize ( af_array out,
const af_array  in,
const dim_t  odim0,
const dim_t  odim1,
const af_interp_type  method 
)

C Interface for resizing an image to specified dimensions.

Parameters
[out]outwill contain the resized image of specified by odim0 and odim1
[in]inis input image
[in]odim0is the size for the first output dimension
[in]odim1is the size for the second output dimension
[in]methodis the interpolation type (Nearest by default)
Returns
AF_SUCCESS if the color transformation is successful, otherwise an appropriate error code is returned.
AFAPI array af::resize ( const array in,
const dim_t  odim0,
const dim_t  odim1,
const interpType  method = AF_INTERP_NEAREST 
)

C++ Interface for resizing an image to specified dimensions.

Parameters
[in]inis input image
[in]odim0is the size for the first output dimension
[in]odim1is the size for the second output dimension
[in]methodis the interpolation type (Nearest by default)
Returns
the resized image of specified by odim0 and odim1
Examples:
image_processing/binary_thresholding.cpp, and image_processing/image_editing.cpp.
AFAPI array af::resize ( const float  scale0,
const float  scale1,
const array in,
const interpType  method = AF_INTERP_NEAREST 
)

C++ Interface for resizing an image to specified scales.

Parameters
[in]scale0is scale used for first input dimension
[in]scale1is scale used for second input dimension
[in]inis input image
[in]methodis the interpolation type (Nearest by default)
Returns
the image scaled by the specified by scale0 and scale1
AFAPI array af::resize ( const float  scale,
const array in,
const interpType  method = AF_INTERP_NEAREST 
)

C++ Interface for resizing an image to specified scale.

Parameters
[in]scaleis scale used for both input dimensions
[in]inis input image
[in]methodis the interpolation type (Nearest by default)
Returns
the image scaled by the specified by scale