我正在尝试运行视频文件,并出现以下错误。
$ /usr/bin/python3.4 /home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/main.py
Traceback (most recent call last):
File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/main.py", line 19, in <module>
img_aug = process_frame(img)
File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/lane.py", line 615, in process_frame
output = create_output_frame(offcenter, pts, img_undist_, fps, curvature, curve_direction, binary_sub)
File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/lane.py", line 467, in create_output_frame
whole_frame = np.zeros((h*2.5,w*2.34, 3), dtype=np.uint8)
TypeError: 'float' object cannot be interpreted as an integer
最佳答案
下面的行是错误的原因。
np.zeros((h*2.5,w*2.34, 3), dtype=np.uint8)
np.zeros
期望尺寸为整数,而h*2.5
和w*2.34
的计算结果为float
。如果愿意,可以使用int()
将参数转换为整数。关于python - TypeError:“float”对象无法解释为整数(python 3.4版本),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47053017/