MohammedAhmed J.1
                     Al-ZukyAli A. D.1
                     Al-ObaidiFatin E. M.*
               
                  - 
                           
                        (Department of Physics, College of Science, Mustansiriyah University, Baghdad, Iraq
                        jbar4903@gmail.com, {prof.alialzuky, sci.phy.fam}@uomustansiriyah.edu.iq
                        						)
                        
 
            
            
            Copyright © The Institute of Electronics and Information Engineers(IEIE)
            
            
            
            
            
               
                  
Keywords
               
                Arduino,  Servo motor,  Image scale,  Cascade object detector,  MSER
             
            
          
         
            
                  1. Introduction
               In recent life, object detection and tracking system had a wide variety of applications.
                  Such applications may include video surveillance, vision-based control, human-computer
                  interfaces, medical imaging, augmented reality, animation, security, and robot vision.
                  The machine vision system uses images and videos to detect, classify, and track objects
                  or events to understand the real-world scene. Image processing is an active field
                  of interest for researchers. The field of improvement, innovation, development, and
                  modification in image processing is constantly expanding [1,2]. The most popular image-processing task are face recognition and tracking systems.
                  In such systems, the object can be detected, and tracked, and a laser pointer can
                  be aimed toward an object, to be used later in many applications, such as security
                  and robotics. Recently, several problems resulted in these systems, such as the accuracy
                  of detection, response time, and the obstacles that reduce or obscure the target under
                  investigation. 
               
             
            
                  2. Related Work
               Many researchers have focused on object detection and tracking. A. H. Miry [3] implemented a real-time facial recognition system using webcam hardware as an input
                  device and an Arduino microcontroller as an output device. The wavelet transform extracted
                  the features with principal component analysis that provided data abundance. The results
                  showed that the wavelet maximizes the distance for people outside the database while
                  minimizing the distance for people in the database and found that the format 160*120
                  with wavelet transform was the best format for recognition than other formats.
               
               R. Kiran et al. [4] reported an algorithm for face recognition using image processing while the output
                  was pin state processing of an Arduino board with an ATmega328P controller by tracking
                  a human face. When a board receives a character from MATLAB, a digital output pin
                  or a board sets HIGH or LOW accordingly. LEDs are connected to these digital output
                  ports and by receiving the signals from MATLAB, they changed their states from on
                  to off and off to on.
               
               V. S. Pamulapati et al. [5] explained the working of the Viola-Jones algorithm for face tracking in real-time.
                  The main objective of their project was to detect a human face in every frame of a
                  video coming from a web camera. The captured image was processed using the viola-jones
                  algorithm using MATLAB to detect the faces and send signals to the Arduino board to
                  control the camera movement using two servo motors. One servo was used for horizontal
                  rotation and another for vertical rotation. The face was tracked actively and maintained
                  in the frame. The proposed system for tracking faces using the Viola-Jones algorithm
                  in MATLAB was superior the current method. Using an adaptive boosting algorithm helped
                  increase the accuracy and efficiency of the proposed method.
               
               P. Vignan [6] introduced a tracking system that used an inexpensive imaging device with two servo
                  motors to control the pan and tilt of a camera for face tracking by capturing vital
                  facial features. Through the results, the system was tested and the success rate was
                  accurate (95.7\%).
               
               M. Mira et al. [7] suggested the application of security systems to vehicles equipped with alarm devices
                  on a large scale to detect the presence of persons. In such a system the security
                  level was very low because the system could not distinguish between the owner and
                  a thief. The trick was to match the texture of the facial curves with the facial data
                  stored in the database. The vehicle can only be operated when the system detects the
                  owner's face entered into the system database. If the driver's face not in the system
                  database, it is not recognized, and the tool will automatically sound an alarm and
                  turn off the car ignition. Based on data from the experiment, it was concluded that
                  the voltage generated for some samples entered into the database were only a few differences
                  in voltage values. On the other hand, compared to several samples not included in
                  the database, there was a big difference in the voltage value. The voltage stability
                  on each part tended to be stable, differing only by 0.5 volts.
               
               B. Nethravathi et al. [8] proposed an effective design by implementing a home security system. The proposed
                  work consisted of home security with real-time access and control via a mobile phone
                  and an Arduino as a controller. A security system with a webcam was deployed at the
                  entrance to the house. This was connected to the Arduino. The GSM module was used
                  to send alert messages. The faces were recognized by the EHD algorithm using MATLAB.
                  TLS was a very secure protocol, and could be posted to ensure no security was pierced.
                  The system accuracy decreased when the number of different faces increased.
               
               E. Ramkumar et al. [9] explained using the Viola-Jones database for the biometric authentication of individuals
                  such that images are preserved during processing. The saved information was worked
                  to recognize faces, and an impression signal was given to the console if the information
                  matched. MATLAB software was used to give away control signals to the actuator, which
                  was used to open and close the door. The image entrance was fed by a digital camera
                  and the image was processed inside MATLAB. The output proposed was sent to the external
                  controller interfaced with MATLAB. After implementing the system, it was possible
                  to use the Arduino controller instead of the Raspberry pi, because it is less expensive
                  and can accommodate larger datasets, all of which will improve the system efficiency.
               
               T. A. Salih et al. [10] proposed a wireless camera system to detect objects in the field of view of a robot.
                  The principal component analysis (PCA) algorithm and filters were used to implement
                  and demonstrate the image operation. In such a system, the applied camera identified
                  objects with changing backlight conditions such as a fire inside a building. The system
                  was tested using the MATLAB environment, and the experimental performance demonstrated
                  the efficiency and robustness of the proposed system.
               
               The originality of the presented work focused on the accuracy of the measurements
                  for servo used motor in terms of distances and angle of view according to the input
                  information sent from the Arduino board. 
               
             
            
                  3. Proposed Scheme
               The following methods were adopted to test the performance of the designed system.
               
                     3.1 Cascade Object Detector
                  The cascade object detector system comes with several pertained classifiers for detecting
                     frontal faces, profile faces, noses, eyes, and the upper human body. On the other
                     hand, these classifiers are not always sufficient for a particular application [11]. A cascade of classifiers is a degenerated decision tree comprised of stages of increasing
                     complexity, with the first stage training a classifier to detect most objects of interest
                     and then triggering the evaluation of the second stage classifier, which has also
                     been adjusted to achieve a high detection rate. Several integrated (nested) layers,
                     each containing a boosted classifier, comprise a cascade of boosted classifiers. The
                     cascade function as a single classifier combines the results of the previous steps.
                     The reason behind this method is that the majority of the sub-windows within a single
                     visual frame are negative. While it is uncommon for positive-sub-windows to travel
                     through the stages. The cascade can speed up processing the number of sub-windows
                     considerably using this method. The initial weak classifiers attempt to reject many
                     negative sub-windows as possible, with great computation resources spent on the positive
                     sub-windows. Sub-windows were more difficult in the first cascade stages. The Cascade
                     detector used only one of three feature types (Hog-features, Haars features, and Local
                     Binary Patterns features (LBP)). The default feature for the cascade object detector
                     was Hog-features. The detection process takes the shape of a degenerate decision tree
                     as depicted in Fig. 1 [12,13].
                  
                  
                        Fig. 1. Schematic depiction of the cascade detection[14].
 
                
               
                     3.2 Maximally Stable Extremal Regions
                  The Maximally Stable Extremal Regions (MSER) is a method for blob detection in images.
                     The MSER algorithm extracts several co-variant regions from an image, called MSERs.
                     The MSER is a stable connected component of some gray-level sets of the image. The
                     MSER object checks the variation of the region area size between the different intensity
                     thresholds. The variation must be less than the value of the MaxAreaVariation parameter
                     to be considered stable. The MSER feature detection un-suitable for images with extreme
                     intensity value changes [15].
                  
                
             
            
                  4. Tools and Methodology
               Arduino is an electronic development board consisting of an open-source electronic
                  circuit with a microcontroller ``ATmega328'' which can be connected to different programs
                  on a PC and relies on its programming on the open-source programming language processing,
                  and codes. Arduino software is similar to C language and is one of the easiest programming
                  languages for writing microcontroller programs. Fig. 2 depicts the main components used in the current system. A servo motor (MG995) with
                  a 180-degree rotation angle was used. In addition to a laser pointer and human face
                  image to detect and track. The algorithm was implemented using a Lenovo laptop camera
                  (core i7 and resolution: 1280 X 720) with a (0$^{\circ}$ - 77$^{\circ}$) angle for
                  the camera field of view.
               
               The working principle of this system was as follows, it sends a notification signal
                  to the Arduino board in which the object position relative to the x and y-axes are
                  included when the laptop camera detects a face or any moving object. Subsequently,
                  the Arduino board converts the signal to the servomotor, where a laser pointer is
                  installed. As a result, the signal becomes 'one' when the moving object is detected
                  correctly to activate the servomotor and direct it towards the object. Otherwise,
                  it is 'zero' when no object is detected. Fig. 3 presents the whole face detection and tracking process.
               
               Fig. 4 presents the Arduino program of the Arduino board is connected with the Matlab program.
               
               The following expressions can be used to measure the accuracy of the servo motor [16]:
               
               
               
               
               
               where ${\Delta}$x is the difference in meter between the specified initial angle and
                  the range (0$^{\circ}$ - 77$^{\circ}$) in the real world, $\overline{\mathrm{x}}$
                  is the average error, $\overline{\mathrm{xs}}$ is an average error for square distances,
                  $\sigma$ err is the standard deviation, Sth is an image scale (distance in pixels
                  over distance in meters), ${\Delta}$Ө is the difference in pixel between the specified
                  initial angle and the range (0$^{\circ}$ - 77$^{\circ}$), and C is object’s distance
                  in meters in the real world.
               
               
                     Fig. 2. (a) Used tools; (b) Experimental setup.
 
               
                     Fig. 3. Block Diagram for the target detection and tracking system.
 
               
                     Fig. 4. Algorithm for detecting and tracking objects.
 
             
            
                  5. Results and Discussion
               The working system was tested for several object distances ranging from one meter
                  to 5m with increasing 0.5m in each step. Fig. 5 depicts the application of the system with increasing distances for some selected
                  cases. The first, second, and third columns in the figure represents the results when
                  the horizontal orientation angle (Ө-initial) equals zero, 40$^{\circ}$, and 77$^{\circ}$
                  respectively.
               
               For the three orientation angles (i.e., Ө = 0$^{\circ}$, 40$^{\circ}$, and 77$^{\circ}$),
                  the average error, image scale, and standard deviation are calculated for each object
                  distance. Table 1 lists the results.
               
               The highest accuracy of servo motor calibration had an average error equal to zero
                  for all distances (Table 1).
               
               Such calibration is executed by examining the servo motor when returning to its initial
                  horizontal orientation angle (i.e., Ө = 0$^{\circ}$, 40$^{\circ}$, and 77$^{\circ}$)
                  through several training steps. A reverse relationship resulted in Sth variation with
                  increasing object distances. Figs. 6 and 7 show the parameter variations with increasing distances and theta respectively.
                  Figs. 6(a), 6(b), 7(a), 7(b) show that the average error and standard deviation are very small
                  and tend to zero with increasing distances and theta respectively which indicate the
                  highest level of system efficiency. As mentioned earlier, a reverse relationship resulted
                  for Sth via distances and the horizontal orientation angle (Ө), respectively shown
                  in Figs. 6(c) and 7(c) respectively. Therefore, the mathematical models from fitting the Sth/Distance
                  and Sth/theta relationships showed that such models obey the polynomial equations
                  as shown in Eqs. (5) and (6) respectively. The appropriate Sth (Eq. (5)) and hence the suitable orientation angle (Eq. (6)) for detecting the target under investigation can be predicted.
               
               
               
               
                     Fig. 5. System application with increasing object distances: (a) 1m; (b) 2m; (c) 3m; (d) 5m.
 
               
                     Fig. 6. Variation of (a) average err; (b) ${\upsigma}$ err; (c) Sth with increasing distances in meters.}
 
               
                     Fig. 7. The variation of (a) average err; (b) ${\upsigma}$ err; (c) Sth with increasing the horizontal orientation angle (Ө).}
 
               
                     Table 1. Results for parameter estimation with increasing object distances.
                  
                        
                           
                              | Distance (m)    | Horizontal orientation angle (Ө-initial) equal to 0º, 40º, and 77º | 
                        
                              | Average error | Sth (pixel/m) | σ err | 
                        
                              | 1 | 0.00583 | 61.111 | 0.00616 | 
                        
                              | 1.5 | 0.00791- | 38.118 | 0.01143 | 
                        
                              | 2 | 0.01041 | 34.070 | 0.00498 | 
                        
                              | 2.5 | 0.00210 | 31.117 | 0.01546 | 
                        
                              | 3 | 0.00270 | 19.642 | 0.01316 | 
                        
                              | 3.5 | 0.00667 | 16.702 | 0.01072 | 
                        
                              | 4 | 0.019375 | 12.769 | 0.01155 | 
                        
                              | 4.5 | 0.01667 | 11.224 | 0.01322 | 
                        
                              | 5 | 0.00604 | 8.779 | 0.02961 | 
                     
                  
                
             
            
                  6. Conclusion
               One of the resulting problems in tracking system is target detection accuracy. In
                  the present work, the goal of detecting and tracking objects was executed efficiently
                  with a high accuracy rate recorded a zero for the error and standard deviation for
                  all distances. On the other hand, one  can predict the true view angle to track the
                  target under the scope. The originality of the research lies in proposing a mathematical
                  model to predict the appropriate angle to assign the target under search.
               
             
          
         
            
                  ACKNOWLEDGMENTS
               
                  				The authors would like to thank Mustansiriyah University, Baghdad, Iraq for its
                  support in the presented work (www.uomustansiriyah.edu.iq).
                  			
               
             
            
                  
                     REFERENCES
                  
                     
                        
                        H. H. Lwin, A. S. Khaing, and H. M. Tun, “Automatic door access system using face
                           recognition,” International Journal of Scientific & Technology Research, Vol. 4, No.
                           6, pp. 294-299, 2015.

 
                     
                        
                        A. H. Miry, “Face Recognition Based Principal Component Analysis And Wavelet Sub bands,”
                           Journal of Engineering and Sustainable Development, Vol. 17, No. 5, pp. 238-248, 2013.

 
                     
                        
                        A. H. Miry, “Real Time Face Recognition based matlab and Arduino microcontroller,”
                           Journal of Al-Ma'moon College, No. 27, pp. 390-403, 2016.

 
                     
                        
                        R. Kiran, M. Lohith, Yogesh E., A. S. Kumar, and J. Anitha, “Interfacing of MATLAB
                           with Arduino for Face Recognition,” International Journal of Science, Engineering
                           and Technology, pp. 2395-4752, 2017.

 
                     
                        
                        V. S. Pamulapati, Y. S. Rohan, V. S. Kiran, S. Sandeep, and M. S. Rao, “Real-time
                           Face Tracking using MATLAB and Arduino,” Iconic Research and Engineering Journal,
                           Vol. 1, No. 8, pp. 59-62, 2018.

 
                     
                        
                        P. Vignan, “Face Tracking using MATLAB and Arduino,” International journal of research
                           in electronics and computer engineering (IJRECE), Vol. 7, No. 1, pp. 2473-2477, 2019.

 
                     
                        
                        M. Mira, S. Hadi, A. R. Fachrudin, S. H. Susilo, and R. E. Perkasa, “Vehicle Safety
                           System with Arduino-Based Face Detection Technique,” Innovative Education Journal,
                           Vol. 3 No. 3, 2021.

 
                     
                        
                        B. Nethravathi, S. S. Sinchana, and B. C. Anil, “Advanced face recognition based door
                           unlock system using arduino,” International Journal of Recent Technology and Engineering
                           (IJRTE), Vol. 8, No. 3, 2019.

 
                     
                        
                        E. Ramkumar, T. Guna, S. M. Dharshan, and V. S. A. Ramanan, “Implementing Facial Recognition
                           by Interfacing MATLAB Along with Arduino,” International Journal of Innovative Technology
                           and Exploring Engineering (IJITEE), Vol. 10 No. 4, pp. 66-71, 2021.

 
                     
                        
                        T. A. Salih, M. T. Ghazal, and Z. G. Mohammed, “Development of a dynamic intelligent
                           recognition system for a real-time tracking robot,” IAES International Journal of
                           Robotics and Automation, Vol. 10, No. 3, pp. 161-169, 2021.

 
                     
                        
                        E. L.-de-Celis, Ó. G.-Olalla, M. Ga-Ordás, and E. A-Gutiérrez, “An evaluation of Cascade
                           Object Detector and Support Vector Machine methods for People Detection using a RGB-Depth
                           camera located in a zenithal position,” Actas de las XXXVI Jornadas de Automática,
                           pp. 134-140, 2015.

 
                     
                        
                        E. Corvee, and F. Bremond, “Haar like and LBP based features for face, head and people
                           detection in video sequences”, International Workshop on Behaviour Analysis and Video
                           Understanding (ICVS 2011), Sophia Antipolis, France. pp. 10. ffinria-00624360f, 2011.

 
                     
                        
                        Sh. J. Shahbaz, A. A. D. Al-Zuky, and F. E. M. Al-Obaidi, “Evaluation of Object Detectors
                           in Recognizing Crossroad Intersection Triangle Sign," Indonesian Journal of Electrical
                           Engineering and Computer Science, Vol. 29, No. 2, 2023.

 
                     
                        
                        P. Viola, and M. Jones, “Rapid object detection using a boosted cascade of simple
                           features," Computer Vision and Pattern Recognition,” 2001. CVPR 2001.

 
                     
                        
                        J. Matas, O. Chum, M. Urba, and T. Pajdla. “Robust wide baseline stereo from maximally
                           stable extremal regions,” Image and Vision Computing,” Vol. 22, No. 10, pp. 761-767,
                           2004.

 
                     
                        
                        A. Gad, “Evaluating deep learning models: the confusion matrix, accuracy, precision,
                           and recall ,” 2021.

 
                   
                
             
            Author
            
            
               			Ahmed. J. Mohammed is an M.Sc student at the Physics Department, College of Science,
               Mustansiriyah University, Baghdad, Iraq. He obtained his B.Sc degree in Physics from
               the Physics Department/ College of Science/ Mustansiriyah University in 2019. His
               interests are in Image Processing, robotics programming, mathematics, and website
               interface design. He can be contacted by email at: jbar4903@gmail.com
               		
            
            
            
               			Ali Abid Dawood Al-Zuky is a Professor at the Physics Department, College of Science,
               Mustansiriyah University, Baghdad, Iraq. He holds a Ph.D. degree in Physics /Digital
               Image Processing, from the Physics Department/ College of Science/ University of Baghdad,
               1999. He supervised more than 40 M.Sc and 20 Ph.D. projects for postgraduate students
               in Physics, Computer Science, Computer Engineering, and Medical Physics. He published
               more than 200 papers in scientific journals and at various local and international
               scientific conferences in addition to two patents. He received awards for Science
               Day from the Ministry of Higher Education and Scientific Research in Iraq in 2011
               and 2012 and Education Award for Science in 2013. He can be contacted by email at:
               prof.alialzuky@uomustansiriyah.edu.iq
               		
            
            
                  Fatin Ezzat Muhy Al-Dean Al-Obaidi
 
            
               			Fatin Ezzat Muhy Al-Dean Al-Obaidi is an Assistant Professor at the Physics Department,
               College of Science, Mustansiriyah University, Baghdad, Iraq. She holds a Ph.D. degree
               in Physics from the Physics Department/ College of Science/ Mustansiriyah University.
               She received awards for Science Day from the Ministry of Higher Education and Scientific
               Research in Iraq in 2011. Her research areas are Image/Signal Processing, Analysis,
               Pattern Recognition, and Numerical Analysis. She can be contacted by email at: Sci.phy.fam@uomustansiriyah.edu.iq.