use cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray, (7, 7), 0)
the triangle size is: [(int(0.08 * width), height), (int(0.92 * width), height), (int(0.5 * width), int(height * 0.3))]
Here are my settings:
minLineLength = 60
maxLineGap = 10
lines = cv2.HoughLinesP(lineImg, 1, np.pi / 120, 100, minLineLength, maxLineGap)
These are the lines found by HoughLinesP:
(7) separate left and right lines, calculate the slope, and draw green lines with the points found by getCoor()
This is because in a frame like below, the right side lane less clear comparing the first frame I showed in this README.
The first right white line we can se is farther way from the camera.
while in a frame like below, where the first right side line is closer to the camera, then the straight line is longer and easier to detect on the picture
improvements:
As we can see from step 4, edge detection has destinguished the edge. So the algorithm for Hough and calculating lines should be improved.
Also, I could extends the line detected from last frame and carry over to make the video look more smooth.
- If the road bends, the triangle in this model will no longer be able to detect appropriate lane area. To imporve this, it needs to be broaden, maybe with a trapazoid
- if the road bends at a large angle, then it won't be detected as a straight line by Hough
Hough Transform is tricky to get right with its parameters. I am not sure I got the best settings.