Error in opencv python whie loading Video -


actually loading video using k=cv2.videocapture("it.mp4") in same folder when check opened or not shows "false". , when use k.open() open it, shows me error:

traceback (most recent call last):
file "", line 1, in
typeerror: required argument 'filename' (pos 1) not found

as think not getting file video in same folder. stuck on since long time.

here code:-

import numpy np import cv2 cap=cv2.videocapture("it.mp4") k=cap.isopened() if k==false:     cap.open() 

and shows below error:-

traceback (most recent call last):   file "<stdin>", line 1, in <module> typeerror: required argument 'filename' (pos 1) not found 

by looking @ code easy figure out why getting error. reason using cap.open() without arguments. need pass filename cap.open() in order initialize cv2.videocapture. code should be

import numpy np import cv2 cap=cv2.videocapture("it.mp4") k=cap.isopened() if k==false:    cap.open("it.mp4") 

in order read frames cap can use loop this

while(true):      ret, frame = cap.read()      cv2.imshow('frame',frame)      if cv2.waitkey(1) & 0xff == ord('q'):         break 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -