小编Kar*_*aga的帖子

多对象跟踪 - 参数“newTracker”的预期 Ptr<cv::legacy::Tracker>

我一直在玩 opencv2 使用 Python 来跟踪多个对象 -

cv2.__version__ = 4.5.1

代码 -

import imutils
import time
import cv2
import numpy as np
trackers = cv2.legacy_MultiTracker.create()
vs = cv2.VideoCapture('4.mp4')
while True:
    frame = vs.read()
    if frame is None:
        break
    frame = frame[1]
    (success, boxes) = trackers.update(frame)

    for box in boxes:
        (x, y, w, h) = [int(v) for v in box]
        cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)

    cv2.imshow("Frame", frame)
    key = cv2.waitKey(1) & 0xFF
    if key …
Run Code Online (Sandbox Code Playgroud)

python opencv opencv3.0 cv2

3
推荐指数
1
解决办法
1091
查看次数

标签 统计

cv2 ×1

opencv ×1

opencv3.0 ×1

python ×1