1 import numpy as np
2 import cv2
3 import matplotlib.pyplot as plt
4 %matplotlib inline # if you are running this code in jupyter notebook
5
6 img = cv2.imread('/path_to_image/opencv-logo.png',0) # reads image 'opencv-logo.png' as grayscale
7 plt.imshow(img, cmap='gray')