C++ program using OpenCV to detect and track lanes. Can be used for autonomous driving functions, e.g. to determine whether the driver is coming out of the lane.
- Written in C++ with OpenCV
- IDE: Xcode
- Customizable parameters (Treshold, ROI Size, ...)
- Signal Processing:
- Create ROI
- Canny edge detection
- Hough line detector
I only worked with Xcode under OSX. For other IDEs or compilers I can not provide any information.
- In Xcode is set up the library search paths for OpenCV.
- In my case it is /usr/local/Cellar/opencv/3.4.0/lib /usr/local/lib.
- Set path to input file in
main.cpp
or pass arguments at programm start
- Or use a single integer to select one of your web cams. (Webcam1 == 1, cam2 == 2, ...)
- Or provide an pth to a file (video/image)
- Configure options in
lane_detection.h
houghVote
determines the fidelity of the line recognition (higher means more lines kept)- Further you can enable or disable windows of your choice
- Run program
- Use the xcode project file
- You may have to change the library paths to your library folder
The Algorithm creates the ROI, performs the gaussian blur filter to smooth the frame in order to remove noise and perform the canny edge filter.
Used to create a binary image of edges. The Gaussian blur is used, followed by a Sobel filter in the x and y direction to determine the size of the gradient. The non-maximum suppression is applied to remove pixels from an identified edge. To determine an edge, two thresholds are used. If a pixel gradient is greater than the upper threshold, the pixel is retained, and if the pixel is lower than the lower threshold, it is rejected. Pixels in the center of the two thresholds are retained when a neighboring pixel is considered part of an edge.
Used to recognize straight lines where a line is represented by polar coordinates. When all x-y values are represented as polar coordinates, intersection points of the resulting sinusoidal waves show at least two points that share the same line, with the intersection point representing an additional point on the line. As a result, the filter tracks the intersections and declares a line only if the number of points on the line exceeds a certain threshold.
- Apply a Bitwise-AND to put the Filter-Layer on top of the input stream.
- Optimization of the Algorithm (Intersection, Converting infinite lines to finite lines, ...)
- Probabilistic Hough -> Equivalent to the Hough transformation, but provides endpoint values for all lines determined.
If you run into issues while using Lane-Detection, please use one of the following options:
- Use github's issue reporter on the right, so that other people can search these issues too
- Send me an email [email protected] (might take a few days)
I would appreciate it if you would contribute to this project. Do not hesitate to contact me if you are interested. I can give you an introduction to the core and the main concepts of the program. (Intermediate) C++, OpenCV and Math skills are required.
Homepage haugmarkus.de · GitHub @markushaug ·