O'Reilly logo

Raspberry Pi Computer Vision Programming by Ashwin Pajankar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Image transformations

In this section, we will see the various transformations on an image, and how to implement them in OpenCV.

Scaling

Scaling is the resizing of the image, which can be accomplished by the cv2.resize() function. It takes image, scaling factor, and interpolation method as inputs.

The interpolation method parameter can have any one of the following values:

  • INTER_LINEAR: This deals with bilinear interpolation (default value)
  • INTER_NEAREST: This deals with the nearest-neighbor interpolation
  • INTER_AREA: This is associated with resampling using pixel area relation (preferred for shrinking)
  • INTER_CUBIC : This deals with bicubic interpolation over 4 x 4 pixel neighborhood (preferred for zooming)
  • INTER_LANCZOS4: This deals with Lanczos interpolation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required