When I try to run a video I get the following error. The video runs then the error occurs. I am unable to find any information about this error.
\modules\imgproc\src\color.cpp:3961: error: (-215) (scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F) in function cv::cvtColor
The code I am running is
greenLower = np.array([26, 86, 6],dtype=np.uint8)
greenUpper = np.array([90, 255, 255],dtype=np.uint8)
cap = cv2.VideoCapture('E:/PYTHON SCRIPTS/Learning python/metronome1.mp4')
print cap.grab()
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_RGB2HSV)
mask = cv2.inRange(gray, greenLower, greenUpper)
mask = cv2.erode(mask, None, iterations=2)
mask = cv2.dilate(mask, None, iterations=2)
cv2.imshow('duck',mask)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
Thanks