How to do Resize of image in Opencv Python

 How to do Resize of image in Opencv Python


import cv2
import numpy as np
img = cv2.imread('input.jpg')
imgResize = cv2.resize(img,(300,200))
cv2.imshow('Resize image',imgResize)

Code Explanation:
  • First we will import cv2 and numpy module
  • Then we will read our image by using cv2.imread and store this image into a variable called img
  • Then we will see what is the actual Size of the image by tyiping img.shape 
    Note : img is the name in which our image is store
  • Then we will resize our image as per our requirements by using command cv2.resize
  • after that we will show our image by cv2.imshow
  • To save the image checkout this blog

Post a Comment