bethesirius / ChosunTruck

Euro Truck Simulator 2 autonomous driving solution
732 stars 104 forks source link

Reducing extraneous lines in ChosunTruck [windows] #41

Closed zappybiby closed 6 years ago

zappybiby commented 6 years ago

I have been manually adjusting the findLines parameters and have come up with the following: One of the most frequent issues I encounter with ChosunTruck's current implementation is the extraneous lines created by the guardrails along the road. Here are my observations and thoughts about this:

  1. Changing the deltaRho value had a significant impact on the quality of lines detected. I found the optimal value of deltaRho to be around 0.75-0.80. However, changing this by itself would not be sufficient as the lines would typically disappear when the truck accelerates and the IPM window 'zooms out'. While deltaRho's default value of 1 is sufficient in most cases, it may be worth trying to reduce it to 0.90 - 0.95 to see if that reduces the extraneous lines.
    • Consideration: Implementing a version of adaptive IPM like the one found in the linux version may make changing the deltaRho value a viable option.
  2. Changing the minLength and maxGap parameters had a small effect on line detection. However, I do believe our current values of 20 for minLength and 120 for maxGap may be sub-optimal. Through my own personal expirementation, I found the optimal range for minLength to be from 5-35 and the optimal range for maxGap to be from 70-75.
  3. Changing setMinVote had a significant impact on line detection. It is important to note that changing setMinVote won't be effective by itself. This parameter is entirely dependent on the quality of the pre-proccessed image. I found the optimal value to be between 60 and 65.
  4. Guassian blur - I tried replacing cv::blur(gray, blur, cv::Size(10, 10)); with cv2.GaussianBlur(gray, blur, (17,17),0) and I believe it might be more effective at reducing noise. I am still experimenting with this.

I will be creating a related issue regarding the use of the detected lines' angles to devise a way to filter the near-horizontal lines created by the guardrails. I'm also looking at calculating the average slope of the lines to implement cv::fitLine to extrapolate the lines detected. Implementing these features to our project may make the following suggestions above unnecessary.

zappybiby commented 6 years ago

Through the use of thresholding and calculating the angles of lines, I have improved the quality of lines detected by ChosunTruck. I will be pushing this code out soon.