SlideShare a Scribd company logo
1 of 6
The Parking Lot
Alessandro Florio - 161704
University of Trento
Department of Information Engineering and Computer Science
Master of Science in Computer Science
Abstract. In this report it will be explained how a surveillance video of
a parking can be analyzed by means of different Computer Vision tech-
niques in order to identify how many available parking lots there are.
In particular, we will show first how parking lots are identified by their
contour lines, and then how we find out whether they are empty or not.
Table of Contents
1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Frame analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 Preprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Rectangle detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Identification of parking lots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1 Polygon extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2 Parking lot emptiness check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1 Introduction
In this section we will briefly explain how the algorithm is structured, leaving to
the following sections a more detailed description of each main subpart.
The algorithm is structured into two distinct phases and has a period of NFRAMES
- set to 200 - frames. One phase consists in identifying the parking lots in a frame,
as it will be explained in section 2, for the first NFRAMES-1 frames. The second
phase, which occurs at the remaining frame of each period, consists in analyzing
the output of the first one in order to detect where exactly parking lots are and
whether they are free or busy, as it will be explained in section 3.
2 Frame analysis
This phase takes one frame from the video and analyzes it to find out where
parking lots are; we recall that this phase is repeated for NFRAMES-1 frames
before passing to the second one.
2.1 Preprocessing
First of all, the frame is converted into a gray-scale image; then the Canny edge
detector algorithm is run to detect the possible edges. Since the Canny algorithm
produces two edges for each parking contour line, we dilate the output and then
compute its skeleton.
Grayscale Canny Skeleton
Once edges have been detected, the following step consists into defining lines,
which successively are going to identify parking lots. For this purpose, a proba-
bilistic Hough transform is applied to the skeleton image.
Skeleton Lines
2.2 Rectangle detection
In order to be able to detect a parking lot, we started from the assumption that
this is - in the real world - a rectangle. In the provided video, instead, there is
an unavoidable distortion, in addition to a non-aligned perspective. Moreover,
only three out of the four borders are painted on the asphalt.
Therefore, in this case we identify a parking lot as a pseudo-horizontal line which
intersects two pseudo-vertical lines. We consider horizontal lines all those lines
for which the absolute value of their slope is smaller or equal than 1/2, and
vertical lines all the remaining ones.
The algorithm then runs this way: for every line, if it is a vertical line we loop on
all the horizontal lines and see whether they intersect1
; if they do intersect, the
intersection point and the other endpoint of the vertical line are saved. When
all lines have been tested for a horizontal line, points closer than 15 pixels are
merged and substituted by their average, because they were probably generated
by other noise lines intersecting the horizontal one. Finally, if for that horizontal
line four points were found (two intersections and the other two endpoints of
the two vertical lines), a quadrilateral polygon is drawn on a temporary binary
image; if the number of points is greater than four but is even, it is the case that
the same horizontal line is detected for two different parking lots: so points are
ordered by the x coordinate, and taken four at a time, by shifting of two points,
because two intermediate points belong both to the first and to the second park-
ing lot. Also in this case, the quadrilateral polygons are drawn on the temporary
binary image.
1
Actually, lines are elongated by 12 pixels on each side because - due to erosion or
to a non-optimal configuration of the Hough transform - they may be shorter than
how they should be.
When parking lots have been drawn for all horizontal lines, the image containing
all the parking lots of the frame is added - with a transparency proportional to
NFRAMES - to another external image, which will collect all the parking lots
of the NFRAMES-1 frames.
3 Identification of parking lots
This phase takes the image produced by the fist phase for the previous NFRAMES-
1 frames; we recall that this phase occurs every NFRAMES frames, while for
the other frames only the first one is run2
.
3.1 Polygon extraction
As it can be seen in the image above, the input image of this phase is an average
of the parking lots found during all the iterations of the first phase. This step was
needed because little light changes from frame to frame led to different results in
the preprocessing and line identification steps. Taking the average instead leads
to more robust results.
Since at each frame the found lots were drawn white on a black background and
with an adequate transparency, in order to find the areas which were mostly
identified as parking lots, we have to consider the brighter pixels, and this is
done by thresholding the image into a binary image. After an opening operation
aimed at eliminating possible overlaps, contours of the different parking lots are
found, and polygons are substituted by their convex hull.
2
When this phase runs, the frame doesn’t take part to the parking lot identification.
However, since NFRAMES is a great number, a single frame doesn’t influence that
much, and allows a faster computation during this phase.
Input Thresholding, opening, convex hull
3.2 Parking lot emptiness check
Since cars parked at the center of the parking, where almost no distortion in
the video occurs, do not occlude the parking lines, those lots can be identified
as available; therefore it is useful to check whether they are really available or
not. This is done by computing the histogram of all the hulls obtained above
(in the HSV color space, and considering only hue and saturation), and then
comparing the histogram of each found lot with all the other; if the correlation
with other lots is overall greater than 25%, it is marked as a free parking lot,
otherwise either is the parking lot busy or it is not a parking lot at all, but a
noise polygon.
Input RGB
HSV Output
Finally, all the parking lots that have been found to be available are drawn
on the frame of the video that is going to be shown in a window, and will be
drawn until this second phase is repeated in the next iterations.
4 Results
We have presented a system able to detect available parking lots by finding
their contour lines, and to check whether they are available by comparing their
histograms with the ones of other found lots.
However, since too many parameters - which had to be found out empirically - are
involved, the algorithm is not 100% precise. In particular, we register both false
negatives (when the contour lines of the parking lot are not correctly detected
or are occluded by cars parked in the near lot) and false positives (when the
histogram check is not as accurate as desired). In our implementation we had
to make a trade-off between false positive and false negatives; in our opinion it
was more important to have few false positives and more false negatives rather
than the opposite: it is better to think a parking is full and maybe there is some
space, rather than believing it is free and not finding an available parking lot!
In some cases also one line dividing two parking lots was not detected, and at
the end two lots were recognized as a single one.
Moreover, due to light changes, even if the situation remains the same, the first
phase of the program can provide different result, and consequently also the
second phase from one time to another.
By analizing the results of the algorithm on the entire video, we came out with
a precision of 93.7%, meaning that we could well spot out busy parking lots,
but a recall of 64.7%, which shows that many false negatives were found, due to
the comparison of the area inside the found polygons through histograms. The
parameters we have set are strong enough to avoid in most cases false positives,
but too strong to correctly recognize free parking lots.
5 Conclusion
The parking lot detector provided works well in optimal situations, but still has
some problem with noise in frames. A greater video quality may reduce artifacts
that lead to wrong interpretations. Also having a video where different scenarios
were shown could have made the algorithm more robust to other situations whose
patterns could not be taken into account.

More Related Content

Similar to Parking lot

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
 
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
 
License plate extraction of overspeeding vehicles
License plate extraction of overspeeding vehiclesLicense plate extraction of overspeeding vehicles
License plate extraction of overspeeding vehicleslambanaveen
 
16 channels velodyne versus planar lidars based perception system for large s...
16 channels velodyne versus planar lidars based perception system for large s...16 channels velodyne versus planar lidars based perception system for large s...
16 channels velodyne versus planar lidars based perception system for large s...Brett Johnson
 
16 channels Velodyne versus planar LiDARs based perception system for Large S...
16 channels Velodyne versus planar LiDARs based perception system for Large S...16 channels Velodyne versus planar LiDARs based perception system for Large S...
16 channels Velodyne versus planar LiDARs based perception system for Large S...Brett Johnson
 
Audio Equalization Using LMS Adaptive Filtering
Audio Equalization Using LMS Adaptive FilteringAudio Equalization Using LMS Adaptive Filtering
Audio Equalization Using LMS Adaptive FilteringBob Minnich
 
videoMotionTrackingPCA
videoMotionTrackingPCAvideoMotionTrackingPCA
videoMotionTrackingPCAKellen Betts
 
traffic jam detection using image processing
traffic jam detection using image processingtraffic jam detection using image processing
traffic jam detection using image processingMalika Alix
 
Motion estimation overview
Motion estimation overviewMotion estimation overview
Motion estimation overviewYoss Cohen
 
development-accurate-position
development-accurate-positiondevelopment-accurate-position
development-accurate-positionJames Petrie
 
Spot speed studies.ppt .mylan nejyar
Spot speed studies.ppt .mylan nejyarSpot speed studies.ppt .mylan nejyar
Spot speed studies.ppt .mylan nejyarMalika khalil
 
Object Tracking with Instance Matching and Online Learning
Object Tracking with Instance Matching and Online LearningObject Tracking with Instance Matching and Online Learning
Object Tracking with Instance Matching and Online LearningJui-Hsin (Larry) Lai
 
Real-Time Multiple License Plate Recognition System
Real-Time Multiple License Plate Recognition SystemReal-Time Multiple License Plate Recognition System
Real-Time Multiple License Plate Recognition SystemIJORCS
 
Vehicle Tracking Using Kalman Filter and Features
Vehicle Tracking Using Kalman Filter and FeaturesVehicle Tracking Using Kalman Filter and Features
Vehicle Tracking Using Kalman Filter and Featuressipij
 
EENG512FinalPresentation_DanielKuntz
EENG512FinalPresentation_DanielKuntzEENG512FinalPresentation_DanielKuntz
EENG512FinalPresentation_DanielKuntzDaniel K
 

Similar to Parking lot (20)

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 ...
 
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
 
License plate extraction of overspeeding vehicles
License plate extraction of overspeeding vehiclesLicense plate extraction of overspeeding vehicles
License plate extraction of overspeeding vehicles
 
16 channels velodyne versus planar lidars based perception system for large s...
16 channels velodyne versus planar lidars based perception system for large s...16 channels velodyne versus planar lidars based perception system for large s...
16 channels velodyne versus planar lidars based perception system for large s...
 
16 channels Velodyne versus planar LiDARs based perception system for Large S...
16 channels Velodyne versus planar LiDARs based perception system for Large S...16 channels Velodyne versus planar LiDARs based perception system for Large S...
16 channels Velodyne versus planar LiDARs based perception system for Large S...
 
Audio Equalization Using LMS Adaptive Filtering
Audio Equalization Using LMS Adaptive FilteringAudio Equalization Using LMS Adaptive Filtering
Audio Equalization Using LMS Adaptive Filtering
 
videoMotionTrackingPCA
videoMotionTrackingPCAvideoMotionTrackingPCA
videoMotionTrackingPCA
 
traffic jam detection using image processing
traffic jam detection using image processingtraffic jam detection using image processing
traffic jam detection using image processing
 
Motion estimation overview
Motion estimation overviewMotion estimation overview
Motion estimation overview
 
development-accurate-position
development-accurate-positiondevelopment-accurate-position
development-accurate-position
 
Spot speed studies.ppt .mylan nejyar
Spot speed studies.ppt .mylan nejyarSpot speed studies.ppt .mylan nejyar
Spot speed studies.ppt .mylan nejyar
 
Object Tracking with Instance Matching and Online Learning
Object Tracking with Instance Matching and Online LearningObject Tracking with Instance Matching and Online Learning
Object Tracking with Instance Matching and Online Learning
 
Report NIYANTRA
Report NIYANTRAReport NIYANTRA
Report NIYANTRA
 
Real-Time Multiple License Plate Recognition System
Real-Time Multiple License Plate Recognition SystemReal-Time Multiple License Plate Recognition System
Real-Time Multiple License Plate Recognition System
 
Eryk_Kulikowski_a4
Eryk_Kulikowski_a4Eryk_Kulikowski_a4
Eryk_Kulikowski_a4
 
Vehicle Tracking Using Kalman Filter and Features
Vehicle Tracking Using Kalman Filter and FeaturesVehicle Tracking Using Kalman Filter and Features
Vehicle Tracking Using Kalman Filter and Features
 
10. Calibration.pptx
10. Calibration.pptx10. Calibration.pptx
10. Calibration.pptx
 
EENG512FinalPresentation_DanielKuntz
EENG512FinalPresentation_DanielKuntzEENG512FinalPresentation_DanielKuntz
EENG512FinalPresentation_DanielKuntz
 
Tele com breger
Tele com bregerTele com breger
Tele com breger
 
Aris_Robotics
Aris_RoboticsAris_Robotics
Aris_Robotics
 

Recently uploaded

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

Parking lot

  • 1. The Parking Lot Alessandro Florio - 161704 University of Trento Department of Information Engineering and Computer Science Master of Science in Computer Science Abstract. In this report it will be explained how a surveillance video of a parking can be analyzed by means of different Computer Vision tech- niques in order to identify how many available parking lots there are. In particular, we will show first how parking lots are identified by their contour lines, and then how we find out whether they are empty or not.
  • 2. Table of Contents 1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Frame analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.1 Preprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.2 Rectangle detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 Identification of parking lots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.1 Polygon extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.2 Parking lot emptiness check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1 Introduction In this section we will briefly explain how the algorithm is structured, leaving to the following sections a more detailed description of each main subpart. The algorithm is structured into two distinct phases and has a period of NFRAMES - set to 200 - frames. One phase consists in identifying the parking lots in a frame, as it will be explained in section 2, for the first NFRAMES-1 frames. The second phase, which occurs at the remaining frame of each period, consists in analyzing the output of the first one in order to detect where exactly parking lots are and whether they are free or busy, as it will be explained in section 3. 2 Frame analysis This phase takes one frame from the video and analyzes it to find out where parking lots are; we recall that this phase is repeated for NFRAMES-1 frames before passing to the second one. 2.1 Preprocessing First of all, the frame is converted into a gray-scale image; then the Canny edge detector algorithm is run to detect the possible edges. Since the Canny algorithm produces two edges for each parking contour line, we dilate the output and then compute its skeleton. Grayscale Canny Skeleton
  • 3. Once edges have been detected, the following step consists into defining lines, which successively are going to identify parking lots. For this purpose, a proba- bilistic Hough transform is applied to the skeleton image. Skeleton Lines 2.2 Rectangle detection In order to be able to detect a parking lot, we started from the assumption that this is - in the real world - a rectangle. In the provided video, instead, there is an unavoidable distortion, in addition to a non-aligned perspective. Moreover, only three out of the four borders are painted on the asphalt. Therefore, in this case we identify a parking lot as a pseudo-horizontal line which intersects two pseudo-vertical lines. We consider horizontal lines all those lines for which the absolute value of their slope is smaller or equal than 1/2, and vertical lines all the remaining ones. The algorithm then runs this way: for every line, if it is a vertical line we loop on all the horizontal lines and see whether they intersect1 ; if they do intersect, the intersection point and the other endpoint of the vertical line are saved. When all lines have been tested for a horizontal line, points closer than 15 pixels are merged and substituted by their average, because they were probably generated by other noise lines intersecting the horizontal one. Finally, if for that horizontal line four points were found (two intersections and the other two endpoints of the two vertical lines), a quadrilateral polygon is drawn on a temporary binary image; if the number of points is greater than four but is even, it is the case that the same horizontal line is detected for two different parking lots: so points are ordered by the x coordinate, and taken four at a time, by shifting of two points, because two intermediate points belong both to the first and to the second park- ing lot. Also in this case, the quadrilateral polygons are drawn on the temporary binary image. 1 Actually, lines are elongated by 12 pixels on each side because - due to erosion or to a non-optimal configuration of the Hough transform - they may be shorter than how they should be.
  • 4. When parking lots have been drawn for all horizontal lines, the image containing all the parking lots of the frame is added - with a transparency proportional to NFRAMES - to another external image, which will collect all the parking lots of the NFRAMES-1 frames. 3 Identification of parking lots This phase takes the image produced by the fist phase for the previous NFRAMES- 1 frames; we recall that this phase occurs every NFRAMES frames, while for the other frames only the first one is run2 . 3.1 Polygon extraction As it can be seen in the image above, the input image of this phase is an average of the parking lots found during all the iterations of the first phase. This step was needed because little light changes from frame to frame led to different results in the preprocessing and line identification steps. Taking the average instead leads to more robust results. Since at each frame the found lots were drawn white on a black background and with an adequate transparency, in order to find the areas which were mostly identified as parking lots, we have to consider the brighter pixels, and this is done by thresholding the image into a binary image. After an opening operation aimed at eliminating possible overlaps, contours of the different parking lots are found, and polygons are substituted by their convex hull. 2 When this phase runs, the frame doesn’t take part to the parking lot identification. However, since NFRAMES is a great number, a single frame doesn’t influence that much, and allows a faster computation during this phase.
  • 5. Input Thresholding, opening, convex hull 3.2 Parking lot emptiness check Since cars parked at the center of the parking, where almost no distortion in the video occurs, do not occlude the parking lines, those lots can be identified as available; therefore it is useful to check whether they are really available or not. This is done by computing the histogram of all the hulls obtained above (in the HSV color space, and considering only hue and saturation), and then comparing the histogram of each found lot with all the other; if the correlation with other lots is overall greater than 25%, it is marked as a free parking lot, otherwise either is the parking lot busy or it is not a parking lot at all, but a noise polygon. Input RGB HSV Output
  • 6. Finally, all the parking lots that have been found to be available are drawn on the frame of the video that is going to be shown in a window, and will be drawn until this second phase is repeated in the next iterations. 4 Results We have presented a system able to detect available parking lots by finding their contour lines, and to check whether they are available by comparing their histograms with the ones of other found lots. However, since too many parameters - which had to be found out empirically - are involved, the algorithm is not 100% precise. In particular, we register both false negatives (when the contour lines of the parking lot are not correctly detected or are occluded by cars parked in the near lot) and false positives (when the histogram check is not as accurate as desired). In our implementation we had to make a trade-off between false positive and false negatives; in our opinion it was more important to have few false positives and more false negatives rather than the opposite: it is better to think a parking is full and maybe there is some space, rather than believing it is free and not finding an available parking lot! In some cases also one line dividing two parking lots was not detected, and at the end two lots were recognized as a single one. Moreover, due to light changes, even if the situation remains the same, the first phase of the program can provide different result, and consequently also the second phase from one time to another. By analizing the results of the algorithm on the entire video, we came out with a precision of 93.7%, meaning that we could well spot out busy parking lots, but a recall of 64.7%, which shows that many false negatives were found, due to the comparison of the area inside the found polygons through histograms. The parameters we have set are strong enough to avoid in most cases false positives, but too strong to correctly recognize free parking lots. 5 Conclusion The parking lot detector provided works well in optimal situations, but still has some problem with noise in frames. A greater video quality may reduce artifacts that lead to wrong interpretations. Also having a video where different scenarios were shown could have made the algorithm more robust to other situations whose patterns could not be taken into account.