SlideShare a Scribd company logo
Bulletin of Electrical Engineering and Informatics
Vol. 10, No. 6, December 2021, pp. 3211~3219
ISSN: 2302-9285, DOI: 10.11591/eei.v10i6.3251 3211
Journal homepage: http://beei.org
Parking detection system using background subtraction and
HSV color segmentation
Awang Hendrianto Pratomo, Wilis Kaswidjanti, Alek Setiyo Nugroho, Shoffan Saifullah
Department of Informatics, Universitas Pembangunan Nasional Veteran Yogyakarta, Indonesia
Article Info ABSTRACT
Article history:
Received Aug 31, 2021
Revised Oct 31, 2021
Accepted Nov 2, 2021
Manual system vehicle parking makes finding vacant parking lots difficult, so
it has to check directly to the vacant space. If many people do parking, then
the time needed for it is very much or requires many people to handle it. This
research develops a real-time parking system to detect parking. The system is
designed using the HSV color segmentation method in determining the
background image. In addition, the detection process uses the background
subtraction method. Applying these two methods requires image
preprocessing using several methods such as grayscaling, blurring (low-pass
filter). In addition, it is followed by a thresholding and filtering process to get
the best image in the detection process. In the process, there is a determination
of the ROI to determine the focus area of the object identified as empty
parking. The parking detection process produces the best average accuracy of
95.76%. The minimum threshold value of 255 pixels is 0.4. This value is the
best value from 33 test data in several criteria, such as the time of capture,
composition and color of the vehicle, the shape of the shadow of the object’s
environment, and the intensity of light. This parking detection system can be
implemented in real-time to determine the position of an empty place.
Keywords:
Background subtraction
HSV
Image segmentation
Parking detection system
Smart parking
This is an open access article under the CC BY-SA license.
Corresponding Author:
Wilis Kaswidjanti
Department of Informatics
Universitas Pembangunan Nasional Veteran Yogyakarta
Jl Babarsari 2 Yogykarta, 55281, Indonesia
Email: wilisk@upnyk.ac.id
1. INTRODUCTION
Parking space is a facility that must be fulfilled [1] both in business, shopping, public places, and
institutions. Parking facilities play an essential role in supporting the progress of the place [2]. Thus, a well-
organized parking system makes it comfortable for motorists. Currently, many conventional parking systems
cause parking users to find it difficult to find empty parking spaces. The reason is due to the lack of
information on the parking lot. The extent of the parking area and the number of parked vehicles cause
parking users to have to circle the parking lot first to find an empty parking space. Thus, this system is
inefficient because it can take more time and cost [3]. On these problems, the research develops a real-time
parking detection system which will be developed into a smart parking system [4].
The smart parking system was developed for parking management and monitoring. The current
development uses a sensor-based and image-based approach [5]. Sensor-based monitoring uses infrared to
detect the availability of parking lots. This sensor requires a high cost to implement. In addition, the sensor
can only detect one parking lot, so it requires many sensors to detect several parking lots simultaneously.
Compared with image processing with computer vision, it can detect objects with a broader range than
infrared. This concept uses the camera as an input device to detect the object.
 ISSN: 2302-9285
Bulletin of Electr Eng & Inf, Vol. 10, No. 6, December 2021 : 3211 – 3219
3212
Based on the concept of computer vision in object detection, this method aims to visualize and
analyze images acquired from cameras using digital image processing techniques [6]. One of the acquisition
processes is using a closed-circuit television (CCTV) camera, which produces digital images in image
processing. The process of detecting the availability of parking lots with CCTV can be done with a marker
[7]. Markers are placed in parking lots, where the camera can detect signs that parking spaces are considered
vacant. The parking lot is considered occupied if the camera does not detect a marker. In the detection
process, bright enough light rays can bounce off the camera to detect the motif. This parking detection
process has been carried out using the canny detection method [8] and dilation [9]. Both methods are
implemented to determine the vacant parking lot [10]. However, the Canny edge detection method relies on
the parking lot boundary line, so the camera must be directed to get the image at the right angle. Meanwhile,
the dilation method still has errors in detecting parking spaces, especially when the parking lot is between
two parked cars.
Dependence detection on specific objects such as markers and parking dividing lines can be solved
using the background subtraction method [11]. The background subtraction method compares two camera-
captured images to detect and track vehicles in the parking area [12]. The background subtraction method is
susceptible to changes in light [13], [14]. So in the process, the method uses the concept of reduction by
sampling background images under certain conditions, such as morning, afternoon, evening, and night. The
background image sampling uses the image energy variable to get a background image that matches the
foreground. However, under certain conditions, the detection results are wrong. The detection error is caused
by the shadow of the object’s environment [15], which is detected as a vehicle. This condition causes the
accuracy to be less than optimal. The shadow effect can be corrected by recognizing the shadow condition of
the object from the foreground image [16], which selects the image background to increase accuracy.
Color image segmentation [17] is our proposal to improve image quality from shadow effects. This
method uses the hue, saturation, value (HSV) color of the shadow. HSV can segment images based on color
by utilizing the upper and lower values of the HSV value so that objects and backgrounds are separated and
can segment noisy color images. HSV accuracy is also better in segmenting color images than red, green, dan
blue (RGB), HSL, and L*A*B [18]. This study aims to provide a solution in real-time parking detection
using a combination of background subtraction HSV segmentation methods to determine the background
image.
In this article, there are four main sections. The first section describes the background, novelty of
the study, and objectives. Next, it presents the methods used in image processing-based parking detection in
the second part. The third part conveys the results and discussion of the process and system testing that has
been designed. Finally, the fifth section presents conclusions on the results obtained and their tests.
2. RESEARCH METHOD
This study uses quantitative methods by testing the effect of a variable in the study. In general, the
stages are shown in Figure 1. This study uses the concept of image processing to detect empty parking lots.
The methods used include searching for image background, preprocessing, background subtraction, and
filtering.
Figure 1. Steps of parking detection system on image processing
2.1. Datasets
The datasets of this study used images acquired by CCTV from the parking lot of the
Communication and Information Office of Gunungkidul Regency. The image has a background that contains
partial or full shadows. The shadow part of the image constantly changes due to changes in the direction of
Bulletin of Electr Eng & Inf ISSN: 2302-9285 
Parking detection system using background subtraction and HSV color … (Awang Hendrianto Pratomo)
3213
light hitting the object (e.g., buildings, trees, or other objects). In comparison, the full shadow has a similar
shape to the shadow. Based on direct observation, the shadow is due to the presence of sunlight blocked by
clouds. Therefore, we divide the images between 8.00-16.00 and are acquired once every 15 minutes. It aims
so that the image’s shape with a partial shadow does not have a shadow shape. However, this does not apply
to images with full shadows (shadow shapes resemble objects at any given time). The data were tested using
foreground image data with different capture times, vehicle composition and color, the shape of the object’s
environmental shadow, and different light intensities.
2.2. Search for candidate image background
The background image candidate search focuses on image processing to determine the candidate
background image dataset used based on the average number of pixels of 255 per image. The stages of
searching for candidate background images as:
a. Background image is an acquired image that contains two types of data, namely images with partial and
full shadows. The image data used are 20 image samples at each time frame.
b. The image is converted from an RGB image to an HSV image, with three elements: hue representing color,
saturation representing color intensity level, and value representing brightness level. The HSV method also
has an excellent ability to segment color images that have noise. HSV’s accuracy is better in segmenting
images based on color than RGB, HSL, and L*A*B [18]. HSV calculation can be done using (1).
𝐶𝑚𝑎𝑥 = max(𝑅, 𝐺, 𝐵) , 𝐶𝑚𝑖𝑛 = min⁡(𝑅, 𝐺, 𝐵)
(1)
𝐶 = 𝐶𝑚𝑎𝑥 − 𝐶𝑚𝑖𝑛
After the min and max values for each color are obtained, the values for each HSV element can be
calculated using (2). This calculation uses the reference of (1).
H =
{
60 (
𝐺 − 𝐵
𝐶
) , 𝑖𝑓⁡𝐶𝑚𝑎𝑥 = 𝑅
120 + 60 (
𝐵 − 𝑅
𝐶
) , 𝑖𝑓⁡𝐶𝑚𝑎𝑥 = 𝐺
240 + 60 (
𝑅 − 𝐺
𝐶
) , 𝑖𝑓⁡𝐶𝑚𝑎𝑥 = 𝐵
(2)
𝑆 = {
0, 𝐶𝑚𝑎𝑥 = 0
𝐶
𝐶𝑚𝑎𝑥
⁡, 𝐶𝑚𝑎𝑥 ≠ 0
𝑉 = 𝐶𝑚𝑎𝑥
c. HSV can segment color images by utilizing the upper and lower values of the HSV value to separate
objects from the background. This value can be calculated by trial and error and produces a lower value
(0, 0, 0) and an upper value (179, 255, 85).
d. Noise reduction uses the median filter method to reduce noise better than the same linear smoothing
model [19]. The following is the equation for the median filter equation.
𝑥 =
𝑛+1
2
(3)
e. After the median filter process, the next step is to find the number of pixels of 255 (white color) per
existing frame.
f. Find an average of 255 pixels for each image frame.
𝐴𝑣𝑒𝑟𝑎𝑔𝑒 =
𝑡𝑜𝑡𝑎𝑙⁡𝑜𝑓⁡255⁡𝑝𝑖𝑥𝑒𝑙⁡𝑒𝑣𝑒𝑟𝑦⁡𝑓𝑟𝑎𝑚𝑒
𝑡𝑜𝑡𝑎𝑙⁡𝑜𝑓⁡𝑓𝑟𝑎𝑚𝑒
(4)
g. The average result becomes a reference for finding candidate background images.
 ISSN: 2302-9285
Bulletin of Electr Eng & Inf, Vol. 10, No. 6, December 2021 : 3211 – 3219
3214
2.3. Preprocessing
Preprocessing is used to get the selected background image from the existing candidate background
image with the shadow condition closest to the foreground image (real-time) [20]. In addition, this process
aims to minimize shadow noise from the object’s environment. The preprocessing stages carried out in this
study include as:
a. The candidate background image and foreground image (real-time) are converted to the HSV color space,
then segmented by shadow color and filter median as in the previous step.
b. The stage of determining the background image uses the slightest 255-pixel difference between the
candidate background and foreground images.
c. The candidate background image that has the slightest 255-pixel difference becomes the selected
background image.
2.4. Background subtraction
The selected background image becomes a real-time reference for performing background subtraction
between the background and foreground images. The stages of background subtraction include as:
a. Grayscale is a digital image that has only one channel value per pixel. This value indicates the level of
color intensity ranging from black, gray, and white. This image in each pixel has a color from white to
black, where each pixel is represented by 8 bits. The grayscale process can be done using (5) [21], [22].
𝑌(𝑥,𝑦) = (0,229 × 𝑅) + (0,587 × 𝐺) + (0,114 × 𝐵) (5)
b. Blurring is a low-pass filter that takes an image with a smooth, intense gradation. High-intensity differences
are reduced or removed to reduce noise in an image. The blurring process itself aims to change the intensity
of the noise image to gray so that when the thresholding process is carried out, the noise image will be
reduced. The gaussian distribution equation can be seen in the following equation [23].
𝐺(𝑥, 𝑦) =⁡
1
2𝜋𝜎2 ⁡𝑒
−⁡
𝑥2+𝑦2
2𝜎2
𝐺(𝑥, 𝑦) =⁡
1
2𝜋𝜎2 ⁡𝑒
−⁡
𝑥2+𝑦2
2𝜎2
⁡ =⁡
1
𝜎√2𝜋
⁡𝑒
−⁡
𝑥2
2𝜎2 1
𝜎√2𝜋
⁡𝑒
−⁡
𝑦2
2𝜎2
= 𝐺(𝑥)𝐺(𝑦) (6)
c. Background subtraction is one method of the segmentation process that separates moving objects
(foreground) and background objects (background) [24]. Background subtraction has a vital role in
computer vision, one of which is monitoring systems. The role played in background subtraction is
knowing or distinguishing between the background and objects in an image. The following is the
background subtraction (7):
𝑅𝑘(𝑥, 𝑦) = |𝑓𝑘(𝑥, 𝑦) − 𝐵𝑘(𝑥, 𝑦)|
𝐷𝑘(𝑥, 𝑦) = {
255⁡, 𝑏𝑎𝑐𝑘𝑔𝑟𝑜𝑢𝑛𝑑⁡𝑅𝑘(𝑥, 𝑦) > 𝑇
0⁡, 𝑏𝑎𝑐𝑘𝑔𝑟𝑜𝑢𝑛𝑑⁡𝑅𝑘(𝑥, 𝑦) ≤ 𝑇
(7)
Background subtraction on the foreground image (real-time image) and the selected background image,
each of which has been blurred in the previous step. The purpose of segmentation [25] using background
subtraction is to obtain objects from the resulting difference between the foreground and the selected
background images. The results of background subtraction can be seen in Figure 2.
(a) (b) (c)
Figure 2. The results of background subtraction with, (a) foreground image, (b) background image, (c) difference
Bulletin of Electr Eng & Inf ISSN: 2302-9285 
Parking detection system using background subtraction and HSV color … (Awang Hendrianto Pratomo)
3215
d. Thresholding is used to filter the noise contained in an image. Thresholding is the process of converting a
grayscale image into a binary or black and white image so that it can be seen between the foreground and
background in an image, separating the pixel values according to a predetermined threshold. Thresholding
can be written as 8.
𝐺(𝑥,𝑦) = {
⁡𝑖𝑠⁡255⁡𝑖𝑓⁡𝐹(𝑥,𝑦)) > 𝑇
𝑖𝑠⁡0⁡𝑖𝑓⁡𝐹(𝑥,𝑦)) ≤ 𝑇
(8)
The following is the result of the background subtraction stage after the threshold is carried out, as
shown in Figure 3.
Figure 3. Sample of the results image of thresholding
2.5. Filtering
Filtering is a process to take or remove specific frequencies from an image [26]. At this stage, it is
done to reduce or minimize the existing noise. It was starting from doing blurring and thresholding again. It
was then continued with closing morphology and median filter.
a. The blurring is done again because the image produced in the previous stage is still too rough.
b. Threshold is done again to emphasize the results of blurring that is done.
c. The results of the background subtraction method show that there is still noise in the image results, then
to remove the noise, the researcher uses morphological operations with the opening method. The closing
morphology is the opposite of the opening morphology. In the closing morphology, dilation is carried out
first and then followed by erosion. Dilation enlarges the binary image by adding layers around the object,
while erosion is the opposite, reducing or eroding the object’s edges.
d. In the image of the closing morphological results, there is still noise in the form of object spots in the
image. Therefore, to reduce the noise, the researchers used the median filter method. The median filter
method takes a specific area of the image according to predetermined kernel size. The filtered image can
be seen in Figure 4.
Figure 4. Filtering result on the parking area
2.6. Detection and classification
The detection process is a process to get an object in the form of 255 pixels. The detection stages as:
a. Region of interest (ROI) works in coding differently in some regions of the digital image. The more
critical image area will have a better image quality than the surrounding area. Thus, ROI can be used to
limit the area of a vehicle. Therefore, a ROI formed a focus area for detecting pixel 255 in each parking
slot available in the parking lot. The following is an example of ROI, as shown in Figure 5.
b. The number of 255 pixels contained in each ROI is the result of the resulting detection.
 ISSN: 2302-9285
Bulletin of Electr Eng & Inf, Vol. 10, No. 6, December 2021 : 3211 – 3219
3216
Classification is carried out based on the minimum percentage of objects in the form of white pixels
(255) to the total pixels in each area. If an area has a pixel percentage of 255 less than the minimum
percentage limit, then the parking lot is considered empty. At the same time, an area with an object
percentage is more than the minimum limit, and then the parking lot is considered occupied or filled.
Figure 5. ROI
3. RESULTS AND DISCUSSION
The result of this research is the detection of empty parking spaces. The final result was tested to
determine the level of accuracy resulting from the background subtraction method and the hue saturation
value for parking detection. Accuracy testing is done by observing the detection of parking lots using the
method used with the actual data obtained. The test data consisted of 33 foreground images obtained from
random CCTV camera captures during sunny conditions from 8.00 to 16.00. The foreground image has
different characteristics from the time of image capture, the shape of the shadow contained in the image, the
intensity of light, and the composition and color of the vehicle parked in it (number and type of car).
The level of accuracy is calculated using the confusion matrix, namely by comparing the
classification results from parking detection results from the introduction of the system with the actual
parking slots. The classification uses a different minimum threshold value of 255 pixels to get the best
accuracy value. The minimum threshold value of 255 pixels used to classify the test data used is between 0 to
1, with a difference of 0.1.
The accuracy test with the confusion matrix has four terms to represent the results of the
classification process, namely true positive (TP), true negative (TN), false positive (FP), and false negative
(FN) [27]. The TP value is obtained if the number of parking slots filled with vehicles is detected correctly by
the system, and the TN value is obtained if the number of available (empty) parking slots is detected
correctly by the system. The FP value is obtained if the number of parking slots filled with vehicles is
detected incorrectly by the system. The FN value is obtained if the number of parking slots filled with
vehicles is detected incorrectly by the system. An available (empty) parking slot was detected incorrectly by
the system. An example of testing on one of the test data is shown in Figure 6 (a). The third test data has
contained in 12 parking slot images. Figure 6 is one of the test data used for this study. In the test image, the
coordinates of each existing parking slot are determined first. The coordinates of the parking slots are used as
a ROI after the image is processed. The image processing results are shown in Figure 6 (b), which is not yet
clear for the desired slot. So, this process needs to be transformed to get more apparent results.
(a) (b)
Figure 6. These figures are, (a) sample of the third testing data, (b) the result of image processing on the third
testing data
The transformation process uses a region of interest concept with a perspective transformation at a
predetermined coordinate point. The height of the perspective image in this study is 200 px, and the width is
120 px. The establishment of a region of interest aims to focus the detection process on a certain point. The
identification of ROI images based on these images is produced in Figure 7, starting from ROI 0 to ROI 9.
This ROI shows that each part is a reference for the empty parking detection process. ROI that detects 255
Bulletin of Electr Eng & Inf ISSN: 2302-9285 
Parking detection system using background subtraction and HSV color … (Awang Hendrianto Pratomo)
3217
pixels will be classified as a parking lot. The processed ROI has different threshold values and classifications
based on the calculation, as shown in Table 1. In Table 1, an example of the implementation of ROI from the
third image data processed with ten total ROI and the variation of the threshold value between 0 and 1 with a
difference of 0.1 shows different results.
Figure 7. Results of the region of interest
Table 1. The results of classification on the third testing data
ROI Pixel 255 Pixel ROI (Area) Value
Threshold
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
ROI 0 27096 32000 0.84675         ✓ ✓
ROI 1 24860 32000 0.776875        ✓ ✓ ✓
ROI 2 20781 32000 0.64940625       ✓ ✓ ✓ ✓
ROI 3 26730 32000 0.8353125         ✓ ✓
ROI 4 29555 32000 0.92359375          ✓
ROI 5 5669 32000 0.17715625  ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
ROI 6 714 32000 0.0223125 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
ROI 7 16234 32000 0.5073125      ✓ ✓ ✓ ✓ ✓
ROI 8 1883 32000 0.05884375 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
ROI 9 3800 32000 0.11875  ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Note: =parking slots filled; =parking slots available
The classification process was tested using the confusion matrix method. An example of accuracy
testing is shown in Figure 8. Figure 8 has three kinds of detection because it uses different thresholds. The
thresholds used are 0.1, 0.4, and 0.8. The the accuracy calculation of this experiment can be seen in Table 2.
Based on the tests in Table 2, the third test data with a threshold of 0.1 has an accuracy of 80%. This
first test has a value of FN=2 because there is an empty parking slot but identifies the presence of a vehicle. It
can be seen from the color of the red box, which identifies that the parking lot has been filled. Two empty slots
were boxed in red from the experiment, caused by the light covering/blocking the parking lot. Thud, the
following experiment is to increase the threshold value to 0.4; when this threshold is implemented, the accuracy
increases to 100%, where the condition of all parking slots is classified correctly.
(a) (b) (c)
Figure 8. Detection results on the third testing data using threshold, (a) 0.1, (b) 0.4, (c) 0.8
Table 2. The accuracy of testing data based on Figure 8
Figure
Threshold
Accuracy (%)
TP TN FP FN
9.(a) 6 2 0 2 80
9.(b) 6 4 0 0 100
9.(c) 3 4 3 0 70
In addition, the third test is to use a more significant threshold of 0.8. This experiment yielded an
accuracy of 70%. The test has a value of FP=3. This situation is because the parking slot is filled with
 ISSN: 2302-9285
Bulletin of Electr Eng & Inf, Vol. 10, No. 6, December 2021 : 3211 – 3219
3218
vehicles but is considered empty by the system. The slot that is considered empty is probably because the
detection of the image used shows that the object image is close to the background image. At the end of the
accuracy testing process, each threshold value in the overall test data is summed and averaged. These results
are used to obtain the maximum accuracy value. The average accuracy results for each test with various
threshold values are shown in Figure 9.
Figure 9. Detection results on the third testing data using threshold=0.1
Based on Figure 9, the average accuracy of all tested data is at a different minimum threshold value
of 255 pixels. The highest accuracy result is 95.76%, with a minimum threshold value of 0.4. At the same
time, the lowest accuracy is 30.06%, with a minimum threshold value of 1. The detection results can provide
the best accuracy for classifying empty parking slots.
4. CONCLUSION
The background subtraction method can be implemented in determining the image background. The
addition of the HSV segmentation method in determining the background provides the best detection results
with an average accuracy of 95.76%. This testing process is based on a minimum threshold value of 0.4 at
255 pixels. This threshold has the best resistance from 33 test data based on several factors: the time of
capture, vehicle composition and color, the shape of the object’s environmental shadow, and different light
intensities. However, the detection process is still very dependent on the position and angle of the CCTV
camera to the parking lot. This condition results in the possibility of errors still occurring at certain parking
positions. This error occurs because the system detects vehicles in the parking lot next to the detected object
is considered an incoming object, and objects other than vehicles contained in the parking lot are still
considered occupied parking lots. In the future, to improve this, it is necessary to apply a machine vision
method that detects objects according to the type of vehicle. It also needed to set the equipment of
image/video acquisition to obtain a specific object.
REFERENCES
[1] J. Ortega, J. Hamadneh, D. Esztergár-Kiss and J. Tóth, “Simulation of the Daily Activity Plans of Travelers Using
the Park-and-Ride System and Autonomous Vehicles: Work and Shopping Trip Purposes,” Applied Sciences, vol.
10, no. 8, p. 2912, April 2020, doi: 10.3390/app10082912.
[2] A. Sharma and R. B. Battula, “Smart City: Evolution and Fundamental Concepts,” in Security and Organization
within IoT and Smart Cities, CRC Press, 2020, pp. 19-40.
[3] K. I. M. Ata, A. C. Soh, A. J. Ishak, H. Jaafar and N. A. Khairuddin, “Smart Indoor Parking System Based on
Dijkstra’s Algorithm,” International Journal of Electrical Engineering and Applied Sciences, vol. 2, no. 1, pp. 13-
20, 2019.
[4] G. Ali et al., “IoT Based Smart Parking System Using Deep Long Short Memory Network,” Electronics, vol. 9, no.
10, p. 1696, October 2020, doi: 10.3390/electronics9101696.
[5] P. Jmsmg and H. Wickramarachchi, “CCTV Based Parking Occupancy Tracker Using Computer Vision,” in Proceedings of
the 11 Symposium on Applied Science, Business & Industrial Research, December 2019, pp. 18-24, [Online]. Available:
https://www.researchgate.net/publication/338001800_CCTV_Based_Parking_Occupancy_Tracker_Using_Computer_Vision.
[6] S. Shih and W. Tsai, "A Convenient Vision-Based System for Automatic Detection of Parking Spaces in Indoor
Parking Lots Using Wide-Angle Cameras," in IEEE Transactions on Vehicular Technology, vol. 63, no. 6, pp. 2521-
Bulletin of Electr Eng & Inf ISSN: 2302-9285 
Parking detection system using background subtraction and HSV color … (Awang Hendrianto Pratomo)
3219
2532, July 2014, doi: 10.1109/TVT.2013.2297331.
[7] K. B. Dsouza, S. Mohammed and Y. Hussain, "Smart parking-An integrated solution for an urban setting," 2017 2nd
International Conference for Convergence in Technology (I2CT), 2017, pp. 174-177, doi:
10.1109/I2CT.2017.8226115..
[8] A. Kanáliková and E. Bubeníková, "Parking system with image processing," 2019 IEEE 17th World Symposium on
Applied Machine Intelligence and Informatics (SAMI), 2019, pp. 281-286, doi: 10.1109/SAMI.2019.8782760..
[9] M. Noor and A. Shrivastava, "Automatic Parking Slot Occupancy Detection using Laplacian Operator and
Morphological Kernel Dilation," 2021 10th IEEE International Conference on Communication Systems and
Network Technologies (CSNT), 2021, pp. 825-831, doi: 10.1109/CSNT51715.2021.9509620.
[10] B. Kommey, E. O. Addo and A. S. Agbemenu, “A Smart Image Processing-based System for Parking Space
Vacancy Management,” International Journal of Computer Applications, vol. 182, no. 5, pp. 1-6, July 2018, doi:
10.5120/ijca2018917540.
[11] B. Garcia-Garcia, T. Bouwmans and A. J. R. Silva, “Background Subtraction in Real Applications: Challenges,
Current Models and Future Directions,” vol. 35, p. 100204, February 2020, doi: 10.1016/j.cosrev.2019.100204.
[Online]. Available: http://arxiv.org/abs/1901.03577.
[12] C. G. Postigo, J. Torres and J. M. Menéndez, “Vacant parking area estimation through background subtraction and
transience map analysis,” IET Intelligent Transport Systems, vol. 9, no. 9, pp. 835-841, November 2015, doi:
10.1049/iet-its.2014.0090.
[13] X. Lu, C. Xu, L. Wang and L. Teng, “Improved background subtraction method for detecting moving objects based
on GMM,” IEEJ Transactions on Electrical and Electronic Engineering, vol. 13, no. 11, pp. 1540-1550, November
2018, doi: 10.1002/tee.22718.
[14] Y. Zhang, W. Zheng, K. Leng and H. Li, “Background Subtraction Using an Adaptive Local Median Texture
Feature in Illumination Changes Urban Traffic Scenes,” IEEE Access, vol. 8, pp. 130367-130378, 2020, doi:
10.1109/ACCESS.2020.3009104.
[15] M. Wu, R. Chen and Y. Tong, “Shadow Elimination Algorithm Using Color and Texture Features,” Computational
intelligence and neuroscience, pp. 1-10, January 2020, doi: 10.1155/2020/2075781.
[16] S. M. Roy and A. Ghosh, "Foreground Segmentation Using Adaptive 3 Phase Background Model," in IEEE
Transactions on Intelligent Transportation Systems, vol. 21, no. 6, pp. 2287-2296, June 2020, doi:
10.1109/TITS.2019.2915568.
[17] S. Saifullah, “K-means Segmentation Based-on Lab Color Space for Embryo Egg Detection,” arXiv Prepr.
arXiv2103.02288, March 2021. [Online]. Available: http://arxiv.org/abs/2103.02288.
[18] J. Pardede, M. G. Husada, A. N. Hermana and S. A. Rumapea, “Fruit Ripeness Based on RGB, HSV, HSL, L*a*b*
Color Feature Using SVM,” in 2019 International Conference of Computer Science and Information Technology
(ICoSNIKOM), 2019, pp. 1-5, doi: 10.1109/ICoSNIKOM48755.2019.9111486.
[19] S. Suhas and C. R. Venugopal, "MRI image preprocessing and noise removal technique using linear and nonlinear
filters," 2017 International Conference on Electrical, Electronics, Communication, Computer, and Optimization
Techniques (ICEECCOT), 2017, pp. 1-4, doi: 10.1109/ICEECCOT.2017.8284595..
[20] P. Zheng, D. Qin, B. Han, L. Ma and T. M. Berhane, “Research on Feature Extraction Method of Indoor Visual
Positioning Image Based on Area Division of Foreground and Background,” ISPRS International Journal of Geo-
Information, vol. 10, no. 6, p. 402, Jun. 2021, doi: 10.3390/ijgi10060402.
[21] S. Saifullah, "Segmentation for embryonated Egg Images Detection using the K-Means Algorithm in Image
Processing," 2020 Fifth International Conference on Informatics and Computing (ICIC), 2020, pp. 1-7, doi:
10.1109/ICIC50835.2020.9288648.
[22] Sunardi, A. Yudhana and S. Saifullah, “Identity analysis of egg based on digital and thermal imaging: Image
processing and counting object concept,” International Journal of Electrical and Computer Engineering (IJECE),
vol. 7, no. 1, pp. 200-208, February 2017, doi: 10.11591/ijece.v7i1.pp200-208.
[23] P. Singhal, A. Verma and A. Garg, "A study in finding effectiveness of Gaussian blur filter over bilateral filter in
natural scenes for graph based image segmentation," 2017 4th International Conference on Advanced Computing
and Communication Systems (ICACCS), 2017, pp. 1-6, doi: 10.1109/ICACCS.2017.8014612.
[24] H. Wang and L. Shi, "Foreground model for background subtraction with blind updating," 2016 IEEE International
Conference on Signal and Image Processing (ICSIP), 2016, pp. 74-78, doi: 10.1109/SIPROCESS.2016.7888227.
[25] A. Yudhana, Sunardi and S. Saifullah, “Segmentation comparing eggs watermarking image and original image,”
Bulletin of Electrical Engineering and Informatics, vol. 6, no. 1, pp. 47-53, March 2017, doi: 10.11591/eei.v6i1.595.
[26] K. Han, Z. Wang and Z. Chen, "Fingerprint Image Enhancement Method based on Adaptive Median Filter," 2018
24th Asia-Pacific Conference on Communications (APCC), 2018, pp. 40-44, doi: 10.1109/APCC.2018.8633498..
[27] S. Saifullah, Y. Fauziah and A. S. Aribowo, “Comparison of Machine Learning for Sentiment Analysis in Detecting
Anxiety Based on Social Media Data,” arXiv preprint arXiv:2101.06353, January 2021. [Online]. Available:
http://arxiv.org/abs/2101.06353.

More Related Content

PDF
Paper 58 disparity-of_stereo_images_by_self_adaptive_algorithm
PDF
Detecting and Shadows in the HSV Color Space using Dynamic Thresholds
PDF
A Survey on Exemplar-Based Image Inpainting Techniques
PDF
Image in Painting Techniques: A survey
PDF
Kk3517971799
PDF
Visual Cryptography using Image Thresholding
PDF
Sign Language Recognition Using Image Processing For Mute People
PDF
A new approach of colour image encryption based on henon like chaotic map
Paper 58 disparity-of_stereo_images_by_self_adaptive_algorithm
Detecting and Shadows in the HSV Color Space using Dynamic Thresholds
A Survey on Exemplar-Based Image Inpainting Techniques
Image in Painting Techniques: A survey
Kk3517971799
Visual Cryptography using Image Thresholding
Sign Language Recognition Using Image Processing For Mute People
A new approach of colour image encryption based on henon like chaotic map

What's hot (20)

PDF
Region filling and object removal by exemplar based image inpainting
PDF
EFFECTIVE SEARCH OF COLOR-SPATIAL IMAGE USING SEMANTIC INDEXING
PDF
Image Inpainting
PDF
F1063337
PPT
Image inpainting
PDF
Goal location prediction based on deep learning using RGB-D camera
PDF
improving differently illuminant images with fuzzy membership based saturatio...
PDF
Image segmentation based on color
PDF
Vehicle detection using background subtraction and clustering algorithms
PDF
528 439-449
PDF
A Review on Image Inpainting to Restore Image
PDF
Comparative between global threshold and adaptative threshold concepts in ima...
PDF
Automated Surveillance System and Data Communication
PPTX
Ai big dataconference_volodymyr getmanskyi colorization distance measuring
PDF
Volodymyr Getmanskyi "Deep learning for satellite imagery colorization and di...
PDF
An enhanced fireworks algorithm to generate prime key for multiple users in f...
PPTX
Image Inpainting Using Deep Learning
PDF
Automatic License Plate Detection in Foggy Condition using Enhanced OTSU Tech...
PDF
Learning from Computer Simulation to Tackle Real-World Problems
PDF
“Person Re-Identification and Tracking at the Edge: Challenges and Techniques...
Region filling and object removal by exemplar based image inpainting
EFFECTIVE SEARCH OF COLOR-SPATIAL IMAGE USING SEMANTIC INDEXING
Image Inpainting
F1063337
Image inpainting
Goal location prediction based on deep learning using RGB-D camera
improving differently illuminant images with fuzzy membership based saturatio...
Image segmentation based on color
Vehicle detection using background subtraction and clustering algorithms
528 439-449
A Review on Image Inpainting to Restore Image
Comparative between global threshold and adaptative threshold concepts in ima...
Automated Surveillance System and Data Communication
Ai big dataconference_volodymyr getmanskyi colorization distance measuring
Volodymyr Getmanskyi "Deep learning for satellite imagery colorization and di...
An enhanced fireworks algorithm to generate prime key for multiple users in f...
Image Inpainting Using Deep Learning
Automatic License Plate Detection in Foggy Condition using Enhanced OTSU Tech...
Learning from Computer Simulation to Tackle Real-World Problems
“Person Re-Identification and Tracking at the Edge: Challenges and Techniques...
Ad

Similar to Parking detection system using background subtraction and HSV color segmentation (20)

PDF
Stereo matching based on absolute differences for multiple objects detection
PDF
Road crack detection using adaptive multi resolution thresholding techniques
PDF
Az33298300
PDF
Az33298300
PDF
Intelligent Parking Space Detection System Based on Image Segmentation
PDF
Reduced-reference Video Quality Metric Using Spatial Information in Salient R...
PDF
International Journal of Engineering Research and Development
PDF
Street Mark Detection Using Raspberry PI for Self-driving System
PDF
Automatism System Using Faster R-CNN and SVM
PDF
Traffic Light Detection and Recognition for Self Driving Cars using Deep Lear...
PDF
Ijetcas14 372
PDF
E011142632
PDF
Automatic Number Plate Recognition System A Histogram Based Approach
PDF
Design and implementation of video tracking system based on camera field of view
PDF
Advertisement billboard detection and geotagging system with inductive transf...
PDF
G04743943
PDF
Shadow Detection and Removal for Traffic Surveillance System
PDF
Real Time Object Detection And Recognization.pdf
PDF
Strategy for Foreground Movement Identification Adaptive to Background Variat...
PDF
Deep residual neural networks for inverse halftoning
Stereo matching based on absolute differences for multiple objects detection
Road crack detection using adaptive multi resolution thresholding techniques
Az33298300
Az33298300
Intelligent Parking Space Detection System Based on Image Segmentation
Reduced-reference Video Quality Metric Using Spatial Information in Salient R...
International Journal of Engineering Research and Development
Street Mark Detection Using Raspberry PI for Self-driving System
Automatism System Using Faster R-CNN and SVM
Traffic Light Detection and Recognition for Self Driving Cars using Deep Lear...
Ijetcas14 372
E011142632
Automatic Number Plate Recognition System A Histogram Based Approach
Design and implementation of video tracking system based on camera field of view
Advertisement billboard detection and geotagging system with inductive transf...
G04743943
Shadow Detection and Removal for Traffic Surveillance System
Real Time Object Detection And Recognization.pdf
Strategy for Foreground Movement Identification Adaptive to Background Variat...
Deep residual neural networks for inverse halftoning
Ad

More from journalBEEI (20)

PDF
Square transposition: an approach to the transposition process in block cipher
PDF
Hyper-parameter optimization of convolutional neural network based on particl...
PDF
Supervised machine learning based liver disease prediction approach with LASS...
PDF
A secure and energy saving protocol for wireless sensor networks
PDF
Plant leaf identification system using convolutional neural network
PDF
Customized moodle-based learning management system for socially disadvantaged...
PDF
Understanding the role of individual learner in adaptive and personalized e-l...
PDF
Prototype mobile contactless transaction system in traditional markets to sup...
PDF
Wireless HART stack using multiprocessor technique with laxity algorithm
PDF
Implementation of double-layer loaded on octagon microstrip yagi antenna
PDF
The calculation of the field of an antenna located near the human head
PDF
Exact secure outage probability performance of uplinkdownlink multiple access...
PDF
Design of a dual-band antenna for energy harvesting application
PDF
Transforming data-centric eXtensible markup language into relational database...
PDF
Key performance requirement of future next wireless networks (6G)
PDF
Noise resistance territorial intensity-based optical flow using inverse confi...
PDF
Modeling climate phenomenon with software grids analysis and display system i...
PDF
An approach of re-organizing input dataset to enhance the quality of emotion ...
PDF
Quality of service performances of video and voice transmission in universal ...
PDF
A multi-task learning based hybrid prediction algorithm for privacy preservin...
Square transposition: an approach to the transposition process in block cipher
Hyper-parameter optimization of convolutional neural network based on particl...
Supervised machine learning based liver disease prediction approach with LASS...
A secure and energy saving protocol for wireless sensor networks
Plant leaf identification system using convolutional neural network
Customized moodle-based learning management system for socially disadvantaged...
Understanding the role of individual learner in adaptive and personalized e-l...
Prototype mobile contactless transaction system in traditional markets to sup...
Wireless HART stack using multiprocessor technique with laxity algorithm
Implementation of double-layer loaded on octagon microstrip yagi antenna
The calculation of the field of an antenna located near the human head
Exact secure outage probability performance of uplinkdownlink multiple access...
Design of a dual-band antenna for energy harvesting application
Transforming data-centric eXtensible markup language into relational database...
Key performance requirement of future next wireless networks (6G)
Noise resistance territorial intensity-based optical flow using inverse confi...
Modeling climate phenomenon with software grids analysis and display system i...
An approach of re-organizing input dataset to enhance the quality of emotion ...
Quality of service performances of video and voice transmission in universal ...
A multi-task learning based hybrid prediction algorithm for privacy preservin...

Recently uploaded (20)

PPTX
Sustainable Sites - Green Building Construction
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Artificial Intelligence
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPT
Mechanical Engineering MATERIALS Selection
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
PPT on Performance Review to get promotions
PPTX
additive manufacturing of ss316l using mig welding
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Well-logging-methods_new................
PPTX
OOP with Java - Java Introduction (Basics)
PDF
737-MAX_SRG.pdf student reference guides
Sustainable Sites - Green Building Construction
UNIT 4 Total Quality Management .pptx
Artificial Intelligence
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
CH1 Production IntroductoryConcepts.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Mechanical Engineering MATERIALS Selection
UNIT-1 - COAL BASED THERMAL POWER PLANTS
III.4.1.2_The_Space_Environment.p pdffdf
R24 SURVEYING LAB MANUAL for civil enggi
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPT on Performance Review to get promotions
additive manufacturing of ss316l using mig welding
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Well-logging-methods_new................
OOP with Java - Java Introduction (Basics)
737-MAX_SRG.pdf student reference guides

Parking detection system using background subtraction and HSV color segmentation

  • 1. Bulletin of Electrical Engineering and Informatics Vol. 10, No. 6, December 2021, pp. 3211~3219 ISSN: 2302-9285, DOI: 10.11591/eei.v10i6.3251 3211 Journal homepage: http://beei.org Parking detection system using background subtraction and HSV color segmentation Awang Hendrianto Pratomo, Wilis Kaswidjanti, Alek Setiyo Nugroho, Shoffan Saifullah Department of Informatics, Universitas Pembangunan Nasional Veteran Yogyakarta, Indonesia Article Info ABSTRACT Article history: Received Aug 31, 2021 Revised Oct 31, 2021 Accepted Nov 2, 2021 Manual system vehicle parking makes finding vacant parking lots difficult, so it has to check directly to the vacant space. If many people do parking, then the time needed for it is very much or requires many people to handle it. This research develops a real-time parking system to detect parking. The system is designed using the HSV color segmentation method in determining the background image. In addition, the detection process uses the background subtraction method. Applying these two methods requires image preprocessing using several methods such as grayscaling, blurring (low-pass filter). In addition, it is followed by a thresholding and filtering process to get the best image in the detection process. In the process, there is a determination of the ROI to determine the focus area of the object identified as empty parking. The parking detection process produces the best average accuracy of 95.76%. The minimum threshold value of 255 pixels is 0.4. This value is the best value from 33 test data in several criteria, such as the time of capture, composition and color of the vehicle, the shape of the shadow of the object’s environment, and the intensity of light. This parking detection system can be implemented in real-time to determine the position of an empty place. Keywords: Background subtraction HSV Image segmentation Parking detection system Smart parking This is an open access article under the CC BY-SA license. Corresponding Author: Wilis Kaswidjanti Department of Informatics Universitas Pembangunan Nasional Veteran Yogyakarta Jl Babarsari 2 Yogykarta, 55281, Indonesia Email: [email protected] 1. INTRODUCTION Parking space is a facility that must be fulfilled [1] both in business, shopping, public places, and institutions. Parking facilities play an essential role in supporting the progress of the place [2]. Thus, a well- organized parking system makes it comfortable for motorists. Currently, many conventional parking systems cause parking users to find it difficult to find empty parking spaces. The reason is due to the lack of information on the parking lot. The extent of the parking area and the number of parked vehicles cause parking users to have to circle the parking lot first to find an empty parking space. Thus, this system is inefficient because it can take more time and cost [3]. On these problems, the research develops a real-time parking detection system which will be developed into a smart parking system [4]. The smart parking system was developed for parking management and monitoring. The current development uses a sensor-based and image-based approach [5]. Sensor-based monitoring uses infrared to detect the availability of parking lots. This sensor requires a high cost to implement. In addition, the sensor can only detect one parking lot, so it requires many sensors to detect several parking lots simultaneously. Compared with image processing with computer vision, it can detect objects with a broader range than infrared. This concept uses the camera as an input device to detect the object.
  • 2.  ISSN: 2302-9285 Bulletin of Electr Eng & Inf, Vol. 10, No. 6, December 2021 : 3211 – 3219 3212 Based on the concept of computer vision in object detection, this method aims to visualize and analyze images acquired from cameras using digital image processing techniques [6]. One of the acquisition processes is using a closed-circuit television (CCTV) camera, which produces digital images in image processing. The process of detecting the availability of parking lots with CCTV can be done with a marker [7]. Markers are placed in parking lots, where the camera can detect signs that parking spaces are considered vacant. The parking lot is considered occupied if the camera does not detect a marker. In the detection process, bright enough light rays can bounce off the camera to detect the motif. This parking detection process has been carried out using the canny detection method [8] and dilation [9]. Both methods are implemented to determine the vacant parking lot [10]. However, the Canny edge detection method relies on the parking lot boundary line, so the camera must be directed to get the image at the right angle. Meanwhile, the dilation method still has errors in detecting parking spaces, especially when the parking lot is between two parked cars. Dependence detection on specific objects such as markers and parking dividing lines can be solved using the background subtraction method [11]. The background subtraction method compares two camera- captured images to detect and track vehicles in the parking area [12]. The background subtraction method is susceptible to changes in light [13], [14]. So in the process, the method uses the concept of reduction by sampling background images under certain conditions, such as morning, afternoon, evening, and night. The background image sampling uses the image energy variable to get a background image that matches the foreground. However, under certain conditions, the detection results are wrong. The detection error is caused by the shadow of the object’s environment [15], which is detected as a vehicle. This condition causes the accuracy to be less than optimal. The shadow effect can be corrected by recognizing the shadow condition of the object from the foreground image [16], which selects the image background to increase accuracy. Color image segmentation [17] is our proposal to improve image quality from shadow effects. This method uses the hue, saturation, value (HSV) color of the shadow. HSV can segment images based on color by utilizing the upper and lower values of the HSV value so that objects and backgrounds are separated and can segment noisy color images. HSV accuracy is also better in segmenting color images than red, green, dan blue (RGB), HSL, and L*A*B [18]. This study aims to provide a solution in real-time parking detection using a combination of background subtraction HSV segmentation methods to determine the background image. In this article, there are four main sections. The first section describes the background, novelty of the study, and objectives. Next, it presents the methods used in image processing-based parking detection in the second part. The third part conveys the results and discussion of the process and system testing that has been designed. Finally, the fifth section presents conclusions on the results obtained and their tests. 2. RESEARCH METHOD This study uses quantitative methods by testing the effect of a variable in the study. In general, the stages are shown in Figure 1. This study uses the concept of image processing to detect empty parking lots. The methods used include searching for image background, preprocessing, background subtraction, and filtering. Figure 1. Steps of parking detection system on image processing 2.1. Datasets The datasets of this study used images acquired by CCTV from the parking lot of the Communication and Information Office of Gunungkidul Regency. The image has a background that contains partial or full shadows. The shadow part of the image constantly changes due to changes in the direction of
  • 3. Bulletin of Electr Eng & Inf ISSN: 2302-9285  Parking detection system using background subtraction and HSV color … (Awang Hendrianto Pratomo) 3213 light hitting the object (e.g., buildings, trees, or other objects). In comparison, the full shadow has a similar shape to the shadow. Based on direct observation, the shadow is due to the presence of sunlight blocked by clouds. Therefore, we divide the images between 8.00-16.00 and are acquired once every 15 minutes. It aims so that the image’s shape with a partial shadow does not have a shadow shape. However, this does not apply to images with full shadows (shadow shapes resemble objects at any given time). The data were tested using foreground image data with different capture times, vehicle composition and color, the shape of the object’s environmental shadow, and different light intensities. 2.2. Search for candidate image background The background image candidate search focuses on image processing to determine the candidate background image dataset used based on the average number of pixels of 255 per image. The stages of searching for candidate background images as: a. Background image is an acquired image that contains two types of data, namely images with partial and full shadows. The image data used are 20 image samples at each time frame. b. The image is converted from an RGB image to an HSV image, with three elements: hue representing color, saturation representing color intensity level, and value representing brightness level. The HSV method also has an excellent ability to segment color images that have noise. HSV’s accuracy is better in segmenting images based on color than RGB, HSL, and L*A*B [18]. HSV calculation can be done using (1). 𝐶𝑚𝑎𝑥 = max(𝑅, 𝐺, 𝐵) , 𝐶𝑚𝑖𝑛 = min⁡(𝑅, 𝐺, 𝐵) (1) 𝐶 = 𝐶𝑚𝑎𝑥 − 𝐶𝑚𝑖𝑛 After the min and max values for each color are obtained, the values for each HSV element can be calculated using (2). This calculation uses the reference of (1). H = { 60 ( 𝐺 − 𝐵 𝐶 ) , 𝑖𝑓⁡𝐶𝑚𝑎𝑥 = 𝑅 120 + 60 ( 𝐵 − 𝑅 𝐶 ) , 𝑖𝑓⁡𝐶𝑚𝑎𝑥 = 𝐺 240 + 60 ( 𝑅 − 𝐺 𝐶 ) , 𝑖𝑓⁡𝐶𝑚𝑎𝑥 = 𝐵 (2) 𝑆 = { 0, 𝐶𝑚𝑎𝑥 = 0 𝐶 𝐶𝑚𝑎𝑥 ⁡, 𝐶𝑚𝑎𝑥 ≠ 0 𝑉 = 𝐶𝑚𝑎𝑥 c. HSV can segment color images by utilizing the upper and lower values of the HSV value to separate objects from the background. This value can be calculated by trial and error and produces a lower value (0, 0, 0) and an upper value (179, 255, 85). d. Noise reduction uses the median filter method to reduce noise better than the same linear smoothing model [19]. The following is the equation for the median filter equation. 𝑥 = 𝑛+1 2 (3) e. After the median filter process, the next step is to find the number of pixels of 255 (white color) per existing frame. f. Find an average of 255 pixels for each image frame. 𝐴𝑣𝑒𝑟𝑎𝑔𝑒 = 𝑡𝑜𝑡𝑎𝑙⁡𝑜𝑓⁡255⁡𝑝𝑖𝑥𝑒𝑙⁡𝑒𝑣𝑒𝑟𝑦⁡𝑓𝑟𝑎𝑚𝑒 𝑡𝑜𝑡𝑎𝑙⁡𝑜𝑓⁡𝑓𝑟𝑎𝑚𝑒 (4) g. The average result becomes a reference for finding candidate background images.
  • 4.  ISSN: 2302-9285 Bulletin of Electr Eng & Inf, Vol. 10, No. 6, December 2021 : 3211 – 3219 3214 2.3. Preprocessing Preprocessing is used to get the selected background image from the existing candidate background image with the shadow condition closest to the foreground image (real-time) [20]. In addition, this process aims to minimize shadow noise from the object’s environment. The preprocessing stages carried out in this study include as: a. The candidate background image and foreground image (real-time) are converted to the HSV color space, then segmented by shadow color and filter median as in the previous step. b. The stage of determining the background image uses the slightest 255-pixel difference between the candidate background and foreground images. c. The candidate background image that has the slightest 255-pixel difference becomes the selected background image. 2.4. Background subtraction The selected background image becomes a real-time reference for performing background subtraction between the background and foreground images. The stages of background subtraction include as: a. Grayscale is a digital image that has only one channel value per pixel. This value indicates the level of color intensity ranging from black, gray, and white. This image in each pixel has a color from white to black, where each pixel is represented by 8 bits. The grayscale process can be done using (5) [21], [22]. 𝑌(𝑥,𝑦) = (0,229 × 𝑅) + (0,587 × 𝐺) + (0,114 × 𝐵) (5) b. Blurring is a low-pass filter that takes an image with a smooth, intense gradation. High-intensity differences are reduced or removed to reduce noise in an image. The blurring process itself aims to change the intensity of the noise image to gray so that when the thresholding process is carried out, the noise image will be reduced. The gaussian distribution equation can be seen in the following equation [23]. 𝐺(𝑥, 𝑦) =⁡ 1 2𝜋𝜎2 ⁡𝑒 −⁡ 𝑥2+𝑦2 2𝜎2 𝐺(𝑥, 𝑦) =⁡ 1 2𝜋𝜎2 ⁡𝑒 −⁡ 𝑥2+𝑦2 2𝜎2 ⁡ =⁡ 1 𝜎√2𝜋 ⁡𝑒 −⁡ 𝑥2 2𝜎2 1 𝜎√2𝜋 ⁡𝑒 −⁡ 𝑦2 2𝜎2 = 𝐺(𝑥)𝐺(𝑦) (6) c. Background subtraction is one method of the segmentation process that separates moving objects (foreground) and background objects (background) [24]. Background subtraction has a vital role in computer vision, one of which is monitoring systems. The role played in background subtraction is knowing or distinguishing between the background and objects in an image. The following is the background subtraction (7): 𝑅𝑘(𝑥, 𝑦) = |𝑓𝑘(𝑥, 𝑦) − 𝐵𝑘(𝑥, 𝑦)| 𝐷𝑘(𝑥, 𝑦) = { 255⁡, 𝑏𝑎𝑐𝑘𝑔𝑟𝑜𝑢𝑛𝑑⁡𝑅𝑘(𝑥, 𝑦) > 𝑇 0⁡, 𝑏𝑎𝑐𝑘𝑔𝑟𝑜𝑢𝑛𝑑⁡𝑅𝑘(𝑥, 𝑦) ≤ 𝑇 (7) Background subtraction on the foreground image (real-time image) and the selected background image, each of which has been blurred in the previous step. The purpose of segmentation [25] using background subtraction is to obtain objects from the resulting difference between the foreground and the selected background images. The results of background subtraction can be seen in Figure 2. (a) (b) (c) Figure 2. The results of background subtraction with, (a) foreground image, (b) background image, (c) difference
  • 5. Bulletin of Electr Eng & Inf ISSN: 2302-9285  Parking detection system using background subtraction and HSV color … (Awang Hendrianto Pratomo) 3215 d. Thresholding is used to filter the noise contained in an image. Thresholding is the process of converting a grayscale image into a binary or black and white image so that it can be seen between the foreground and background in an image, separating the pixel values according to a predetermined threshold. Thresholding can be written as 8. 𝐺(𝑥,𝑦) = { ⁡𝑖𝑠⁡255⁡𝑖𝑓⁡𝐹(𝑥,𝑦)) > 𝑇 𝑖𝑠⁡0⁡𝑖𝑓⁡𝐹(𝑥,𝑦)) ≤ 𝑇 (8) The following is the result of the background subtraction stage after the threshold is carried out, as shown in Figure 3. Figure 3. Sample of the results image of thresholding 2.5. Filtering Filtering is a process to take or remove specific frequencies from an image [26]. At this stage, it is done to reduce or minimize the existing noise. It was starting from doing blurring and thresholding again. It was then continued with closing morphology and median filter. a. The blurring is done again because the image produced in the previous stage is still too rough. b. Threshold is done again to emphasize the results of blurring that is done. c. The results of the background subtraction method show that there is still noise in the image results, then to remove the noise, the researcher uses morphological operations with the opening method. The closing morphology is the opposite of the opening morphology. In the closing morphology, dilation is carried out first and then followed by erosion. Dilation enlarges the binary image by adding layers around the object, while erosion is the opposite, reducing or eroding the object’s edges. d. In the image of the closing morphological results, there is still noise in the form of object spots in the image. Therefore, to reduce the noise, the researchers used the median filter method. The median filter method takes a specific area of the image according to predetermined kernel size. The filtered image can be seen in Figure 4. Figure 4. Filtering result on the parking area 2.6. Detection and classification The detection process is a process to get an object in the form of 255 pixels. The detection stages as: a. Region of interest (ROI) works in coding differently in some regions of the digital image. The more critical image area will have a better image quality than the surrounding area. Thus, ROI can be used to limit the area of a vehicle. Therefore, a ROI formed a focus area for detecting pixel 255 in each parking slot available in the parking lot. The following is an example of ROI, as shown in Figure 5. b. The number of 255 pixels contained in each ROI is the result of the resulting detection.
  • 6.  ISSN: 2302-9285 Bulletin of Electr Eng & Inf, Vol. 10, No. 6, December 2021 : 3211 – 3219 3216 Classification is carried out based on the minimum percentage of objects in the form of white pixels (255) to the total pixels in each area. If an area has a pixel percentage of 255 less than the minimum percentage limit, then the parking lot is considered empty. At the same time, an area with an object percentage is more than the minimum limit, and then the parking lot is considered occupied or filled. Figure 5. ROI 3. RESULTS AND DISCUSSION The result of this research is the detection of empty parking spaces. The final result was tested to determine the level of accuracy resulting from the background subtraction method and the hue saturation value for parking detection. Accuracy testing is done by observing the detection of parking lots using the method used with the actual data obtained. The test data consisted of 33 foreground images obtained from random CCTV camera captures during sunny conditions from 8.00 to 16.00. The foreground image has different characteristics from the time of image capture, the shape of the shadow contained in the image, the intensity of light, and the composition and color of the vehicle parked in it (number and type of car). The level of accuracy is calculated using the confusion matrix, namely by comparing the classification results from parking detection results from the introduction of the system with the actual parking slots. The classification uses a different minimum threshold value of 255 pixels to get the best accuracy value. The minimum threshold value of 255 pixels used to classify the test data used is between 0 to 1, with a difference of 0.1. The accuracy test with the confusion matrix has four terms to represent the results of the classification process, namely true positive (TP), true negative (TN), false positive (FP), and false negative (FN) [27]. The TP value is obtained if the number of parking slots filled with vehicles is detected correctly by the system, and the TN value is obtained if the number of available (empty) parking slots is detected correctly by the system. The FP value is obtained if the number of parking slots filled with vehicles is detected incorrectly by the system. The FN value is obtained if the number of parking slots filled with vehicles is detected incorrectly by the system. An available (empty) parking slot was detected incorrectly by the system. An example of testing on one of the test data is shown in Figure 6 (a). The third test data has contained in 12 parking slot images. Figure 6 is one of the test data used for this study. In the test image, the coordinates of each existing parking slot are determined first. The coordinates of the parking slots are used as a ROI after the image is processed. The image processing results are shown in Figure 6 (b), which is not yet clear for the desired slot. So, this process needs to be transformed to get more apparent results. (a) (b) Figure 6. These figures are, (a) sample of the third testing data, (b) the result of image processing on the third testing data The transformation process uses a region of interest concept with a perspective transformation at a predetermined coordinate point. The height of the perspective image in this study is 200 px, and the width is 120 px. The establishment of a region of interest aims to focus the detection process on a certain point. The identification of ROI images based on these images is produced in Figure 7, starting from ROI 0 to ROI 9. This ROI shows that each part is a reference for the empty parking detection process. ROI that detects 255
  • 7. Bulletin of Electr Eng & Inf ISSN: 2302-9285  Parking detection system using background subtraction and HSV color … (Awang Hendrianto Pratomo) 3217 pixels will be classified as a parking lot. The processed ROI has different threshold values and classifications based on the calculation, as shown in Table 1. In Table 1, an example of the implementation of ROI from the third image data processed with ten total ROI and the variation of the threshold value between 0 and 1 with a difference of 0.1 shows different results. Figure 7. Results of the region of interest Table 1. The results of classification on the third testing data ROI Pixel 255 Pixel ROI (Area) Value Threshold 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 ROI 0 27096 32000 0.84675         ✓ ✓ ROI 1 24860 32000 0.776875        ✓ ✓ ✓ ROI 2 20781 32000 0.64940625       ✓ ✓ ✓ ✓ ROI 3 26730 32000 0.8353125         ✓ ✓ ROI 4 29555 32000 0.92359375          ✓ ROI 5 5669 32000 0.17715625  ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ROI 6 714 32000 0.0223125 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ROI 7 16234 32000 0.5073125      ✓ ✓ ✓ ✓ ✓ ROI 8 1883 32000 0.05884375 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ROI 9 3800 32000 0.11875  ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Note: =parking slots filled; =parking slots available The classification process was tested using the confusion matrix method. An example of accuracy testing is shown in Figure 8. Figure 8 has three kinds of detection because it uses different thresholds. The thresholds used are 0.1, 0.4, and 0.8. The the accuracy calculation of this experiment can be seen in Table 2. Based on the tests in Table 2, the third test data with a threshold of 0.1 has an accuracy of 80%. This first test has a value of FN=2 because there is an empty parking slot but identifies the presence of a vehicle. It can be seen from the color of the red box, which identifies that the parking lot has been filled. Two empty slots were boxed in red from the experiment, caused by the light covering/blocking the parking lot. Thud, the following experiment is to increase the threshold value to 0.4; when this threshold is implemented, the accuracy increases to 100%, where the condition of all parking slots is classified correctly. (a) (b) (c) Figure 8. Detection results on the third testing data using threshold, (a) 0.1, (b) 0.4, (c) 0.8 Table 2. The accuracy of testing data based on Figure 8 Figure Threshold Accuracy (%) TP TN FP FN 9.(a) 6 2 0 2 80 9.(b) 6 4 0 0 100 9.(c) 3 4 3 0 70 In addition, the third test is to use a more significant threshold of 0.8. This experiment yielded an accuracy of 70%. The test has a value of FP=3. This situation is because the parking slot is filled with
  • 8.  ISSN: 2302-9285 Bulletin of Electr Eng & Inf, Vol. 10, No. 6, December 2021 : 3211 – 3219 3218 vehicles but is considered empty by the system. The slot that is considered empty is probably because the detection of the image used shows that the object image is close to the background image. At the end of the accuracy testing process, each threshold value in the overall test data is summed and averaged. These results are used to obtain the maximum accuracy value. The average accuracy results for each test with various threshold values are shown in Figure 9. Figure 9. Detection results on the third testing data using threshold=0.1 Based on Figure 9, the average accuracy of all tested data is at a different minimum threshold value of 255 pixels. The highest accuracy result is 95.76%, with a minimum threshold value of 0.4. At the same time, the lowest accuracy is 30.06%, with a minimum threshold value of 1. The detection results can provide the best accuracy for classifying empty parking slots. 4. CONCLUSION The background subtraction method can be implemented in determining the image background. The addition of the HSV segmentation method in determining the background provides the best detection results with an average accuracy of 95.76%. This testing process is based on a minimum threshold value of 0.4 at 255 pixels. This threshold has the best resistance from 33 test data based on several factors: the time of capture, vehicle composition and color, the shape of the object’s environmental shadow, and different light intensities. However, the detection process is still very dependent on the position and angle of the CCTV camera to the parking lot. This condition results in the possibility of errors still occurring at certain parking positions. This error occurs because the system detects vehicles in the parking lot next to the detected object is considered an incoming object, and objects other than vehicles contained in the parking lot are still considered occupied parking lots. In the future, to improve this, it is necessary to apply a machine vision method that detects objects according to the type of vehicle. It also needed to set the equipment of image/video acquisition to obtain a specific object. REFERENCES [1] J. Ortega, J. Hamadneh, D. Esztergár-Kiss and J. Tóth, “Simulation of the Daily Activity Plans of Travelers Using the Park-and-Ride System and Autonomous Vehicles: Work and Shopping Trip Purposes,” Applied Sciences, vol. 10, no. 8, p. 2912, April 2020, doi: 10.3390/app10082912. [2] A. Sharma and R. B. Battula, “Smart City: Evolution and Fundamental Concepts,” in Security and Organization within IoT and Smart Cities, CRC Press, 2020, pp. 19-40. [3] K. I. M. Ata, A. C. Soh, A. J. Ishak, H. Jaafar and N. A. Khairuddin, “Smart Indoor Parking System Based on Dijkstra’s Algorithm,” International Journal of Electrical Engineering and Applied Sciences, vol. 2, no. 1, pp. 13- 20, 2019. [4] G. Ali et al., “IoT Based Smart Parking System Using Deep Long Short Memory Network,” Electronics, vol. 9, no. 10, p. 1696, October 2020, doi: 10.3390/electronics9101696. [5] P. Jmsmg and H. Wickramarachchi, “CCTV Based Parking Occupancy Tracker Using Computer Vision,” in Proceedings of the 11 Symposium on Applied Science, Business & Industrial Research, December 2019, pp. 18-24, [Online]. Available: https://www.researchgate.net/publication/338001800_CCTV_Based_Parking_Occupancy_Tracker_Using_Computer_Vision. [6] S. Shih and W. Tsai, "A Convenient Vision-Based System for Automatic Detection of Parking Spaces in Indoor Parking Lots Using Wide-Angle Cameras," in IEEE Transactions on Vehicular Technology, vol. 63, no. 6, pp. 2521-
  • 9. Bulletin of Electr Eng & Inf ISSN: 2302-9285  Parking detection system using background subtraction and HSV color … (Awang Hendrianto Pratomo) 3219 2532, July 2014, doi: 10.1109/TVT.2013.2297331. [7] K. B. Dsouza, S. Mohammed and Y. Hussain, "Smart parking-An integrated solution for an urban setting," 2017 2nd International Conference for Convergence in Technology (I2CT), 2017, pp. 174-177, doi: 10.1109/I2CT.2017.8226115.. [8] A. Kanáliková and E. Bubeníková, "Parking system with image processing," 2019 IEEE 17th World Symposium on Applied Machine Intelligence and Informatics (SAMI), 2019, pp. 281-286, doi: 10.1109/SAMI.2019.8782760.. [9] M. Noor and A. Shrivastava, "Automatic Parking Slot Occupancy Detection using Laplacian Operator and Morphological Kernel Dilation," 2021 10th IEEE International Conference on Communication Systems and Network Technologies (CSNT), 2021, pp. 825-831, doi: 10.1109/CSNT51715.2021.9509620. [10] B. Kommey, E. O. Addo and A. S. Agbemenu, “A Smart Image Processing-based System for Parking Space Vacancy Management,” International Journal of Computer Applications, vol. 182, no. 5, pp. 1-6, July 2018, doi: 10.5120/ijca2018917540. [11] B. Garcia-Garcia, T. Bouwmans and A. J. R. Silva, “Background Subtraction in Real Applications: Challenges, Current Models and Future Directions,” vol. 35, p. 100204, February 2020, doi: 10.1016/j.cosrev.2019.100204. [Online]. Available: http://arxiv.org/abs/1901.03577. [12] C. G. Postigo, J. Torres and J. M. Menéndez, “Vacant parking area estimation through background subtraction and transience map analysis,” IET Intelligent Transport Systems, vol. 9, no. 9, pp. 835-841, November 2015, doi: 10.1049/iet-its.2014.0090. [13] X. Lu, C. Xu, L. Wang and L. Teng, “Improved background subtraction method for detecting moving objects based on GMM,” IEEJ Transactions on Electrical and Electronic Engineering, vol. 13, no. 11, pp. 1540-1550, November 2018, doi: 10.1002/tee.22718. [14] Y. Zhang, W. Zheng, K. Leng and H. Li, “Background Subtraction Using an Adaptive Local Median Texture Feature in Illumination Changes Urban Traffic Scenes,” IEEE Access, vol. 8, pp. 130367-130378, 2020, doi: 10.1109/ACCESS.2020.3009104. [15] M. Wu, R. Chen and Y. Tong, “Shadow Elimination Algorithm Using Color and Texture Features,” Computational intelligence and neuroscience, pp. 1-10, January 2020, doi: 10.1155/2020/2075781. [16] S. M. Roy and A. Ghosh, "Foreground Segmentation Using Adaptive 3 Phase Background Model," in IEEE Transactions on Intelligent Transportation Systems, vol. 21, no. 6, pp. 2287-2296, June 2020, doi: 10.1109/TITS.2019.2915568. [17] S. Saifullah, “K-means Segmentation Based-on Lab Color Space for Embryo Egg Detection,” arXiv Prepr. arXiv2103.02288, March 2021. [Online]. Available: http://arxiv.org/abs/2103.02288. [18] J. Pardede, M. G. Husada, A. N. Hermana and S. A. Rumapea, “Fruit Ripeness Based on RGB, HSV, HSL, L*a*b* Color Feature Using SVM,” in 2019 International Conference of Computer Science and Information Technology (ICoSNIKOM), 2019, pp. 1-5, doi: 10.1109/ICoSNIKOM48755.2019.9111486. [19] S. Suhas and C. R. Venugopal, "MRI image preprocessing and noise removal technique using linear and nonlinear filters," 2017 International Conference on Electrical, Electronics, Communication, Computer, and Optimization Techniques (ICEECCOT), 2017, pp. 1-4, doi: 10.1109/ICEECCOT.2017.8284595.. [20] P. Zheng, D. Qin, B. Han, L. Ma and T. M. Berhane, “Research on Feature Extraction Method of Indoor Visual Positioning Image Based on Area Division of Foreground and Background,” ISPRS International Journal of Geo- Information, vol. 10, no. 6, p. 402, Jun. 2021, doi: 10.3390/ijgi10060402. [21] S. Saifullah, "Segmentation for embryonated Egg Images Detection using the K-Means Algorithm in Image Processing," 2020 Fifth International Conference on Informatics and Computing (ICIC), 2020, pp. 1-7, doi: 10.1109/ICIC50835.2020.9288648. [22] Sunardi, A. Yudhana and S. Saifullah, “Identity analysis of egg based on digital and thermal imaging: Image processing and counting object concept,” International Journal of Electrical and Computer Engineering (IJECE), vol. 7, no. 1, pp. 200-208, February 2017, doi: 10.11591/ijece.v7i1.pp200-208. [23] P. Singhal, A. Verma and A. Garg, "A study in finding effectiveness of Gaussian blur filter over bilateral filter in natural scenes for graph based image segmentation," 2017 4th International Conference on Advanced Computing and Communication Systems (ICACCS), 2017, pp. 1-6, doi: 10.1109/ICACCS.2017.8014612. [24] H. Wang and L. Shi, "Foreground model for background subtraction with blind updating," 2016 IEEE International Conference on Signal and Image Processing (ICSIP), 2016, pp. 74-78, doi: 10.1109/SIPROCESS.2016.7888227. [25] A. Yudhana, Sunardi and S. Saifullah, “Segmentation comparing eggs watermarking image and original image,” Bulletin of Electrical Engineering and Informatics, vol. 6, no. 1, pp. 47-53, March 2017, doi: 10.11591/eei.v6i1.595. [26] K. Han, Z. Wang and Z. Chen, "Fingerprint Image Enhancement Method based on Adaptive Median Filter," 2018 24th Asia-Pacific Conference on Communications (APCC), 2018, pp. 40-44, doi: 10.1109/APCC.2018.8633498.. [27] S. Saifullah, Y. Fauziah and A. S. Aribowo, “Comparison of Machine Learning for Sentiment Analysis in Detecting Anxiety Based on Social Media Data,” arXiv preprint arXiv:2101.06353, January 2021. [Online]. Available: http://arxiv.org/abs/2101.06353.