I'm trying to read a video into python (be it live or pre-recorded is irrelevant) then have each frame processed using a thresholding algorithm to convert the video to a 2 colour format.
with a simple thresholding method, i get this error:
cv2.imshow('newFrame',newFrame)
TypeError: Expected Ptr<cv::UMat> for argument 'mat'
Thresholding for images seems simple but i cant seem to convert the data produced from the thresholding method into a format that is recognised by anything further down the line. I have included the full code below.
import numpy as np
import cv2
cap = cv2.VideoCapture('Loop_1.mov')
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
threshed = cv2.threshold(frame,50,255,cv2.THRESH_BINARY)
newFrame = np.array(threshed)
cv2.imshow('newFrame',newFrame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# Release everything if job is finished
cap.release()
#out.release()
cv2.destroyAllWindows()