zappybiby / EuroTruckAutopilot

Autonomous Driving for Euro Truck Simulator 2
MIT License
12 stars 2 forks source link

Need to detect two lines at the same time #2

Closed zappybiby closed 6 years ago

zappybiby commented 6 years ago

We are currently drawing one line at a time. We need to draw two lines simultaneously in order to calculate the center of the lane.

ajchili commented 6 years ago

Is this issue the main priority? We should also get footage to test with so that we do not have to constantly hop into the game to develop.

zappybiby commented 6 years ago

3 has higher priority than this, but both will still need to be dealt with in order to have ETA successfully drive the truck.

By implementing #3, we would have an array containing the average of the last x lines detected. We don't necessarily have to find the two lines simultaneously, as the lines are detected so fast that the average of them would provide us with two lines on each side of the lane. Then we could use the histogram method described in #4 to get the x-positions of the two lines in order to calculate the center of the lane.

I made a 30-second "stress test" video that goes through a variety of lighting situations. You can have opencv read from that video by using the following code in grab_window():

cap = cv2.VideoCapture('EuroStressTest.mp4')

while(cap.isOpened()):
    ret, frame = cap.read()
    cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
zappybiby commented 6 years ago

Implemented in https://github.com/zappybiby/EuroTruckAutopilot/commit/e1beb015fdab00a6728d2bb304b3412e53ad27e0