651 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 monem.rahma@yahoo.com nabamaster85@ yahoo.com [ Abstract Detection moving car in front view is difficult operation because of the dynamic background due to the movement of moving car and the complex environment that surround the car, to solve that, this paper proposed new method based on linear equation to determine the region of interest by building more effective background model to deal with dynamic background scenes. This method exploited the permitted region between cars according to traffic law to determine the region (road) that in front the moving car which the moving cars move on. The experimental results show that the proposed method can define the region that represents the lane in front of moving car successfully with precision over 94%and detection rate 86% and FoM 90%. Keywords: dynamic background, background subtraction, self-driving car, background model 1. Introduction A or self-driving car or driverless car, it’s a robotic vehicle, operates moving car independently through feedback data returned from different types sensors. The objectives of these cars are reducing risks, problems, and cost that coming from human operation. One of AC major functions is detecting moving car in the front view based on computer vision technologies which help to make the decision for determining the path and avoid accidents [1]. Background modeling and subtraction is the most common detecting technique, while how correctly detecting moving objects is still a challenge [2] . Exploited the conventional methods of background modeling the temporal variation of each pixel to model the background and using change detection for foreground detection. The previous decade witnessed very useful background modeling publications. However, recently applications in the dynamic background like recordings are taken from mobile devices or internet videos need developments to detect moving objects in challenging environments. So that, to deal with a dynamic background in real scenes with effective methods are needed and may be used many different strategies like automatic feature selection, hierarchical models, or model selection. Using advanced models with low memory requirements is another feature of Abdul Monem S. Rahma Article history: Received 6 May 2018, Accepted 30 April 2019, Publish May 2019 Ibn Al Haitham Journal for Pure and Applied Science Journal homepage: http://jih.uobaghdad.edu.iq/index.php/j/index Modeling Dynamic Background based on Linear Equation Nabaa Basil Abd Department of Computer Science, University of Technology, Baghdad, Iraq. 10.30526/32.2.2122 :iDo file:///D:/عدد%202019/2019-5-20/حاسبات/monem.rahma@yahoo.com file:///D:/عدد%202019/2019-5-20/حاسبات/monem.rahma@yahoo.com file:///D:/عدد%202019/2019-5-20/حاسبات/نبا%20باسل%20ح%20عدد2%202019.docx file:///D:/عدد%202019/2019-5-20/حاسبات/نبا%20باسل%20ح%20عدد2%202019.docx 651 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 background modeling method. To meet these requirements, redesigned algorithms is necessary [3]. This study comprises the follows an overview of existing approaches of background models is presented. Section 3 describes the proposed method in detail, and then Section 4 provides the experimental results and comparison with other methods. Section 5 includes conclusions. 2. Background Modeling In computer vision applications, the moving object detection is critical operation. This process focuses on moving objects and insignificant information in the scene is ignored. Many approaches and methods and algorithms have been proposed to achieve that goal based on either a probabilistic or predictive mechanism [4-7]. In practical applications, for detecting foreground objects, background subtraction which removes a background image from the input is widely used, because it enables us without any prior knowledge to detect foreground objects [8]. Obtain a background image which doesn’t contain any moving object is the simplest method to model the background. A static background is not available in some environments, where the background changes dynamically because of the moving objects or the varying illumination. Therefore, representation model of the background must be adaptive and robust to address these challenges. As a result, over the last decade many background subtraction techniques have been designed and can be found Several surveys [9].[10]. Background modeling approaches construct a model of the background and then, comparing input image pixels with model pixels to classify them as BG or FG [11]. Many background modeling approaches have been proposed by many researchers for dealing with a dynamic background. Traditional background modeling can be classified as the following types: basic models, cluster models, statistical models, estimation models and neural network models [10].Recent background model can be classified the recent background models as the following types: fuzzy background model, advanced statistical background model, discriminative subspace learning model, sparse models, transform domain model and RPCA models. Recently, Combined foreground (FG) and background (BG) models have been described with temporal and spatial information for Background Subtraction. These models contain prior information about the FG in the BG modeling [11]. Hao et al., 2013,suggested a method originated from a combined spatiotemporal foreground and background modeling. Prior probabilities were estimated in order to adopt background changes in each video frame. Firstly, temporal and spatial information were acquired for background modeling by using of kernel density estimation (KDE).Secondly, using Gaussian formulation, to depict the spatial correlation between targets in motion to develop foreground model. Lastly, a fusion background frame was produced along with the proposal of updating rates [12]. Maddalena et al.2014, introduced an approach called (3dSOBS+) to detect moving object. The proposed approach was based on neural background model. Self-organizing method is used for generation of neural background model automatically. Firstly, build a neural background model which contains N images referred as layers and each layer consists of weight-vector for the corresponding pixel. Initialized neural background model by changing all model layers by estimated background model using temporal median method, and then each pixel of the current frame was compared to pixels of neural background model; if that pixel was close enough to estimated model in this case the pixel was estimated to be foreground pixel otherwise it was considered as background pixel. Finally, the model is updated in [13]. Rashid 651 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 and Thomas, 2016, proposed an approach for simultaneous non-parametric modeling of foreground and background, which was applied in a competitive manner for pixels classification as foreground or background. Selective updating of the foreground and background models was employed to harmonize changes in the background. In the model updating, both spatial and temporal dependencies of pixels were utilized [14]. Yizhong et al, 2017, proposed a nonparametric method for detection moving object, which contains both temporal and spatial features. The dynamic background was accurately detected by using the proposed method. Also, several mechanisms to maintain and update the background model were proposed. Background model was built by the first N1frames and sampling m times in (3×3) neighborhood region randomly. Spatiotemporal model represented dynamic background scenes well. On the other hand, a new update strategy made the background model it the dynamic background. Also, the proposed method could deal with ghost well [2]. 3. Proposed Method In Autonomous Car, one of the important functions is detecting a moving object in front of it, so that can avoid the collision and select its path. The front view scenes of the Autonomous Car are acquired by using camera placed inside AC along an axial line. The process of separating frames of a video sequence into moving object and background according to features referred to as object detection, to locate and identify objects. Because cars have different shapes, sizes, and colors, it has become difficult to depend on these features to detect cars. In addition, the car is moving and the background is dynamic, therefore the proposed method is appropriate identification to the portion of image that represents the street (the road) i.e. building a model that can detect the part that represents the street then the car can be detected after that. This section describes all steps of the new method for modeling the background by using the common form of a linear equation with two variables x and y to identify the region of interest, in other words, building a background model to predict the background region based on the linear equation and then separating the foreground objects. 3.1. Background Modeling Based on Linear Equation After the image pre-processing step is conduct3d, the image is converted to grayscale. Then using the proposed method to define the region of interest. The using of linear equation for background modeling and is as follow: 1- Selecting two points (i1, j1) and (i2, j2) on the gray image, these points are in one straightness line and perpendicular to the bottom of the image and near the bottom. 2- The form of linear equation is: (1) Applying the equation on these two points as follow: Compute x and y values to use in the equation: x: represents the distance from that point to the bottom of the image. (2) Where i the Height coordinate of the pixel (point). y: represents the averaging of intensity of that point with its eight's 651 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 neighbors by using window of 3x3. ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )+ ( ) (3) The resultant equations after computing x and y illustrated by Equation (4): (4) 3- Computing the value of a and b by solving Equations (4) using the substitution method for linear equations. 4- Repeating all previous steps with another two points P3 and P4 also, are on one straightness line and perpendicular to the bottom of the image and near the bottom of the image and exactly parallel to the previous two points. 5- In this case there are two values for a and b, by computing the average of a values and average of b values, these averaging values can be used to calculate the expecting pixels intensity by using Equation (5), ̅ ̅ ̅ (5) Where represents the expecting pixel intensity, ̅ and ̅ are the averaging values from previous step, and ̅ value computed by Equation (2). Figure 1. shows the representation of background modeling method. 3.2. Applying Subtraction Operation This step has done by subtracting each pixel of grayscale image or frame from the expected value of the same pixel which is supplied by Equation (5). Equation (6) shows the subtraction operation. ( ) | ( ) ( )| (6) then, Binary image is obtained by setting the threshold Th, (converting the image to black and white) as in Equation (7). ( ) { ( ) } (7) Where, ( ) binary image result from Background subtraction operation after applying threshold. 3.3. Post Processing The output of background modeling phase contains many noises because of surrounding environment changes or illumination changes, using filter can improving the result and remove noise, then can use some processes to extract moving car. 611 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 Algorithm1: Background modeling based on linear equation. Input: Grayscale image I. Output: Binary image (B). Step 1: Read Grayscale image (I) and selecting two points in one straightness line and perpendicular to the bottom of the image (I) and near the bottom. P1 ( , ); P2 ( , ); Width ← I.width; Height ← I.height; Step 2: Applying Equation (1) on these two points. Step 2.1: Compute x by applying Equation (2): ← Height – ; ← Height – ; Step 2.2: Compute y by applying Equation (3) by define window of 3x3 for each point of its’ eight neighbors: ← of P1( , ) with its eight neighbors ← of P2( , ) with its eight neighbors The resultant two equations after computing x and y are: Step 3: Computing the value of and by solving the two equations above using the substitution method for linear equations. Step 4: Repeating Step1, Step2 and Step3 with another two points P3 and P4. The resultant two equations after computing x and y for the new points are: Computing the value of and by solving the two equations by using the substitution method for linear equations. Step 5: Computing the average of a values and average of b values: 616 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 av← + /2 bv← + /2 Step 6: Calculate the expecting pixels intensity by using Equation (5). ̅ Step 7: Applying subtraction operation: For i←0 to Height Loop For j←0 to Width Loop ( ) | ( ) ( )| If ( )<= Th ( )←1 Else ( )←0 End if End for End for End. Figure 1. Illustrating representation of Background modeling. 611 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 4. Result and Discussion The new method was implemented using Visual Studio 2015 with C# programming language. This method has been tested using empty streets to make sure that it is defined the region that represents the road. Two tests have been used, the first one was used (40) single images and the second was used video length 20 sec. frame rate (30 fps). Table 1. illustrates the result of the first test for 6 single images and Table 2. illustrates the result of the second test for 4 frames of the sequenced images. In order to evaluate the performance and measure the robustness of the present method, the following performance matrices are used which depending on following parameters, True Positive (TP), False Positive (FP), and False Negative (FN). 1- Detection Rate (DR) also called Recall: defined by (8) measures the predicted true positive (TP) percentage as compared to the total number of actual positives. Recall =TP/(TP+ FN) (8) 2- Precision: provide by (9) measures the correct detection percentage as compared to the total number of detections as positives. Precision= TP/(TP + FP) (9) 3- Figure of Merit (FoM): it’s a better performance evaluation defined by (10). It is weighted harmonic mean measured jointly with Precision and Recall FoM= (2x Recall x Precision)/(Recall+ Precision) (10) Table 1. Results of evaluation the proposed method. Samples Recall Precision FoM 40 single images 0.825 0.942 0.879 Video frames 0.9 0.947 0.922 Total 0.862 0.944 0.90 Table 2. shows the results of evaluating the proposed method based on recall, precision and FoM metrics to first and second testing samples. Table 2. The result of test single images. No. Original Grayscale After modeling 1 2 611 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 3 4 5 6 Table 3. The results of second test on video frames. fram e No. Original image Grayscale After modeling 30 104 611 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 184 520 Table 2 and 3, show the result of the testing for single image and sequenced images respectively, where the second column is the original images and the third column is the images after converting to the Grayscale and forth column is the output of the proposed method. Table 4. Comparison in the performance of the proposed method with other approaches. Methods Precision Recall FoM Spatiotemporal model [2]. 0.87 0.72 0.79 ST-KDE [12]. 0.95 0.84 0.89 Background Foreground Competitive Model [14]. 0.78 0.66 0.71 Proposed method 0.94 0.86 0.90 Table 4, shows the comparison in performance of the proposed method with other approaches based on (Precision, Recall, FoM) matrices. The result show that the proposed method has value in FoM higher than other methods, which means the proposed method robust than other method. 5. Conclusions In this study, a new method has been proposed for detecting the dynamic background of the moving car in the scene ahead of the autonomous car. The proposed method exploited the traffic law and used the permitted region between the cars according to that law. This method based on linear equation with two variables to detect the part that represents the dynamic region (road) in front of the car. The method was tested and the results show the ability of the method on detecting the dynamic background which represents the road and the complex environment was removed and it became easy to detect the moving car. 615 Ibn Al-Haitham Jour. for Pure & Appl. Sci. 32 (2) 2019 References 1. Rahma, A.M.S.; Abd, N.B. Detection of a Moving Car Based on Invariant Moments. Journal of Computer Science. Science Publication. 2018, 14, 10-316,doi: 10.3844/jcssp.2018.310.316. 2. Yizhong, Y.; Qiang, Z.; Pengfei, W.; Xionglou, H.; Nengju, W. Moving Object Detection for Dynamic Background Scenes Based on Spatiotemporal Model. Advances in Multimedia.2017, 2017, 1-9. 3. Bouwmans, T.; Gonzàlez, J.; Shan, C.; Piccardi, M.; Davis, L. Special issue on background modeling for foreground detection in real-world dynamic scenes. Machine Vision and Applications.2014, 25, 1101-1103. 4. Tawfiq, L.N.M.; Jabber, A.K. New Transform Fundamental Properties and its Applications. Ibn Al-Haitham Journal for Pure and Applied Science. 2018, 31, 1,151-163, doi: http://dx.doi.org/10.30526/31.2.1954 5. Wang, S.C.; Su, T.F.; Lai, S.H. Detecting moving objects from dynamic background with shadow removal. IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP).2011,5946556,925 – 928, doi:10.1109/ICASSP.2011,5946556. 6. Mansour, H.; Vetro, A. Video background subtraction using semi-supervised robust matrix completion. IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP).2014, 14447992, 6528 – 6532, doi:10.1109/ICASSP.2014.6854862. 7. Tawfiq, L. N.M.; Hussein, W. R. Design Suitable Neural Network for Processing Face Recognition. Global Journal of Engineering Science and Researches.2016, 3, 3, 58-64. 8. Yoshinaga, S.; Shimada, A.; Nagahara, H.; Taniguchi, R. Object detection based on spatiotemporal background models. Computer Vision and Image Understanding. Elsevier Inc.2014, 122, 84-91,doi://doi.org/10.1016/j.cviu.2013.10.015. 9. Bouwmans, T.; Porikli, F.; Hörferlin, B.; Vacavant, A. Background modeling and Foreground Detection for Video Surveillance,CRC Press, Taylor and Francis Group. 2014.ISBN -13: 978-1-4822-0538-1. 10. Bouwmans, T. Traditional and recent approaches in background modeling for foreground detection: An overview. Computer Science Review. Elsevier Inc.2014, 11–12, 31-6, doi: doi.org/10.1016/j.cosrev.2014.04.001. 11. Sajid, H.; Cheung, Sen-ching, S.; Jacobs, N. Appearance based Background Subtraction for PTZ Cameras. Signal Processing: Image Communication. Elsevier Inc.2016, 47, 417- 425, doi://doi.org/10.1016/j.image.2016.07.008. 12. Tawfiq, L.N.M.; Hussein, R.W. Efficient Semi-Analytic Technique for Solving Nonlinear Singular Initial Value Problems. Ibn Al-Haitham Journal for Pure & Applied Sciences.2014, 27, 3, 513-522. 13. Tawfiq, L.N.M. Using collocation neural network to solve Eigenvalue problems. MJ Journal on Applied Mathematics.2016, 1, 1, 1-8. 14. Rashid, M.E.; Thomas, V. A Background Foreground Competitive Model for Background Subtraction in Dynamic Background. Procedia Technology. Elsevier Inc.2016, 25, 536 – 543. http://dx.doi.org/10.30526/31.2.1954 https://doi.org/10.1109/ICASSP.2011.5946556 https://doi.org/10.1109/ICASSP.2014.6854862 https://doi.org/10.1016/j.cviu.2013.10.015 https://www.sciencedirect.com/science/journal/15740137 https://www.sciencedirect.com/science/journal/15740137/11/supp/C https://doi.org/10.1016/j.cosrev.2014,04.001 https://doi.org/10.1016/j.cosrev.2014,04.001 https://doi.org/10.1016/j.image.2016.07.008