人们检测速度很慢

时间:2018-12-13 10:24:15

标签: python opencv

我正在尝试实时检测人员并在他们的位置上设置光标。我使用OpenCV制作了python-script,但运行速度非常慢。我怎样才能更快?

def target():
with mss.mss() as sct:
    filename = sct.shot()
src_gray = cv2.imread(filename, 0)
peopleRectDetector = prd.PeopleRectDetector()
peopleRects = peopleRectDetector.detect(src_gray)
for (x, y, w, h) in peopleRects:
    cv2.rectangle(src_gray, (x, y), (x + w, y + h), 255, 2)
    a = int(x+w/2)
    b = int(y+ h/4)
    win32api.SetCursorPos((a,b))
    break

0 个答案:

没有答案