MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / average_lines_intercept

Function average_lines_intercept

Finding_Lanes/lanes.py:24–40  ·  view source on GitHub ↗
(image, lines)

Source from the content-addressed store, hash-verified

22
23
24def average_lines_intercept(image, lines):
25 left_fit = []
26 right_fit = []
27 for line in lines:
28 x1, y1, x2, y2 = line.reshape(4)
29 parameters = np.polyfit((x1, x2), (y1, y2), 1)
30 slope = parameters[0]
31 intercept = parameters[1]
32 if slope < 0:
33 left_fit.append((slope, intercept))
34 else:
35 right_fit.append((slope, intercept))
36 left_fit_average = np.average(left_fit, axis=0)
37 right_fit_average = np.average(right_fit, axis=0)
38 left_line = make_coordinate(image, left_fit_average)
39 right_line = make_coordinate(image, right_fit_average)
40 return np.array([left_line, right_line])
41
42
43def canny(image):

Callers 1

lanes.pyFile · 0.85

Calls 1

make_coordinateFunction · 0.85

Tested by

no test coverage detected