opencv — videocapture
I am a Youtuber. My channel name is Powerful Learning. I post free certifications, free internships and free webinars.
I have already posted opencv beginner level tutorials and code on medium and Youtube. Kindly take a look
- openv — read,write and show an image -link
- opencv — color image to grayscale image -link
- opencv- to print image property — link
- opencv — Resize an image-link
- opencv — normal image to blurred image -link
- opencv-normal to binary image — link
- opencv-moving object detection -link
Videocapture code
WATCH VIDEO TO KNOW THE IDENTATIONS — LINK
import cv2
#importing opencv library — video/image
vs = cv2.VideoCapture(0)
#if 0 is not working try giving 1 or 2
while True:
#infinite loop please give indentation
flag,image=vs.read()
#VideoCapture returns a tuple (return value, image)
cv2.imshow(“video stream”,image)
key =cv2.waitKey(1) & 0xFF
#allows users to display a window for given milliseconds
or until any key is pressed
0xFF -> just used to mask off the last
8bits of the sequence
if key == ord(“q”):
break
vs.release()
cv2.destroyAllWindows()