attribute error: none type object has no shape
attribute error: none type object has no shape
我无法 运行 此脚本成功。
我已经尝试 运行 通过命令行在传递参数和不传递参数的同时使用它。我也试过 运行 在 virtualenv 中无济于事。我怀疑我缺少 PiCamera 工作的驱动程序
# if a video path was not supplied, grab the reference
# to the webcam
if not args.get("video", False):
camera = cv2.VideoCapture(0)
# otherwise, grab a reference to the video file
else:
camera = cv2.VideoCapture(args["video"])
# keep looping
while True:
# grab the current frame
(grabbed, frame) = camera.read()
错误:
Traceback (most recent call last):
File "/home/pi/ball-tracking/ball_tracking.py", line 48, in <module>
frame = imutils.resize(frame, width=600)
File "/usr/local/lib/python2.7/dist-packages/imutils/convenience.py"`enter code here`, line 45, in resize
(h, w) = image.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'
'nonetype' 对象引用了未传递给调整大小方法的帧。
这可以通过在 运行 代码之前加载预安装的 v4l2 驱动程序来解决:
sudo modprobe bcm2835-v4l2
我无法 运行 此脚本成功。 我已经尝试 运行 通过命令行在传递参数和不传递参数的同时使用它。我也试过 运行 在 virtualenv 中无济于事。我怀疑我缺少 PiCamera 工作的驱动程序
# if a video path was not supplied, grab the reference
# to the webcam
if not args.get("video", False):
camera = cv2.VideoCapture(0)
# otherwise, grab a reference to the video file
else:
camera = cv2.VideoCapture(args["video"])
# keep looping
while True:
# grab the current frame
(grabbed, frame) = camera.read()
错误:
Traceback (most recent call last):
File "/home/pi/ball-tracking/ball_tracking.py", line 48, in <module>
frame = imutils.resize(frame, width=600)
File "/usr/local/lib/python2.7/dist-packages/imutils/convenience.py"`enter code here`, line 45, in resize
(h, w) = image.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'
'nonetype' 对象引用了未传递给调整大小方法的帧。
这可以通过在 运行 代码之前加载预安装的 v4l2 驱动程序来解决:
sudo modprobe bcm2835-v4l2