Jan-21-2020, 01:17 PM
Hello. I'm wiriting a program that saves the first and the last frame from a video file. Everything is woking perfectly until I try to save the first frame of the video to my PC.
The error happens on line 17 and it says:
TypeError: Expected Ptr<cv::UMat> for argument '%s'
Thank you for any advice you can provide.
The error happens on line 17 and it says:
TypeError: Expected Ptr<cv::UMat> for argument '%s'
Thank you for any advice you can provide.
def FindScore(path): cam = cv2.VideoCapture(path) last_frame = int(cam.get(cv2.CAP_PROP_FRAME_COUNT)) first_frame = "1" framerate = int(cam.get(cv2.CAP_PROP_FPS)) # ni pomembno relative = int(cam.get(cv2.CAP_PROP_POS_AVI_RATIO)) # ni pomembno print("Video frames: {} ".format(last_frame) ) print("Framerate: {} fps".format(framerate)) # Find first frame cam.set(1,2-1) frame = cam.read() name = './data/frame' + str(last_frame) + '.jpg' cv2.imwrite(name, frame) myimage1 = Image.open(name)