SlideShare a Scribd company logo
1 of 5
Download to read offline
Lane Detection
Fei Fei Zheng
December 2018
Abstract
Lane detection is an important component of intelligent transportation systems.
First, lane marks are extracted based on color information and the resultant binary
image with Canny line detection. Next, the perspective transformation and define the
Region of Interest(ROI) helps eliminate irrelevant elements in the image. The starting
points of lane lines can be roughly determined by calculating the histogram of the binary
image. Finally, the pixels of lane lines are detected by applying sliding windows from
detected starting points. The proposed algorithm can be used to detect lane lines on
both images and videos.
Keywords— Computer vision, lane detection
1 Introduction
Image
Frames
Image
Color
Extraction
Image
Color
Analysis
Lane Mark
Extraction
Sobel
Filter
Region
of
Interest
Lane Position
Determination
Perspective
Transform
Histogram
Lane Mark
Recognition
Sliding
Windows
Polynomial
Fit
Figure 1: Flow diagram of the algorithm
Detecting and localizing lanes from a road image is an important component of intelligent
transportation system applications. Intelligent vehicles are expected to be able to follow
the lane direction to ensure the safety of both passengers and pedestrians. The algorithm
is built from scratch. While I try different methods to get the optimal result, I learn how
those methods work and how to integrate all the separate pieces into one.
The proposed algorithm is illustrated in Fig.1. The algorithm assumes that the lane
lines on the road are marked with white or yellow. Therefore, we utilize color information
as the basis of our lane-detection algorithm. The lane mark extraction results in the binary
image. When extracting lane marks based on the result of Sobel and color filters, I define
the region of interest to eliminate the irrelevant elements on the image such as trees and
vehicles. In order to get ”birds-eye view”, I apply a perspective transform to rectify binary
image. The potential starting points of the lane marks are determined by finding peaks on
the histogram of the lower half of the rectified binary image. After getting the pixels of lane
1
marks with sliding windows moving upward from starting points, I can fit a polynomial line
to those points to find the direction of the lane. After all, I can pass back an overlay to the
original frame of the area between the curves to visualize the result.
2 Datasets
It’s a 4-hour road trip video from YouTube. The video is converted into thousands of frames.
I randomly select one thousand continuous frames and divided them into four groups. Each
frame is 1920 by 1080 pixels. The frames are used to test the accuracy of the algorithm.
3 Algorithm
3.1 Lane Mark Extraction
Given an image in RGB color space, it first converts to LAB color space Fig.2. It will apply
Sobel filter in both x-axis and y-axis to the L channel image, then use the combination
of color and gradient thresholds to obtain a magnitude-based and direction-based binary
image where the lane lines are clearly visible Fig.3.
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
L Channel
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
A Channel
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
B Channel
Figure 2: Original Image and LAB color space
3.2 Lane Position Determination
Pick four points in a trapezoidal shape lying along the lines that would represent a rectangle
when looking down on the road from above. Apply perspective transform by using the
warpPerspective function in OpenCV to generate the rectified binary image with ”birds-
eye view”. The white pixels on the image potentially belong to the lane marks. Peak
detection function takes the lower half of the warped binary image, the highest points of
2
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Binary Image with Sobel Filter and color threshold
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Binary Image with ROI mask
Figure 3: Binary Images
the accumulated values in each side are potential starting points to detect lane marks Fig.4.
When the car deviates from the center of the lane, if the histogram is simply divided into
left and right half, the peaks detection result will be incorrect. To solve this problem, an
assertion loop is implemented in the function. Assume the lane width is not less than 500
pixels compare to the image size, if the distance between two detected peak is less than the
lane width, it will adjust the center of histogram based on the location of current peaks and
re-detect the peaks.
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Warped Binary Image (Perspective Transformation)
0 250 500 750 1000 1250 1500 1750 2000
x axis
0
100
200
300
400
500
pixelcount
Histogram of Binary Warped Image
Left peak
Right peak
Figure 4: Peak Detection
3.3 Lane Mark Recognition
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Sliding Windows Lane Detection
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Lane Region
Figure 5: Peak Detection
3
The sliding window detection function begins tracing lanes in the binary images with
series of left and right ”windows” moving upwards, show in Fig.5. The search windows
start from the peaks detected in the histogram. If the pixels in a search window is beyond
the threshold value, the window will be re-centered to the mean position. When the lane
marked is dashed, it is possible no activated pixels in a search window. In this case, the
window will make a guess based on the other lane lines and a lane mark width. Since the
frames are continuous, the previous lane position can be used as a reference to improve the
efficiency of the sliding windows detection. After the window sliding search, a list of left
and right pixel locations are collected. Fit a quadratic equation to all the pixels by using
polyfit function in NumPy. Detected lane can overlay on the original image by using the
inverse matrix of the perspective transform to visualize the algorithm result Fig. 6.
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image with Detected Lane Overlay
Figure 6: Lane Detection
4 Results
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image with Detected Lane Overlay
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image with Detected Lane Overlay
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image with Detected Lane Overlay
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image with Detected Lane Overlay
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image with Detected Lane Overlay
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image
0 250 500 750 1000 1250 1500 1750
0
200
400
600
800
1000
Original Image with Detected Lane Overlay
Figure 7: Lane Detection Results
The test results of the algorithm are shown in Fig. 7. The run time of processing single
frame is 1.24 seconds.
4
5 Conclusion
This project covers the color and gradient threshold, perspective transform and sliding win-
dows to identify lane marks. The data set is chosen randomly with no camera specification.
For the binary image of perspective transformation Fig.3, the lane marks are not exactly
parallel. Generally, we calibrate the camera before applying the algorithm. This algorithm
is surprisingly robust to detect the lane marks accurately without camera parameters. There
are many improvements could be made to this project. In practice, the lane width may
be changing over time where the lane marks may not appear on the bottom of the frame.
Auto increasing search window width may help in this situation. Develop more flexible lane
mark extraction method to produce better binary image under various lighting conditions.
Apply other relevant computer vision techniques to reinforce the algorithm when noisy in
the image increases.
5

More Related Content

What's hot

Feature detection and matching
Feature detection and matchingFeature detection and matching
Feature detection and matchingKuppusamy P
 
Point processing
Point processingPoint processing
Point processingpanupriyaa7
 
Lane detection by use of canny edge
Lane detection by use of canny edgeLane detection by use of canny edge
Lane detection by use of canny edgebanz23
 
Object Detection using Deep Neural Networks
Object Detection using Deep Neural NetworksObject Detection using Deep Neural Networks
Object Detection using Deep Neural NetworksUsman Qayyum
 
Automatic Number Plate Recognition (ANPR)
Automatic Number Plate Recognition (ANPR)Automatic Number Plate Recognition (ANPR)
Automatic Number Plate Recognition (ANPR)Vidyut Singhania
 
Vehicle counting for traffic management
Vehicle counting for traffic management Vehicle counting for traffic management
Vehicle counting for traffic management ADEEBANADEEM
 
Vehicle Detection using Camera
Vehicle Detection using CameraVehicle Detection using Camera
Vehicle Detection using CameraShubham Agrahari
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation pptGichelle Amon
 
Image feature extraction
Image feature extractionImage feature extraction
Image feature extractionRushin Shah
 
Image pre processing - local processing
Image pre processing - local processingImage pre processing - local processing
Image pre processing - local processingAshish Kumar
 
Image degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem AshrafImage degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem AshrafMD Naseem Ashraf
 
Vehicle detection through image processing
Vehicle detection through image processingVehicle detection through image processing
Vehicle detection through image processingGhazalpreet Kaur
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentationasodariyabhavesh
 
Image proccessing and its application
Image proccessing and its applicationImage proccessing and its application
Image proccessing and its applicationAshwini Awatare
 
Lec15: Medical Image Registration (Introduction)
Lec15: Medical Image Registration (Introduction)Lec15: Medical Image Registration (Introduction)
Lec15: Medical Image Registration (Introduction)Ulaş Bağcı
 
Color fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image ProcessingColor fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image ProcessingAmna
 

What's hot (20)

Feature detection and matching
Feature detection and matchingFeature detection and matching
Feature detection and matching
 
Point processing
Point processingPoint processing
Point processing
 
Lane detection by use of canny edge
Lane detection by use of canny edgeLane detection by use of canny edge
Lane detection by use of canny edge
 
Object Detection using Deep Neural Networks
Object Detection using Deep Neural NetworksObject Detection using Deep Neural Networks
Object Detection using Deep Neural Networks
 
Human Emotion Recognition
Human Emotion RecognitionHuman Emotion Recognition
Human Emotion Recognition
 
Automatic Number Plate Recognition (ANPR)
Automatic Number Plate Recognition (ANPR)Automatic Number Plate Recognition (ANPR)
Automatic Number Plate Recognition (ANPR)
 
Histogram Equalization
Histogram EqualizationHistogram Equalization
Histogram Equalization
 
Vehicle counting for traffic management
Vehicle counting for traffic management Vehicle counting for traffic management
Vehicle counting for traffic management
 
Vehicle Detection using Camera
Vehicle Detection using CameraVehicle Detection using Camera
Vehicle Detection using Camera
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation ppt
 
Image feature extraction
Image feature extractionImage feature extraction
Image feature extraction
 
Image pre processing - local processing
Image pre processing - local processingImage pre processing - local processing
Image pre processing - local processing
 
Image degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem AshrafImage degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem Ashraf
 
Vehicle detection through image processing
Vehicle detection through image processingVehicle detection through image processing
Vehicle detection through image processing
 
Color models
Color modelsColor models
Color models
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
 
Introduction to OpenCV
Introduction to OpenCVIntroduction to OpenCV
Introduction to OpenCV
 
Image proccessing and its application
Image proccessing and its applicationImage proccessing and its application
Image proccessing and its application
 
Lec15: Medical Image Registration (Introduction)
Lec15: Medical Image Registration (Introduction)Lec15: Medical Image Registration (Introduction)
Lec15: Medical Image Registration (Introduction)
 
Color fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image ProcessingColor fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image Processing
 

Similar to Lane Detection

Leader Follower Formation Control of Ground Vehicles Using Dynamic Pixel Coun...
Leader Follower Formation Control of Ground Vehicles Using Dynamic Pixel Coun...Leader Follower Formation Control of Ground Vehicles Using Dynamic Pixel Coun...
Leader Follower Formation Control of Ground Vehicles Using Dynamic Pixel Coun...ijma
 
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...IJRTEMJOURNAL
 
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...journal ijrtem
 
Advanced Lane Finding
Advanced Lane FindingAdvanced Lane Finding
Advanced Lane FindingBill Kromydas
 
IRJET- 3D Vision System using Calibrated Stereo Camera
IRJET- 3D Vision System using Calibrated Stereo CameraIRJET- 3D Vision System using Calibrated Stereo Camera
IRJET- 3D Vision System using Calibrated Stereo CameraIRJET Journal
 
Driver Drowsiness Detection Using Matlab
Driver Drowsiness Detection Using MatlabDriver Drowsiness Detection Using Matlab
Driver Drowsiness Detection Using MatlabHanojhan Rajahrajasingh
 
An automatic algorithm for object recognition and detection based on asift ke...
An automatic algorithm for object recognition and detection based on asift ke...An automatic algorithm for object recognition and detection based on asift ke...
An automatic algorithm for object recognition and detection based on asift ke...Kunal Kishor Nirala
 
21.Demir.pdf
21.Demir.pdf21.Demir.pdf
21.Demir.pdfFaSu6
 
Automatic no. plate recognition
Automatic no. plate recognitionAutomatic no. plate recognition
Automatic no. plate recognitionAnjali Mehra
 
Report bep thomas_blanken
Report bep thomas_blankenReport bep thomas_blanken
Report bep thomas_blankenxepost
 
How do self driving cars detects lane lines so easily
How do self driving cars detects lane lines so easilyHow do self driving cars detects lane lines so easily
How do self driving cars detects lane lines so easilyANOLYTICS
 
TUBraunschweig_SummerResearch_Thesis_Dervisevic
TUBraunschweig_SummerResearch_Thesis_DervisevicTUBraunschweig_SummerResearch_Thesis_Dervisevic
TUBraunschweig_SummerResearch_Thesis_DervisevicAleksandra Dervisevic
 
License plate recognition
License plate recognitionLicense plate recognition
License plate recognitionrahul bhambri
 
Environment Detection and Path Planning Using the E-puck Robot
Environment Detection and Path Planning Using the E-puck Robot Environment Detection and Path Planning Using the E-puck Robot
Environment Detection and Path Planning Using the E-puck Robot IRJET Journal
 
Final Project Report Nadar
Final Project Report NadarFinal Project Report Nadar
Final Project Report NadarMaher Nadar
 

Similar to Lane Detection (20)

SMOKE DETECTION ALARM.docx
SMOKE DETECTION ALARM.docxSMOKE DETECTION ALARM.docx
SMOKE DETECTION ALARM.docx
 
Leader Follower Formation Control of Ground Vehicles Using Dynamic Pixel Coun...
Leader Follower Formation Control of Ground Vehicles Using Dynamic Pixel Coun...Leader Follower Formation Control of Ground Vehicles Using Dynamic Pixel Coun...
Leader Follower Formation Control of Ground Vehicles Using Dynamic Pixel Coun...
 
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
 
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
A Study on Single Camera Based ANPR System for Improvement of Vehicle Number ...
 
Advanced Lane Finding
Advanced Lane FindingAdvanced Lane Finding
Advanced Lane Finding
 
B018110915
B018110915B018110915
B018110915
 
Fb4301931934
Fb4301931934Fb4301931934
Fb4301931934
 
IRJET- 3D Vision System using Calibrated Stereo Camera
IRJET- 3D Vision System using Calibrated Stereo CameraIRJET- 3D Vision System using Calibrated Stereo Camera
IRJET- 3D Vision System using Calibrated Stereo Camera
 
Driver Drowsiness Detection Using Matlab
Driver Drowsiness Detection Using MatlabDriver Drowsiness Detection Using Matlab
Driver Drowsiness Detection Using Matlab
 
An automatic algorithm for object recognition and detection based on asift ke...
An automatic algorithm for object recognition and detection based on asift ke...An automatic algorithm for object recognition and detection based on asift ke...
An automatic algorithm for object recognition and detection based on asift ke...
 
21.Demir.pdf
21.Demir.pdf21.Demir.pdf
21.Demir.pdf
 
Automatic no. plate recognition
Automatic no. plate recognitionAutomatic no. plate recognition
Automatic no. plate recognition
 
Report bep thomas_blanken
Report bep thomas_blankenReport bep thomas_blanken
Report bep thomas_blanken
 
How do self driving cars detects lane lines so easily
How do self driving cars detects lane lines so easilyHow do self driving cars detects lane lines so easily
How do self driving cars detects lane lines so easily
 
TUBraunschweig_SummerResearch_Thesis_Dervisevic
TUBraunschweig_SummerResearch_Thesis_DervisevicTUBraunschweig_SummerResearch_Thesis_Dervisevic
TUBraunschweig_SummerResearch_Thesis_Dervisevic
 
License plate recognition
License plate recognitionLicense plate recognition
License plate recognition
 
Environment Detection and Path Planning Using the E-puck Robot
Environment Detection and Path Planning Using the E-puck Robot Environment Detection and Path Planning Using the E-puck Robot
Environment Detection and Path Planning Using the E-puck Robot
 
Report NIYANTRA
Report NIYANTRAReport NIYANTRA
Report NIYANTRA
 
Final Paper
Final PaperFinal Paper
Final Paper
 
Final Project Report Nadar
Final Project Report NadarFinal Project Report Nadar
Final Project Report Nadar
 

Recently uploaded

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

Lane Detection

  • 1. Lane Detection Fei Fei Zheng December 2018 Abstract Lane detection is an important component of intelligent transportation systems. First, lane marks are extracted based on color information and the resultant binary image with Canny line detection. Next, the perspective transformation and define the Region of Interest(ROI) helps eliminate irrelevant elements in the image. The starting points of lane lines can be roughly determined by calculating the histogram of the binary image. Finally, the pixels of lane lines are detected by applying sliding windows from detected starting points. The proposed algorithm can be used to detect lane lines on both images and videos. Keywords— Computer vision, lane detection 1 Introduction Image Frames Image Color Extraction Image Color Analysis Lane Mark Extraction Sobel Filter Region of Interest Lane Position Determination Perspective Transform Histogram Lane Mark Recognition Sliding Windows Polynomial Fit Figure 1: Flow diagram of the algorithm Detecting and localizing lanes from a road image is an important component of intelligent transportation system applications. Intelligent vehicles are expected to be able to follow the lane direction to ensure the safety of both passengers and pedestrians. The algorithm is built from scratch. While I try different methods to get the optimal result, I learn how those methods work and how to integrate all the separate pieces into one. The proposed algorithm is illustrated in Fig.1. The algorithm assumes that the lane lines on the road are marked with white or yellow. Therefore, we utilize color information as the basis of our lane-detection algorithm. The lane mark extraction results in the binary image. When extracting lane marks based on the result of Sobel and color filters, I define the region of interest to eliminate the irrelevant elements on the image such as trees and vehicles. In order to get ”birds-eye view”, I apply a perspective transform to rectify binary image. The potential starting points of the lane marks are determined by finding peaks on the histogram of the lower half of the rectified binary image. After getting the pixels of lane 1
  • 2. marks with sliding windows moving upward from starting points, I can fit a polynomial line to those points to find the direction of the lane. After all, I can pass back an overlay to the original frame of the area between the curves to visualize the result. 2 Datasets It’s a 4-hour road trip video from YouTube. The video is converted into thousands of frames. I randomly select one thousand continuous frames and divided them into four groups. Each frame is 1920 by 1080 pixels. The frames are used to test the accuracy of the algorithm. 3 Algorithm 3.1 Lane Mark Extraction Given an image in RGB color space, it first converts to LAB color space Fig.2. It will apply Sobel filter in both x-axis and y-axis to the L channel image, then use the combination of color and gradient thresholds to obtain a magnitude-based and direction-based binary image where the lane lines are clearly visible Fig.3. 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 L Channel 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 A Channel 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 B Channel Figure 2: Original Image and LAB color space 3.2 Lane Position Determination Pick four points in a trapezoidal shape lying along the lines that would represent a rectangle when looking down on the road from above. Apply perspective transform by using the warpPerspective function in OpenCV to generate the rectified binary image with ”birds- eye view”. The white pixels on the image potentially belong to the lane marks. Peak detection function takes the lower half of the warped binary image, the highest points of 2
  • 3. 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Binary Image with Sobel Filter and color threshold 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Binary Image with ROI mask Figure 3: Binary Images the accumulated values in each side are potential starting points to detect lane marks Fig.4. When the car deviates from the center of the lane, if the histogram is simply divided into left and right half, the peaks detection result will be incorrect. To solve this problem, an assertion loop is implemented in the function. Assume the lane width is not less than 500 pixels compare to the image size, if the distance between two detected peak is less than the lane width, it will adjust the center of histogram based on the location of current peaks and re-detect the peaks. 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Warped Binary Image (Perspective Transformation) 0 250 500 750 1000 1250 1500 1750 2000 x axis 0 100 200 300 400 500 pixelcount Histogram of Binary Warped Image Left peak Right peak Figure 4: Peak Detection 3.3 Lane Mark Recognition 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Sliding Windows Lane Detection 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Lane Region Figure 5: Peak Detection 3
  • 4. The sliding window detection function begins tracing lanes in the binary images with series of left and right ”windows” moving upwards, show in Fig.5. The search windows start from the peaks detected in the histogram. If the pixels in a search window is beyond the threshold value, the window will be re-centered to the mean position. When the lane marked is dashed, it is possible no activated pixels in a search window. In this case, the window will make a guess based on the other lane lines and a lane mark width. Since the frames are continuous, the previous lane position can be used as a reference to improve the efficiency of the sliding windows detection. After the window sliding search, a list of left and right pixel locations are collected. Fit a quadratic equation to all the pixels by using polyfit function in NumPy. Detected lane can overlay on the original image by using the inverse matrix of the perspective transform to visualize the algorithm result Fig. 6. 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image with Detected Lane Overlay Figure 6: Lane Detection 4 Results 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image with Detected Lane Overlay 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image with Detected Lane Overlay 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image with Detected Lane Overlay 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image with Detected Lane Overlay 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image with Detected Lane Overlay 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image 0 250 500 750 1000 1250 1500 1750 0 200 400 600 800 1000 Original Image with Detected Lane Overlay Figure 7: Lane Detection Results The test results of the algorithm are shown in Fig. 7. The run time of processing single frame is 1.24 seconds. 4
  • 5. 5 Conclusion This project covers the color and gradient threshold, perspective transform and sliding win- dows to identify lane marks. The data set is chosen randomly with no camera specification. For the binary image of perspective transformation Fig.3, the lane marks are not exactly parallel. Generally, we calibrate the camera before applying the algorithm. This algorithm is surprisingly robust to detect the lane marks accurately without camera parameters. There are many improvements could be made to this project. In practice, the lane width may be changing over time where the lane marks may not appear on the bottom of the frame. Auto increasing search window width may help in this situation. Develop more flexible lane mark extraction method to produce better binary image under various lighting conditions. Apply other relevant computer vision techniques to reinforce the algorithm when noisy in the image increases. 5