This project is just a self-learning experience by implementing in C++14 an algorithm similar to this Udacity project.
Demo on straight road videoclip:
Prerequisites of OpenCV C++ and Boost.
- Install OpenCV:
sudo apt update && sudo apt install libopencv-dev python3-opencv
- Install Boost:
sudo apt-get install libboost-all-dev
Then,
- Clone this repo.
- Make a build directory:
mkdir build && cd build
- Compile:
cmake .. && make
- Run it:
./lane_finding_advanced_cpp
The implementation can be seen in src/main.cpp
with the following steps:
-
Undistort the camera image.
-
Binarize the image to black white where the yellow and white lines of the road are highlighted.
-
Warp the image to bird-eye view (BEV).
-
Detect lane points on bird eye view.
-
Fit the lane points with second order polynomials.
-
If we are on video mode, apply simple moving-average on the polynomial coefficients.
-
Generate lane points on the BEV using the coefficients.
-
Unwarp those points back to the original undistorted image.
-
Calculate the curve radius and offset of the vehicle from the lane center
-
Visualize the result.