This is a Python command line project made with Python, OpenCV, and Numpy.
- Install python 3
- Clone the repo
- Install dependencies
pip3 install -r requirements.txt
- Run project
python3 main.py
- The program will automatically detect all lanes/edges in the lower half of the video.
- Either use a camera, or a recorded video with filename
input.mp4
- Press
q
to exit the program.
First, a frame is captured from the MP4 video. Then we define a region_of_interest
with vertices as (100, height), (width/2, height/2), (width, height)
, which is essentially a triangle starting at the bottom corners, and peaking at the mid point of the image. All further calculations happen in this region.
Next, we plan to use the Canny Algorithm to detect the edges in the frame, but we first convert the image to grayscale for best results. After this, we crop the image to remove everything but our region of interest triangle, and call the OpenCV's in-built HoughLinesP
function on it. This coupled with the draw function will create the lines(shown with green) and then superimpose them on our original frame, which is finally returned. This process is repeated for every frame in the video.