Skip to content

Image Processing

Shrink (resizeing)

An implementation to resize RGB image.

Content

Requirements

  • Python
  • OpenCV
    # apt-get install python-opencv
    

Programming

  • create file resize.py
import cv2

# load the image with imread()
imageSource = '../../lena.png'
src = cv2.imread(imageSource)

height, width = src.shape[:2]
dest = cv2.resize(src,(width/2, height/2), interpolation = cv2.INTER_CUBIC)

cv2.imwrite('lena_resize.png',dest)

Running

Original Resized
r r

Observation

  • n/a

Advanced

  • n/a

Reference