ChosunTruck
ChosunTruck copied to clipboard
Switching to adaptiveThreshold
I have found that using adaptiveThreshold works better for lane detection than the standard threshold being used here: https://github.com/bethesirius/ChosunTruck/blob/889644385ce57f971ec2921f006fbb0a167e6f1e/windows/src/main.cpp#L117
I used the following code to replace that line:
cv::adaptiveThreshold(sobel, contours, 255, ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY, 21, -3);
A comparison between my implementation of adaptivethreshold and the standard threshold can be viewed here: https://www.youtube.com/watch?v=GT3MJb495Ak&feature=youtu.be
- The left output window shows lines being drawn on the contours created by adaptiveThreshold while the right output window shows the standard threshold that we are using currently.
- adaptiveThreshold works in a variety of lighting settings. It even works even when driving at night with the headlights off!
- with the headlights on during the night, adaptiveThreshold can create 'double lines' (which usually doesn't affect steering). This can be adjusted by changing the blockSize and C parameters
Good works! This feature can improve driving at night. It will be perfect we can find better paramerers, but cv::threshold() and cv::adaptiveThreshold() can be changed by appropriate conditions. For example, at night without headlinghts, use adaptiveThreshold() and at others, use threshold().