Skip to content

Instantly share code, notes, and snippets.

@vihar
Last active January 14, 2019 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vihar/15bc7bb87efa103c57dd14e63e89698f to your computer and use it in GitHub Desktop.
Save vihar/15bc7bb87efa103c57dd14e63e89698f to your computer and use it in GitHub Desktop.
import cv2
import matplotlib.pyplot as plt
%matplotlib inline
img_path = 'dog.jpg'
bgr_img = cv2.imread(img_path)
gray_img = cv2.cvtColor(bgr_img, cv2.COLOR_BGR2GRAY)
# Normalise
gray_img = gray_img.astype("float32")/255
plt.imshow(gray_img, cmap='gray')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment