0

我写了这个并且它有效。但最后一个函数(hog.detectMultiScale)不返回任何东西。我不知道为什么。

'''

import numpy as np
import cv2
hog = cv2.HOGDescriptor()
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())

cv2.startWindowThread()

# open video stream
cap = cv2.VideoCapture("E:\\3.mp4")

# the output will be written to output.avi
out = cv2.VideoWriter('output.avi',cv2.VideoWriter_fourcc(*'MJPG'),15.,
    (640, 480))

while (True):
    # Capture frame-by-frame
    ret, frame = cap.read()

    # resizing for faster detection
    frame = cv2.resize(frame, (640, 480))
    returns the bounding boxes for the detected objects
       
    (boxes, weights) = hog.detectMultiScale(frame)

'''

4

0 回答 0