I am a newbie to openCV and I am stuck at this error with no resolution. I am trying to convert an image from BGR to grayscale format using this code-
img = cv2.
It may be easier to initialize new numpy array with initial image as source and dtype=np.uint8:
dtype=np.uint8
import numpy as np img = cv2.imread('path//to//image//file') img = np.array(img, dtype=np.uint8) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)