1 Introduction

The Internet of things plays a big role in enhancing smart city services and making them smarter and more available [1]. The most recent of these services are those related to traffic problems, organizing streets, and reducing congestion [2]. Numerous developed countries are interested in saving time and reducing pollution because it corresponds to more comfort, well-being, and health for citizens [3]. Therefore, there have been many contributions and ideas in the field of traffic development, such as studying streets, crowding, building bridges, tunnels, and others [4, 5]. One effective way to improve traffic is to pay attention to the parking and organize its functionality [6].

One of the factors that contributes to congestion in and around the city is parking mismanagement. Many countries do not provide a lot of parking facilities. Usually, the number of car parking is not enough, and knowing the appropriate number of car parks required is a challenge [7]. Many cities provide multi-level parking in important places [8].

Finding rush hour parking, especially for late arrivals, can be a daunting task. This forces many vehicles to drive around in search of a parking space. This contributes to increased congestion and more traffic management complexities. Some statistics indicate that 37% of drivers spend more than 10 min searching for parking spaces in city centers during peak times. Moreover, 34% would resort to parking in illegal places, exposing themselves to violations and causing more complications and traffic problems [9, 10].

Despite allocating 31% of the central places for parking in some cities, many drivers reconsider their trips due to this problem. Smart car parking may be an effective solution to this problem, which can provide many advantages, the most important of which are [10,11,12]:

  • Saving time and effort;

  • Reducing traffic congestion;

  • Reducing environmental pollution;

  • Reducing fuel consumption costs;

  • Reducing the problems of parking in illegal places;

  • Providing additional economic and investment income;

  • Supporting the general trend towards mass transit;

  • Providing special places for people with special needs and supporting them.

1.1 Our contributions

In this paper we discuss how we can automate the car parking system. We call this the ‘Smart Parking System’ (SPS), which could also be termed as online parking. In the proposed framework, we shall demonstrate that the proposed system is immensely helpful in addressing and resolving traffic issues directly or indirectly. The SPS provides a smart parking framework coupled with an app to scan the parking facilities for the possible vacancies. A further discussion of Smart Parking will take place in next sections, where we will discuss how the car parking system can be automated and what the benefits are, and applications can be.

2 Literature reviews

Usually, the development of smart parking systems requires the integration of several basic components, which are: the infrastructure, the software system, data sensors for vacant positions, and finally, studying of parking and driver behavior. In addition, it requires the availability of many tasks, the most important of which are: directing drivers to vacant positions, organizing parking, the reservation process, dynamic pricing and the payment process, reporting, forecasting, and others [9, 13].

All of the above indicates that managing smart parking is not an easy thing, and therefore we find many different solutions that were previously presented in this area. In [9] the researchers presented a classification of solutions in the field of parking during the period of 2000 to 2016, in addition to presenting a general definition of the main tasks of developing smart car parks. Generally, these solutions can be classified into main categories according to the technology used, such as RFID, WSNs, GPS, Smart Phone Apps, and each category contains many different methods as well [14].

Authors in [15] have suggested relying on IoT by employing network sensors to read vacant positions and alert nearby vehicles via the Android app. Others use roadside sensors or lighting sensors to facilitate detection of parking conditions and thus increase revenues for those associated with specific wages. Research in [16] has used a different type of sensor that detects large metal objects with the suggestion of using batteries that last for long periods to save energy consumption in smart car parks. Traffic management, suggested in [17, 18], have relied on RFID to calculate the arrival and departure time quickly, but this is intended for specific people and vehicles equipped with RFID-TAG so that the gate can open automatically for them.

Authors in [19] used ultrasonic network sensors to track vacant places as well and display them to drivers within the system. It also presented the idea to use cameras for the same purpose of tracking vacant places. Researchers in [20] went further and used the camera to recognize faces, thus allocating parking spaces to specific people only, not to the public. Traffic management, discussed in [13], have relied on a software part only through a smartphone application based on the Crowd-Sensing concept so that the drivers themselves cooperate in the exchange of information about the state of the parking. To facilitate the previous process, [21] proposed relying on Connected Vehicles equipped with a GPS tracker.

Some other researches were concerned with issues of providing special places for people with needs, such as in [2], and others were concerned with the issue of calculating parking time and the payment process as in [22], who employed a QR code on automatic gates in order to calculate entry and exit times without the need for physical materials as in [23], which is based on the Park-Meter to calculate the parking time of the vehicles. Research in [24] suggested utilizing parking as charging stations for electric vehicles at the same time.

We note from the foregoing the great diversity of proposed solutions. To excel on these solutions, we propose a hybrid model based on the integration of several ideas, where cameras can be used to identify the vehicle through an automatic detection algorithm for the plate number, in addition to a software system to track the number of available parking spaces by managing the parking positions when a vehicle enters or exits. Finally, the system provides an application to pre-book parking by completing the payment process electronically while determining the exact location of the parking through the GPS service. All the above will provide more services and features for the proposed idea to prove its distinction from the previous ideas. The proposed system will be explained in detail in the next section.

3 Proposed method

Smart Parking provides a web-based application for booking a vehicle (usually a car) parking space prior to coming to the carpark. In this, only a car which has had a prior booking from a chosen starting time will be allowed to enter the carpark, within up to half an hour of the starting time. In other words, vehicle drivers or owners can make online bookings any time prior to arriving at the carpark and can be allowed to enter the parking complex up to half an hour before the starting entry time. The driver will depend on the map in the system to select a suitable parking space, while the driver can also use the map to reach their allocated parking spot or to find their car when leaving. The parking charge for the duration of the parking must be paid at the time of the online booking. While the car is in the parking complex, the duration may be extended online by making an advanced payment, subject to the availability of the space.

Smart Carparks feature automatic gates for vehicles to enter the carpark, as shown in Fig. 1. The main gate is an automatic gate which has a camera to capture the image of the registration number plate located at the front of the vehicle. The number plate captured by the camera is instantly processed, usually by the image processing to determine the booking details. Once the booking and payment are confirmed, the system allocates a parking slot for the vehicle, and assigns a gate number to enter from. Then the automatic gate opens and directs the vehicle to the assigned gate facilitating the vehicle to reach its parking slot, whose opening is controlled by the main entry gate. The system will record the vehicle registration number, arrival time, and date for record keeping purposes in the database.

Fig. 1
figure 1

Main hardware tools in SPS

When a car wants to exit the carpark, the previous steps of scanning and marking the registration plate number are repeated. If a vehicle overstays without an approved extension of time, the driver must pay a small fine in addition to the charge for the extended time stayed. The payment must be made online. Cancellations would be allowed up to before 1 h before entry without any charge, and with a charge within 1 h of the arrival time.

In some cases, the management may decide to station parking management personnel to oversee the operations of the Smart carpark to ensure it functions smoothly. In case a person has overstayed (beyond their booking time), they have to pay an extra fee at the exit gate. There can also me more than one main gate depending on the size and location of the carpark.

3.1 Algorithm for managing smart parking

In this part we describe the way this algorithm facilitates processing registration number plates at the main entry of the SPS. We have chosen to provide the main steps of the algorithm by means of Fig. 2.

Fig. 2
figure 2

Main steps for detecting vehicle’s number plate

3.1.1 Figure 2 explained

First the system will read the car’s plate as RGB, then it will convert it to Gray, and then to Binary (Black and White). Next, the crop process would be executed to the remaining characters and numbers, then any noise like lines would be removed. Afterwards, morphology filters would be applied to fill the holes in each residual object, each of which would be separated and resized to match the templates. Then a template’s objects would undergo comparison to find those which are quite similar to each other to complete the identification process to find the car’s plate number and match the same in the parking database.

3.1.2 Pseudo code of proposed algorithm

figure a

3.2 Online booking system

The online booking system is a web application that shows all vacant positions for parking by time and location in a specific area which has been selected by drivers. The driver has to enter the expected time for parking, and their vehicle’s number plate. Then the driver must pay online to confirm the booking (the price will be determined by the time, location, and duration). After payment, the status of the selected parking will be changed.

When the driver arrives at the location by using the available map in the system, the electronic gate will automatically check the eligibility for entry to the car park depending on the picture of car, by detecting the vehicle’s number plate and checking the database for the booking table. In some cases, when there is an issue in the image processing function for plate detection, the driver can enter the booking number at the gate, or just park in their booked position if there is no gate. Then, an employee who is responsible for verification will enter the car’s number plate in the system to check if there is booking, otherwise a violation will be registered against this car.

3.3 The main advantages of the proposed system are that it

  • System can be used in public parking or private parking.

  • Is easy to implement.

  • Avoids the physical search for parking in a crowded area during peak time.

  • Reduces traffic congestion and pollution.

  • Reduces the cost and energy usage compared to similar parking solutions

  • Supports allocating some spaces for drivers with disabilities.

  • Avoids violations and illegal parking.

  • Easy to use for drivers.

3.4 Disadvantages and limitations

  • There is no physical lock for public parking in the carpark.

  • Drivers’ behaviour would not be studied at this stage (may be in future work).

  • In the proposed detection algorithm, we put specific conditions where the cards should stop for number plates to be detected easily.

4 Implementation

To prove the effectiveness and capability of implementing the proposed SPS, we have developed the required software to support it. Firstly, we implemented the OCR algorithm to read vehicle number plates through MATLAB for the proposed smart parking, then converted this code after testing it to the DLL library to allow it to be used by a.Net Framework like Microsoft Visual Studio (ASP.net C#), which we used for implementing the web application to manage the booking and tracking functions.

The next steps show the testing result of the detection algorithm by MATLAB (Real Example), in addition to the final demo for the web application interface, which shows the report of entry and exit times in the SPS by date to the admin.

  1. a.

    Read image of the number plate (Fig. 3).

  2. b.

    Convert image to black and white (Fig. 4).

  3. c.

    Convert image to BW (Fig. 4).

  4. d.

    Crop image and cut just the English Part (Fig. 5).

  5. e.

    Apply morphology filters to process the image (Fig. 6).

  6. f.

    Take the white object from the last image as shown in Fig. 7.

  7. g.

    Compare each object with a dataset of templates and detect it as text, as in Fig. 8.

Fig. 3
figure 3

Reading number plate

Fig. 4
figure 4

Conversion of number plate to B&W image

Fig. 5
figure 5

Cropping image of the number plate

Fig. 6
figure 6

Process image by filtering

Fig. 7
figure 7

Process image by filtering

Fig. 8
figure 8

Detect the registration number

As a result of the above steps of the algorithm, in our example, we find the number of the vehicle to be 9826VXB, which will be returned as Text. Figures 9, 10, and 11 depict some real examples in MATLAB, in addition to the real interface in Fig. 12. These figures are drawn in Visual Studio.Net for the web application.

Fig. 9
figure 9

MATLAB interface of testing

Fig. 10
figure 10

Real example 1 on MATLAB

Fig. 11
figure 11

Real example two on MATLAB

Fig. 12
figure 12

Sample interface of web application system

5 Future research

For future works, we have to focus more on employing machine learning (ML) techniques and IoT to provide more effective solutions, ideas, and advantages [25, 26]. We will propose many new ideas, such as:

  • Utilizing the parking system to encourage companies and organizations to deal with the SPS, because that will greatly reduce expenses and provide a new method for attendance [27].

  • Enhancing the proposed idea to be suitable with smart schools and students being dropped off [28].

  • Applying ML algorithms to study the behaviour of drivers and interactions with parking, in addition to predicting when parking will become available [25].

  • Utilizing vehicles to be mobile sensors in the city and collecting much useful information for more sophisticated services [29].

  • Dealing with emergency cases like ambulance attendance, evacuations and relief functions [30].

  • Depending on the integration between Cloud and Fog computing in a Smart city for distributed management of parking as well as many other advantages [31, 32].

  • Finding new methods to preserve privacy and security of user data with smart parking systems, which is considered to be one of the most significant challenges [33,34,35].

6 Summary

This research seeks to contribute to reducing traffic congestion in major centers during peak times. This is achieved by presenting the idea of a smart parking system, based on automatic detection of the vehicle number plate, and providing a supporting web system in order to enable drivers to book in advance from anywhere and at any time before arriving at the intended parking location, eliminating the need for drivers to search for a carpark for a long time or being forced to park illegally. We predict that there will be many smart car parks in the city as this will provide many benefits mentioned during our research. In the upcoming work, we will focus on employing machine learning algorithms for processing stored data, analyzing parking behavior and drivers’ behavior, and thus, the number of possible reservations, expected exit times for drivers, and other important information in organizing traffic can be predicted, allowing us to move to a smarter environment. We will also pay more attention to the issue of privacy so that the reservation and tracking system assures complete privacy for users that cannot be hacked or exploited by malicious parties.