How to Capture Video From Webcam Camera using OpenCV

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

import cv2
vdo=cv2.VideoCapture("D://old/array.mp4")
#vdo=cv2.VideoCapture(0)
while True:
    ret,myframe=vdo.read()
    myframe=cv2.resize(myframe,(500,500))
   # gry=cv2.cEvtColor(myframe,cv2.COLOR_BGR2GRAY)
 #   gry=cv2.resize(myframe, (500, 500))
cv2.imshow('My Web Cam Device',myframe)
  #  cv2.imshow('My Web Cam Device Gray', gry)
    if(cv2.waitKey(1)==ord('e')):
           break
vdo.release()
cv2.destroyAllWindows()

 

Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *