【发布时间】:2021-11-04 07:50:44
【问题描述】:
代码是:
lines = cv2.HoughLinesP(masked_image, rho, theta, threshold, np.array([]), minLineLength=min_line_len, maxLineGap=max_line_gap)
# Create an empty black image
line_image = np.zeros((masked_image.shape[0], masked_image.shape[1], 3), dtype=np.uint8)
for line in lines: #where the error is happing
for x1,y1,x2,y2 in line:
cv2.line(line_image, (x1, y1), (x2, y2), [0, 0, 255], 20)
出现此错误:
Traceback (most recent call last):
File "linefindinginvideo.py", line 48, in <module>
for line in lines:
TypeError: 'NoneType' object is not iterable
完整代码请到我的 GitHub https://github.com/jimhoggey/SelfdrivingcarForza/blob/main/lanemarkinginvideo.py
【问题讨论】:
-
这能回答你的问题吗? stackoverflow.com/questions/35609719/…