I am trying to import a picture of size (540,960) using matplotlib. This step is successfully executed. The result is stored in 'image' object (type ndarray).
# Do relevant imports
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
# Read in and grayscale the image
image = mpimg.imread(r'C:\Temp\pic24_bw.jpg')
gray = cv2.cvtColor(image,cv2.COLOR_RGB2GRAY)
But when I try to convert the image into another color space (Gray), using cv2.cvtColor(). I face a error:
error: C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:11111: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor
Please help. Strange thing is this code is running successfully in another citrix environment.