What does ret and frame mean here?

image-processing, numpy, opencv, python

Solution

ret, frame = cap.read()

- `ret` is a boolean variable that returns true if the frame is available.

- `frame` is an image array vector captured based on the default frames per second defined explicitly or implicitly

Problem

When to use ret and frame? What values do these variables hold? I have just started with image processing, so if there are more changes do let me know. Thank you ``` import numpy as np import cv2 cap = cv2.VideoCapture('Sample Lap HUL_OB_1.56.641_Graphic.mpg') # Define the codec and create VideoWriter object # fourcc = cv2.cv.CV_FOURCC(*'MJPG') out = cv2.VideoWriter('output.mpg',0, 60.0, (640,480)) while(cap.isOpened()): ret, frame = cap.read() if ret==True: # frame = cv2.flip(frame,0) # write the flipped frame out.write(frame) cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break else: break # Release everything if job is finished cap.release() out.release() cv2.destroyAllWindows() ```

Original source