opencv — videocapture

Powerful learning
1 min readJan 6, 2023

--

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

  1. openv — read,write and show an image -link
  2. opencv — color image to grayscale image -link
  3. opencv- to print image property — link
  4. opencv — Resize an image-link
  5. opencv — normal image to blurred image -link
  6. opencv-normal to binary image — link
  7. 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()

--

--

Powerful learning

Mini blog on Free certifications, internships and webinars