使用HOG描述符peopledetect.py时出错

问题描述 投票:0回答:1

我正在使用带有opencv3的Rpi3和一台Logitech c170网络摄像头。

我使用的代码来自Full body detection and tracking using OpenCV+Python-2.7

我变了

cap=cv2.VideoCapture('vid.avi')

cap=cv2.VideoCapture('0')

因为我正在使用实时视频流。当我启动脚本时,我的网络摄像头上的绿色('on')指示灯确实短暂闪烁,然后我收到以下错误:

OpenCV Error: Assertion failed (dims <= 2 && step[0] > 0) in locateROI, file /home/pi/opencv-3.3.0/modules/core/src/matrix.cpp, line 981 Traceback (most recent call last): File "peopledetect.py", line 25, in <module> found,w=hog.detectMultiScale(frame, winStride=(8,8), padding=(32,32), scale=1.05) cv2.error: /home/pi/opencv-3.3.0/modules/core/src/matrix.cpp:981: error: (-215) dims <= 2 && step[0] > 0 in function locateROI

我查了一下,我的网络摄像头就在适合Rpi3的列表中。

有人知道如何解决这个问题吗?

opencv raspberry-pi real-time webcam
1个回答
0
投票

更改:

cap=cv2.VideoCapture('0')

成:

cap=cv2.VideoCapture(0)

它工作得很好。

© www.soinside.com 2019 - 2024. All rights reserved.