<< Geometric transformations Geometric transformations warpAffine >>

scicv >> Geometric transformations > resize

resize

Resizes an image.

Syntax

img_out = resize(img_in, size[, scale_x[, scale_y[, interpolation]]])

Parameters

img_in

Input image (Mat).

size

Output image dimensions (double matrix [width, height]).

scale_x

Scale factor along the X axis (double matrix) (default 0).

scale_y

Scale factor along the Y axis (double matrix) (default 0).

interpolation

Interpolation method (double matrix):

  • INTER_NEAREST: a nearest-neighbor interpolation.
  • INTER_LINEAR: a bilinear interpolation (default).
  • INTER_AREA: resampling using pixel area relation.
  • INTER_CUBIC: a bicubic interpolation over 4x4 pixel neighborhood.
  • INTER_LANCZOS4: a Lanczos interpolation over 8x8 pixel neighborhood.
img_out

Output image (Mat).

Description

resize resizes an image, either to the specified size size, or by using the scale factors scale_x and scale_y.

Examples

scicv_Init();

img = imread(getSampleImage("lena.jpg"));

// Resize to a [100, 100] pixels image
img_100x100 = resize(img, [100, 100]);

subplot(1,2,1);
matplot(img_100x100);

// Resize to a half size image
img_half = resize(img, 0, 0.5, 0.5);

subplot(1,2,2);
matplot(img_half);

delete_Mat(img);
delete_Mat(img_100x100);
delete_Mat(img_half);

Report an issue
<< Geometric transformations Geometric transformations warpAffine >>