python做视觉_机器视觉——python实现追踪物体轨迹

import numpy as np

import argparse

import time

import cv2

# construct the argument parse and parse the arguments

ap = argparse.ArgumentParser()

ap.add_argument("-v", "--video",

help = "path to the (optional) video file")

args = vars(ap.parse_args())

# define the upper and lower boundaries for a color

# to be considered "blue"

blueLower = np.array([100,67,0],dtype="uint8")

blueUpper = np.array([255,128,50],dtype="uint8")

# load the video

if not args.get("video"):

camera = cv2.VideoCapture(0)

else:

camera = cv2.VideoCapture(args["video"])

我们将使用NumPy进行数值处理,使用argparse解析命令行参数,使用cv2进行OpenCV绑定。time包是可选的。

我们只需要一个命令行参数,--video,也就是我们视频的路径。

我们将在视频中追踪的对象是蓝色物体。由于除了该物体外,蓝色在视频中的任何其他位置都不常见,因此我们希望跟踪蓝色阴影

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值