Give the full path of image with forward slash. It solved the error for me.
E.g.
import numpy as np
import cv2
img = cv2.imread('C:/Python34/images/2015-05-27-191152.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Also, if you give 0
in second parameter while loading image using cv2.imread
than no need to convert image using cvtColor
, it is already loaded as grayscale image eg.
import numpy as np
import cv2
gray = cv2.imread('C:/Python34/images/2015-05-27-191152.jpg',0)