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 :: pandas add days to date 
Python :: animations text terminal python 
Python :: python save seaborn plot 
Python :: python random number between 1 and 100 
Python :: check if special character in string python 
Python :: how to select all but last columns in python 
Python :: how to execute python script in another script 
Python :: pyqt drag and drop files 
Python :: how to make a star in python turtle 
Python :: install pytorch 
Python :: clear multiprocessing queue python 
Python :: python read csv line by line 
Python :: zip list to dictionary python 
Python :: PANDAS BIGGER PLOTS 
Python :: python play sound 
Python :: pip install numpy 
Python :: python open each file in directory 
Python :: python random date between range 
Python :: pd read csv unname 
Python :: pandas uniqe values in the columns 
Python :: print random string from list python 
Python :: time decorator python 
Python :: timestamp to date python 
Python :: python add zero to string 
Python :: python barcode generator 
Python :: pandas to csv without header 
Python :: read file line by line into list 
Python :: complex phase python 
Python :: hello world python 
Python :: lcm math python library 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =