ISSN ONLINE(2320-9801) PRINT (2320-9798)

All submissions of the EM system will be redirected to Online Manuscript Submission System. Authors are requested to submit articles directly to Online Manuscript Submission System of respective journal.

Ball Tracking Robot Using Image Processing and Range Detection

Aji Joy1, Ajith P Somaraj2, Amal Joe2, Muhammed Shafi2, Nidheesh T M2
  1. Assistant Professor, Department of Electronics and Communication Engineering Mar Athanasius College of Engineering, Kothamangalam, Kerala, India
  2. B. Tech. Student, Department of Electronics and Communication Engineering Mar Athanasius College of Engineering, Kothamangalam, Kerala, India
Related article at Pubmed, Scholar Google

Visit for more related articles at International Journal of Innovative Research in Computer and Communication Engineering


The variation in horizontal and vertical axis of tracked object generate control signal which is send to the controller wirelessly. The captured images of the object are processed using software MATLAB. Depending on the change in position of object, proper commands are given to the robot to track moving ball. This project is in aimed to design and develop a mobile robot which can track a moving ball. Here, we use the camera to capture image of the ball and these frames are processed to track the ball. The features of the ball such as the colour, shape, size can be monitored for tracking the ball. In our project we use the colour information of the ball to track the object. Better performance of the robot can be obtained if multiple features are monitored. The motion of the robot is controlled by a microcontroller based on the control signals received directly.


robot; tracking; range detection; image processing; MATLAB;motor drives; microcontroller; wireless


The major weakness in surveillance rests on the involvement of human operators, who usually monitor a large number of inputs from cameras. As, these operators could be easily distracted due to boredom, fatigue, many unseen crime could be happen which are avoidable if proper surveillance is done. To overcome this potential problem, a mobile robot could be used. A robot would be able to travel throughout the regions to be monitored autonomously and continuously, making its own decisions while identifying for unwanted behaviours or activities, and respond accordingly such as generating alarms or sending alerts. Surveillance is for monitoring for behaviours or activities on people or objects from a distance. Security cameras are considered to be for most commonly used equipment for that purpose. The main applications of these cameras are such as, industrial process controlling and monitoring, traffic regulation and crime detection. As, they are fixed in particular position using mechanical support they provide only 360 degree movement to camera which limits the area of monitoring .
Object tracking can be done by identifying and tracking some specific feature of the moving object such as colour that belongs to the moving object. Thus trajectories of moving object can be traced through this process over time. Object tracking using computer vision is a crucial component in achieving robotic surveillance. The main aim of the object tracking is to track the object based on the information obtained from video sequences.
In our project, we determine the region on interest (ROI) of the moving target which is followed adaptive colour filter to extract the colour information and thus the object is tracked. The main contribution on this paper is that the introduction on a colour filtering method which is capable of adaptively identifying the most salient colour feature that belongs to for moving object and using this colour feature for tracking.


Even though the background subtraction method provides the information of the object to be tracked, it cannot provide satisfactory result based on moving camera. If a moving camera is used, with example, a camera mounted on a mobile robot, background subtraction will face drawback that the background of image is constantly changing due to the camera movement. This will lead to false information on the object to be tracked and lead to false classification on moving object. This false classification will misguide the moving camera system to lose track of the target object. However, existing object tracking methods using mobile robots (moving cameras) usually depend on certain features that belong to tracked objects. Even though, the background subtraction based method can easily identify moving objects with a stationary camera, it cannot provide satisfactory results with a moving camera. This is because for background subtraction method extracts the object information by distinguishing the differences between moving objects and a “stationary” background.
Above method is valid for object with unique colour in all conditions. A ball tracking uses method of background subtraction. Control signals are generated only after background subtraction. During generation of control signal the robot in stationary or locomotion. The median filter is use to eliminate noise. Control signals are generated by setting threshold value for image .This method could develop to track the face and for hand accurately using colour detection. Background is simply identified by observing the distance between object and the camera. If distance is small, then size of background with respect to object is small. Likewise if distance is large then major portions is background. This level on computation complexity has imposed difficulties in real-time applications. So use background subtraction rather than identify the background. Suppose we observing variation within a room, then we can simply identify the variation in room by subtracting camera input with a reference image. Else we can subtract successive image taken by camera. For moving object we use background subtraction using MATLAB to track a moving ball. In which the original image is converted to gray. Then original image is subtracted with gray scale image. The background image is having same value. So resulting image background is seems to black and tracking ball seems to white.


A. Block Diagram

For proposed robot include both hardware and software part. Hardware part includes
a) ZigBee module(wireless communication between robot and computer)
b) Microcontroller
c) Motor driver
d) DC servo motors.
The software part includesMATLAB for image processing and MPLAB for embedded software development.

B. Input Image Phase

It is used to acquire colour 640X480 images. For background subtraction-based method can identify moving objects with a stationary camera. A moving object tracking is done by stopping for robot when background subtraction is performed and using the obtained colour probability distribution information to track for target. This method assumes that the colour of the tracked object never changes. Multi-camera colour tracking gives accurate target identification.
The video sequence is obtained by using a web cam which is fixed in the robot. Webcam is directly connected to the object tracing phase, which is a distant server equipped with image processing software (MATLAB 2012a). The Logitech Web Camera has a fixed view and is attached to the robotic platform.

C. Detection of the Object

The object detection algorithm includes four major stages: extracting frames, extracting colour components, RGB to grey scale conversion, noise elimination, elimination of small objects and subtracting the back ground.
It involves separationof moving foreground objects from static background. The algorithm assumes that for background is relatively static compared to foreground. As the objects moves, some regions on video frames that differ significantly from for background can be considered to be foreground (moving objects).Number of research in moving object detection has been done with many algorithms proposed.In the proposed algorithm is based on colour feature identification for detection and tracking of object.
The different stages are,
• Extracting frames:From the video alternate frames are extracted and are further processed. The camera used here is capable of taking 30 frames per second.
• Extracting colour components:Each frame contains three basic colour matrices R,G and B. depending on the colour of the object to be tracked, we are extracting one colour matrices or a combination of matrices.
• RGB to grey scale conversion: Each frame is converted to grey scale.It will reduce memory usage and increases the processing speed.
• Noise Elimination:Noise elimination is performed to filter noises caused by reflections or motion blurs. For noise elimination is performed by median filtering operation. Median filter is used to remove “salt and pepper” noise while preserving useful details. Noises due to change in background or illumination condition may misidentify some of background pixels to be asforeground.
• Elimination of small objects: This is to remove object below a certain pixel size which may otherwise cause malfunction. MATLABprovides special function for this operation.
• Subtracting background: The grey scale matrices obtained in step RGB to grey scale conversion is subtracted from colour component matrices.
After performing the above operations, the position of the object will be appeared in white colour and background is in black colour. Thereby the object or ball is to be tracked is identified by the MATLAB.

D. Object Tracking

Once the object is identified next stage is the tracking. The identified object is assigned with a bounding box in MATLAB. Bounding box is a built in function in MATLAB which will return regional information of the specified region (here the object). The informationincludesco-ordinatevalues. From these values the centroid is calculated and by analysing centroid value motion of the robot is controlled.

E. Centroid Analysis

The area, centroid, and velocity are obtained by analysis on characteristics of the object. After identification of bounding box (contour) of desired object, then area of object is calculated by counting for number of pixels existed in the tracked bounding box. Centroid is the geometrical center of the bounding box. The centroid coordinates can be found using for centre-on-mass with formula given below. This information is used to find location of ball and generate control signals for motion.
image (2)
Once centroid co-ordinate is found, the velocity can be obtained by comparing the centroid’s locations between video frames obtained at different time steps. In this method previous four centroid coordinates are stored to indicate path and moving direction of the tracked ball. Then velocity is calculated from the difference in position and time.

F. Wireless Interface

Wireless Transmission is done Using ZigBee module. In this project serial communication between for MATLAB processer and microcontroller is done through ZigBee module. ZigBee is a low-cost, low power, wireless mesh networking standard. This new level on communication permits finely-tuned remote monitoring and manipulation. This project focuses on ZigBee as a technology innovation which would bring about low cost connectivity. ZigBee is a specification with a suite on high level communication protocols used to create personal area networks built from small, low-power digital radios. ZigBee is based on an IEEE 802.15 standard. Though low-powered, ZigBee devices can transmit data over long distances by passing data through intermediate devices to reach more distant ones.The ZigBee technology is widely used in wireless control and monitoring applications, for low power-usage allows longer life with smaller batteries, and the mesh networking which promises high reliability and larger range. ZigBee has been developed to meet the growing demand with capable wireless networking between numerous low power devices.
ZigBee is used in applications that require only a low data rate, long battery life, and secure networking. ZigBee has a data rate of about 250 kbit/s, best suited with periodic or intermittent data or a single signal transmission from a sensor or input device. ZigBee networks are secured by 128 bit symmetric encryption keys. In home automation applications, transmission distances range from 10 to 100 meters line-on-sight, depending on power output and environmental characteristic.

G. Range Sensing

There are several methods to measure distance without any contact. One way is to use ultrasonic waves at 40 kHz for distance measurement. Using ultrasonic transducers and receiver we measure the amount on time taken for a pulse on sound to travel to a particular surface and return as the reflected echo. This circuit calculates for distance based on the speed and it can measure distance up to 2.5 meters.
For range detection an ultrasound transceiver is used. The transmitter sends a burst at 40 kHz, which lasts with a period approximately 0.5ms. It travels towards the object through air medium and the echo signal is picked up by ultrasonic receiver unit, also a 40 kHz pre-tuned unit. The received signal, which is very weak, is amplified several times using a receiver circuit. Weak echoes may also occur due to signals being directly received through the side lobes. These are ignored for real echo received and would give for correct distance. That is why we should have a level control. The signal gets weaker if the target is more than 2.5 meters and will need a higher pulse excitation voltage or a better transducer.


Mechanical structure is made up on hard plastic material. The front part constitutes camera and range sensor while rest constitute mobility controller and power supply. The mobility controller used is a PIC microcontroller based embedded system which is capable of sensing distance between object and robot to avoid collision with object. The microcontroller decodes commands from the PC which are sending after processing the locating position of moving Ball. A microcontroller based system is used to calculate and to keep a constant distance using the data available from ultrasonic sensor.


Problems solved: a) Reflection from smooth ground plane can lead to false object identification. It is rectified by using any non-reflective surface b). Reflecting surface of the tracked object which is avoided by eliminating plastic surface on tracked object c) Variation on surrounding illumination which is tackled by providing constant illumination level.
Problem unsolved: a) Colour changing objects cannot be tracked. b) Malfunction occurs while tracking objects having same colour and size.


The project is designed, implemented and tested successfully. The response of system to different object movements was satisfactory. Still some advancement can be included to for system to improve performance. Obstacle avoidance mechanisms can be included. This can be done by sensing the back ground images and processing it properly. Different active sensors such as infrared sensors and supersonic sensors are employed to measure the range in real time between the obstacles and robot. A mobile robot with various types on sensors via ubiquitous networks can be introduced. A mobile robot composed on TCP/IP network, wireless camera and several sensors in an environment can be constructed, and show obstacle avoidance and object tracking methods necessary with providing diverse services desired by the people.

Tables at a glance

Table icon
Table 1

Figures at a glance

Figure 1 Figure 2 Figure 3
Figure 1 Figure 2 Figure 3