SlideShare a Scribd company logo
1 of 24
Imagine a car which is capable of sensing the environment, navigating through the roads,
fulfilling the transportations capabilities without any human effort and input. This car is called
Autonomous cars or self-driving cars. Autonomous cars can analyse the surrounding with
camera, radar, lidar, GPS and navigational paths and can work accordingly with that data
without any human support. I think no one can disagree that in modern era, the self-driving
cars are the future technology that will be making a huge impact in the people lives. I think
everyone is familiar with Tesla, Google and others companies work in self -driving cars like
Tesla Model S whose Autopilot handles highway driving and many more. One of the main
tasks of Automated vehicles is increasing safety and reducing road accidents, and thus saving
lives. Apparently, among many complex and challenging tasks of automated vehicles is road
lane detection or road lane boundaries detection.
Fig.1: Self driving car.
In this paper we will implement a lane detection technique using OpenCV which is the open-
source library used for computer vision, machine learning and image processing. In this we
will implement lane detection technique Simple Lane Detection which detect straight.
What is Computer Vision?
Computer Vision is a field of Artificial Intelligence the trains machines to interpret and
understand the real-life world. Using techniques like cameras, videos and deep learning models
machines can accurately classify objects and identify them on their own and then makes
decisions considering the data they interpreted. Today computer vision is used for many
purposes like Image segmentation, object detection, Edge detection, Facial recognition, Pattern
detection etc.
Fig.2
Lane detection Implementation:
While driving any vehicle, lane lines are important component of indicating a traffic flow and
where should the vehicle drive. It is essential to remain in a single lane and to avoid crossing
lanes so that accidents don’t happen. Lane detection is a good starting point for building your
own self driving car in OpenCV and Python.
Simple Lane Detection:
Simple lane detection is lane detection technique which detects straight lane. We will be using
“Atom” text editor or “Sublime” whatever you like working with. The purpose of this is to
develop a program that can identify lane lines in a picture or a video. Here’s the structure of
our lane detection pipeline.
 Reading Images .
 Canny Edge Detection.
 Region of Interest.
 Hough Line detection..
 Line filtering and Averaging.
Step1: Importing the required libraries and reading the image.
When creating a image processing pipeline, we have to read the image that we have to use to
test our pipeline. In OpenCV the images are read by “cv2.imread” as shown below:
Output:
Fig.3: Image.
Step2: Appling edge detection on image.
The goal of edge detection is to identify the boundaries of objects within a image. With edge
detection we identify the sharp changes in intensity in adjacent pixels. As we know that image
contains pixels which have light intensity at some instance and its numeric value changes from
0 to 255.
Fig.4:Self driving car.
As you can see in the above image the outline of white pixels corresponds to the discontinuity
and brightness at the points and this helps us to identify the edges in our image, since edge is
identified by the difference in intensity values in adjacent pixels and wherever there is sharp
change in intensity that indicates strong gradient and by tracing out all these pixels, we obtain
the edges. In edge detection techniques first, we have to convert out RGB colorspace image to
Grayscale image.
Code:
Outputs:
Fig.5: Grayscale image.
Fig.6: Blurred grayscale image.
FIG.7: Canny edge detection image.
We used Gaussian Blur to smoothened our image and reduce all the unnecessary noise from
the image.
Step 3: Region of Interest.
In the previous step we identified the edges in images and now we will identify interested
lane line in the image.
Fig.8: Region of interest .
We will use matplotlib to get the dimensions of region of interest which is triangle and create
a completely black image and mask that image with the polygon of region of interest. The mask
we created will have same size as the canny edge detected image.
Fig.9: Masked image.
Now we will use this masked image to show the specific portion of the image. We will do this
by the concept of binary numbers, as we know numeric values of pixels ranges from 0 to 255
and each of these values can be represent in binary form so the binary form of 0 will be 0000
whereas the binary form of 255 will be 1111. So, in our masked image above the white coloured
polygon have 1111 binary intensity pixels whereas outside the polygon the black area has 0000
binary intensity pixels. Now we are going to apply mask on our canny image to ultimately
show the region of interest and we do this by applying the bitwise and operation between the
two images which occurs elements wise between two images. So going back to our two images,
the black region which have pixel intensity of 0000 binary value corresponding to the region
in the other image. The result will always be 0000 that means all the intensity in that region
will be zero and that region will be completely black. Now similarly the bitwise and operation
will occur between the white region of our mask and the corresponding pixels in image. The
white region has intensity of 1111 binary value so, bitwise and between 1111 and any other
binary value will give same binary value and there will be no effect.
Code:
Output:
Fig.10: Output.
Step4: Hough Line detection.
Now we will use Hough transform to detect the straight lines in the image and thus identify the
lane lines. We will be computing cv2.HoughLinesP() which will filter out the lines for us. We
will start by actually displaying these lines into our real image and we will do this by function
“def display_line”. It will take the image and detect the straight lines in our image. The output
of function will be:
Code:
Output:
Fig.11: Hough line detection.
Step5: Optimizing Hough line detection.
The lines that are currently displayed seems to be inconsistent but we need to have a consistent
straight line to be displayed on our image so for this we will start by averaging the slopes of
multiple lines passing through a point into a single line that traces both our lines getting into it.
After that we will remove lines that are outside a determined slope range and location. Now,
we will calculate the slope and intercept of each lines in a particular lane and then averaging
the slope and intercepts to produce one line.
Code:
Output:
Fig.12: Optimized Hough detected lines.
Step5: Adding previously detected lines to our original image.
We will do this by cv2. AddWeighted() and thus displaying our lane detected image.
Final output:
Fig:13:Lane detected image.
Step6: Finding lanes in Video.
In this step we will find lane in a video. For this all the process will be same as finding lane in
image. First, we will capture the video with cv2.VideoCapture() and then we will use read
function to decode every video frame and the each frame of video will show lines.
GitHub Link:
 https://github.com/dhruv20032000/Lane-Detection-self-driving-cars
References:
 https://docs.opencv.org/master/d6/d10/tutorial_py_houghlines.html
 https://www.sas.com/en_in/insights/analytics/computer-vision.html
 https://www.hackster.io/kemfic/simple-lane-detection-c3db2f
 https://ieeexplore.ieee.org/document/4580573
 https://www.vox.com/future-perfect/2020/2/14/21063487/self-
driving-cars-autonomous-vehicles-waymo-cruise-uber
 https://www.news24.com/wheels/WildOnWheels/see-innovative-or-
dangerous-the-case-for-self-driving-cars-20190227
 https://medium.com/dvt-engineering/narc-a-fault-detecting-solution-
1e68bf239d71

More Related Content

Similar to SMOKE DETECTION ALARM.docx

Road signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencvRoad signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencvMohdSalim34
 
Enhancing Security and Privacy Issue in Airport by Biometric based Iris Recog...
Enhancing Security and Privacy Issue in Airport by Biometric based Iris Recog...Enhancing Security and Privacy Issue in Airport by Biometric based Iris Recog...
Enhancing Security and Privacy Issue in Airport by Biometric based Iris Recog...idescitation
 
Gender Classification using SVM With Flask
Gender Classification using SVM With FlaskGender Classification using SVM With Flask
Gender Classification using SVM With FlaskAI Publications
 
Road signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencvRoad signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencvMohdSalim34
 
Advanced Lane Finding
Advanced Lane FindingAdvanced Lane Finding
Advanced Lane FindingBill Kromydas
 
Deblurring, Localization and Geometry Correction of 2D QR Bar Codes Using Ric...
Deblurring, Localization and Geometry Correction of 2D QR Bar Codes Using Ric...Deblurring, Localization and Geometry Correction of 2D QR Bar Codes Using Ric...
Deblurring, Localization and Geometry Correction of 2D QR Bar Codes Using Ric...IJERA Editor
 
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
 
Intelligent Parking Space Detection System Based on Image Segmentation
Intelligent Parking Space Detection System Based on Image SegmentationIntelligent Parking Space Detection System Based on Image Segmentation
Intelligent Parking Space Detection System Based on Image Segmentationijsrd.com
 
Writeup advanced lane_lines_project
Writeup advanced lane_lines_projectWriteup advanced lane_lines_project
Writeup advanced lane_lines_projectManish Jauhari
 
Obstacle detection using laser
Obstacle detection using laserObstacle detection using laser
Obstacle detection using laserRohith R
 
Driver drowsiness monitoring system using visual behaviour and machine learning
Driver drowsiness monitoring system using visual behaviour and machine learningDriver drowsiness monitoring system using visual behaviour and machine learning
Driver drowsiness monitoring system using visual behaviour and machine learningVenkat Projects
 
Data Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingData Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingDerek Kane
 
JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1Jonathan Westlake
 
Image processing
Image processingImage processing
Image processingkamal330
 

Similar to SMOKE DETECTION ALARM.docx (20)

Road signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencvRoad signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencv
 
Enhancing Security and Privacy Issue in Airport by Biometric based Iris Recog...
Enhancing Security and Privacy Issue in Airport by Biometric based Iris Recog...Enhancing Security and Privacy Issue in Airport by Biometric based Iris Recog...
Enhancing Security and Privacy Issue in Airport by Biometric based Iris Recog...
 
Gender Classification using SVM With Flask
Gender Classification using SVM With FlaskGender Classification using SVM With Flask
Gender Classification using SVM With Flask
 
Road signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencvRoad signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencv
 
Advanced Lane Finding
Advanced Lane FindingAdvanced Lane Finding
Advanced Lane Finding
 
Ijcatr04041016
Ijcatr04041016Ijcatr04041016
Ijcatr04041016
 
Self driving vehicle
Self driving vehicleSelf driving vehicle
Self driving vehicle
 
Deblurring, Localization and Geometry Correction of 2D QR Bar Codes Using Ric...
Deblurring, Localization and Geometry Correction of 2D QR Bar Codes Using Ric...Deblurring, Localization and Geometry Correction of 2D QR Bar Codes Using Ric...
Deblurring, Localization and Geometry Correction of 2D QR Bar Codes Using Ric...
 
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
 
Intelligent Parking Space Detection System Based on Image Segmentation
Intelligent Parking Space Detection System Based on Image SegmentationIntelligent Parking Space Detection System Based on Image Segmentation
Intelligent Parking Space Detection System Based on Image Segmentation
 
D0411026032
D0411026032D0411026032
D0411026032
 
Writeup advanced lane_lines_project
Writeup advanced lane_lines_projectWriteup advanced lane_lines_project
Writeup advanced lane_lines_project
 
Obstacle detection using laser
Obstacle detection using laserObstacle detection using laser
Obstacle detection using laser
 
B018110915
B018110915B018110915
B018110915
 
Driver drowsiness monitoring system using visual behaviour and machine learning
Driver drowsiness monitoring system using visual behaviour and machine learningDriver drowsiness monitoring system using visual behaviour and machine learning
Driver drowsiness monitoring system using visual behaviour and machine learning
 
Data Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingData Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image Processing
 
JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1
 
Image processing
Image processingImage processing
Image processing
 
Color Tracking Robot
Color Tracking RobotColor Tracking Robot
Color Tracking Robot
 
final paper
final paperfinal paper
final paper
 

Recently uploaded

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 

Recently uploaded (20)

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 

SMOKE DETECTION ALARM.docx

  • 1. Imagine a car which is capable of sensing the environment, navigating through the roads, fulfilling the transportations capabilities without any human effort and input. This car is called Autonomous cars or self-driving cars. Autonomous cars can analyse the surrounding with camera, radar, lidar, GPS and navigational paths and can work accordingly with that data without any human support. I think no one can disagree that in modern era, the self-driving cars are the future technology that will be making a huge impact in the people lives. I think everyone is familiar with Tesla, Google and others companies work in self -driving cars like Tesla Model S whose Autopilot handles highway driving and many more. One of the main tasks of Automated vehicles is increasing safety and reducing road accidents, and thus saving lives. Apparently, among many complex and challenging tasks of automated vehicles is road lane detection or road lane boundaries detection.
  • 2. Fig.1: Self driving car. In this paper we will implement a lane detection technique using OpenCV which is the open- source library used for computer vision, machine learning and image processing. In this we will implement lane detection technique Simple Lane Detection which detect straight. What is Computer Vision?
  • 3. Computer Vision is a field of Artificial Intelligence the trains machines to interpret and understand the real-life world. Using techniques like cameras, videos and deep learning models machines can accurately classify objects and identify them on their own and then makes decisions considering the data they interpreted. Today computer vision is used for many purposes like Image segmentation, object detection, Edge detection, Facial recognition, Pattern detection etc.
  • 4. Fig.2 Lane detection Implementation: While driving any vehicle, lane lines are important component of indicating a traffic flow and where should the vehicle drive. It is essential to remain in a single lane and to avoid crossing lanes so that accidents don’t happen. Lane detection is a good starting point for building your own self driving car in OpenCV and Python. Simple Lane Detection: Simple lane detection is lane detection technique which detects straight lane. We will be using “Atom” text editor or “Sublime” whatever you like working with. The purpose of this is to develop a program that can identify lane lines in a picture or a video. Here’s the structure of our lane detection pipeline.  Reading Images .  Canny Edge Detection.  Region of Interest.  Hough Line detection..  Line filtering and Averaging. Step1: Importing the required libraries and reading the image. When creating a image processing pipeline, we have to read the image that we have to use to test our pipeline. In OpenCV the images are read by “cv2.imread” as shown below:
  • 5. Output: Fig.3: Image. Step2: Appling edge detection on image.
  • 6. The goal of edge detection is to identify the boundaries of objects within a image. With edge detection we identify the sharp changes in intensity in adjacent pixels. As we know that image contains pixels which have light intensity at some instance and its numeric value changes from 0 to 255.
  • 8. As you can see in the above image the outline of white pixels corresponds to the discontinuity and brightness at the points and this helps us to identify the edges in our image, since edge is identified by the difference in intensity values in adjacent pixels and wherever there is sharp change in intensity that indicates strong gradient and by tracing out all these pixels, we obtain the edges. In edge detection techniques first, we have to convert out RGB colorspace image to Grayscale image. Code: Outputs:
  • 9. Fig.5: Grayscale image. Fig.6: Blurred grayscale image.
  • 10. FIG.7: Canny edge detection image. We used Gaussian Blur to smoothened our image and reduce all the unnecessary noise from the image. Step 3: Region of Interest. In the previous step we identified the edges in images and now we will identify interested lane line in the image.
  • 11. Fig.8: Region of interest . We will use matplotlib to get the dimensions of region of interest which is triangle and create a completely black image and mask that image with the polygon of region of interest. The mask we created will have same size as the canny edge detected image.
  • 12. Fig.9: Masked image. Now we will use this masked image to show the specific portion of the image. We will do this by the concept of binary numbers, as we know numeric values of pixels ranges from 0 to 255 and each of these values can be represent in binary form so the binary form of 0 will be 0000 whereas the binary form of 255 will be 1111. So, in our masked image above the white coloured polygon have 1111 binary intensity pixels whereas outside the polygon the black area has 0000 binary intensity pixels. Now we are going to apply mask on our canny image to ultimately show the region of interest and we do this by applying the bitwise and operation between the two images which occurs elements wise between two images. So going back to our two images, the black region which have pixel intensity of 0000 binary value corresponding to the region
  • 13. in the other image. The result will always be 0000 that means all the intensity in that region will be zero and that region will be completely black. Now similarly the bitwise and operation will occur between the white region of our mask and the corresponding pixels in image. The white region has intensity of 1111 binary value so, bitwise and between 1111 and any other binary value will give same binary value and there will be no effect. Code: Output:
  • 14. Fig.10: Output. Step4: Hough Line detection. Now we will use Hough transform to detect the straight lines in the image and thus identify the lane lines. We will be computing cv2.HoughLinesP() which will filter out the lines for us. We will start by actually displaying these lines into our real image and we will do this by function “def display_line”. It will take the image and detect the straight lines in our image. The output of function will be:
  • 16. Fig.11: Hough line detection. Step5: Optimizing Hough line detection. The lines that are currently displayed seems to be inconsistent but we need to have a consistent straight line to be displayed on our image so for this we will start by averaging the slopes of multiple lines passing through a point into a single line that traces both our lines getting into it. After that we will remove lines that are outside a determined slope range and location. Now,
  • 17. we will calculate the slope and intercept of each lines in a particular lane and then averaging the slope and intercepts to produce one line. Code:
  • 18.
  • 20. Fig.12: Optimized Hough detected lines. Step5: Adding previously detected lines to our original image. We will do this by cv2. AddWeighted() and thus displaying our lane detected image.
  • 22. Fig:13:Lane detected image. Step6: Finding lanes in Video.
  • 23. In this step we will find lane in a video. For this all the process will be same as finding lane in image. First, we will capture the video with cv2.VideoCapture() and then we will use read function to decode every video frame and the each frame of video will show lines. GitHub Link:  https://github.com/dhruv20032000/Lane-Detection-self-driving-cars References:
  • 24.  https://docs.opencv.org/master/d6/d10/tutorial_py_houghlines.html  https://www.sas.com/en_in/insights/analytics/computer-vision.html  https://www.hackster.io/kemfic/simple-lane-detection-c3db2f  https://ieeexplore.ieee.org/document/4580573  https://www.vox.com/future-perfect/2020/2/14/21063487/self- driving-cars-autonomous-vehicles-waymo-cruise-uber  https://www.news24.com/wheels/WildOnWheels/see-innovative-or- dangerous-the-case-for-self-driving-cars-20190227  https://medium.com/dvt-engineering/narc-a-fault-detecting-solution- 1e68bf239d71