Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to read video in opencv python

import numpy as np
import cv2
cap = cv2.VideoCapture('videos/wa.avi')
while(cap.isOpened()):
  ret, frame = cap.read()
  gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  cv2.imshow('frame',gray)
  if cv2.waitKey(1) & 0xFF == ord('q'):
    break

cap.release()
cv2.destroyAllWindows()
Comment

read video with opencv

import cv2
frameWidth = 640
frameHeight = 480
cap = cv2.VideoCapture("Resources/test_ video.mp4")
while True:
    success, img = cap.read()
    img = cv2.resize(img, (frameWidth, frameHeight))
    cv2.imshow("Result", img)
    if cv2.waitKey(1) and 0xFF == ord('q'):
         break
Comment

PREVIOUS NEXT
Code Example
Python :: python deep copy of a dictionary 
Python :: ImportError: No module named django.core.wsgi 
Python :: pandas plot xlabel 
Python :: django get superuser password 
Python :: plt line of best fit 
Python :: install library from python code 
Python :: python requests.get timeout 
Python :: r2 score sklearn 
Python :: python sort list by last element 
Python :: runserver manage.py 
Python :: .astype datetime 
Python :: matplotlib legend out of plot 
Python :: python read xls 
Python :: cv2 hconcat 
Python :: python get dir 
Python :: how to make a text input box python pygame 
Python :: printable characters python 
Python :: tkinter info box 
Python :: python get webpage source 
Python :: send embed discord.py 
Python :: pandas shift column 
Python :: python year from date 
Python :: discord.py change status 
Python :: Add help text in Django model forms 
Python :: libraries used in ANN with sklearn 
Python :: python WhatsApp messaging spammer 
Python :: set font size xaxis pandas 
Python :: normalize data python pandas 
Python :: img read 
Python :: python index of max value in list 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =