Please explain the code , the video in the course didnt explain anything at all
import cv2
cap= cv2.VideoCapture(0)
while True:
ret,frame= cap.read()
if ret==False:
continue
cv2.imshow("VideoFrame", frame)
key_pressed=cv2.waitKey(1) & 0xFF
if key_pressed == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
-
what are ret and frame? are they both variables and have the same value? or is like the videocapture() function returns 2 values and ret takes the value True or False meaning that the VideoCapture() function was able to use the webcam or not and frame takes all the images streamed
-
how does the program stop working please explain briefly what is happening there?
key pressed takes some 8 bit value from the waitkey() function and if that value matches a certain keyword it would stop but the program works for every letter that we use in place of q due to which i am unable to understand its working -
what are cap.release() and destroyallwindows()? this program works without them aswell so whats their use?