Home Image Resizing, Scaling
Post
Cancel

Image Resizing, Scaling

What is image Resizing?

In image resizing, we simply change the width and height. To do image Resizing, we can use
cv2.resize(image, dsize(output imagesize), x_scale, y_scale, interpolation)
If dsize is None, the output image will be calculated as a function of scaling using x&y scale.



List of Interpolation

  • INTER_NEAREST : a nearest-neighbor interpolation. the fastest, the worst quality.
  • INTER_LINEAR : a bilinear interpolation (used by default). the best efficiency.
  • INTER_AREA : resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to theINTER_NEAREST method.
  • INTER_CUBIC : a bicubic interpolation over 4×4 pixel neighborhood.more slower than INTER_LINEAR, more quality than it.
  • INTER_LANCZOS4 : a Lanczos interpolation over 8×8 pixel neighborhood. the slowest, the best quality.

What is image scaling?

In image scaling, we change the size while keeping the width-to-height ratio constant. To do image scaling, we can use
cv2.resize(image, dsize=None, x_scale, y_scale, interpolation)



Implementation

This post is licensed under CC BY 4.0 by the author.