我如何用colab修复它

时间:2019-07-27 12:16:28

标签: python opencv google-colaboratory

from imutils.video import VideoStream
from imutils.video import FPS
import argparse
import imutils
import time
import cv2
ap = argparse.ArgumentParser()
ap.add_argument("-v", "--video", type=str,help="path to input video file",)
ap.add_argument("-t", "--tracker", required=False,type=str, default="kcf",    help="OpenCV object tracker type")
args = vars(ap.parse_args())

1 个答案:

答案 0 :(得分:0)

如果您希望此代码在Google Collab上正常运行,则应在ArgumentParser中添加一个附加的参数选项:

from imutils.video import VideoStream 
from imutils.video import FPS 
import argparse 
import imutils 
import time 
import cv2 

ap = argparse.ArgumentParser() 
ap.add_argument("-v", "--video", type=str,help="path to input video file",) 
ap.add_argument("-t", "--tracker", required=False,type=str, default="kcf", help="OpenCV object tracker type") 
ap.add_argument("-f", "--file", required=False) 

args = vars(ap.parse_args())