Professional Documents
Culture Documents
Resumen—In this paper we present an implementation of an the relative motion between an object in a scene and a camera
efficient algorithm to calculate the optical flow in real time; with to get 2D image sequence [2], [3], [4], [5]. As the robot
the aim to get the move speed of an orange ball which is used moves, distant objects towards the center of the image tends
to play soccer in kidsize category within RoboCup’s league. This
gives to robot the ability to estimate the direction of movement of to flow more slowly than nearby objects. The optical flow
the ball and its speed. As a first version, the vision system consists calculations allows recovery of the distance to objects in the
of a webcam Logitech Quickcam Pro 9000 with 2 megapixel and image and its speed. In this way, the robot can detect and
autofocus which provides the image or images to be processed in avoid obstacles while moving around them. One of the first
“ real time”. The algorithm implemented is based on the Lucas- steps is to select a suitable algorithm to be programed, with
Kanade method, as this is easily applied to a subset of image’s
points, In addition, it is computationally faster compared with respect to the reliability of optical flow data generated, the
other techniques and it can be adapted to a stereoscopic vision number of stored image frames and the amount of calculation.
system . Finally, we present experimental results that support One of the most popular algorithms for obtaining the optical
the good performance of the algorithm. flow is the Lucas-Kanade. This is a differential method which
Index Terms—Optical Flow; Computer Vision; Mobile Robots; is widely used, and it assumes that the flow is constant in
Humanoid Soccer.
a local neighborhood of the pixel under consideration, and
solves the basic equations of optical flow for pixels within
I. I NTRODUCTION
that neighborhood by the least squares criterion.
The preformance of tasks by robotic systems in structured Since moving objects in three dimensional space are projec-
environments with the presence of objects whose position ted onto an image’s plane, the real speed of them becomes a
and orientation are well known, is a problem currently being two-dimensional field, called motion field. That is, the optical
studied. However, performing tasks in dynamics environments flow is a velocity field in the image, which can transform
presests numerous difficulties that are not yet resolved. Vision an image into the next, in a sequence and as such, is not
systems are able to provide extremely useful informacion in determined uniquely, additional restrictions are necesary to
these changing environments, they provide information about obtain a “particular” optical flow. The motion field, despite
the objects in the scene work. Moreover, the use of vision the loss of information because of the passage of three to
in the fiel of robotics is justified by the wide availability of two dimensions, is a purely geometric, without ambiguity.
cheap cameras. Currently, the results provided the vision as Therefore, the aim is to get enough optical flow field similar to
sensor are low noise, high numer and information and low the motion, to allow obtaining measurements from the images.
cost. However, the extraction of relevant information in real Currently, the optical flow can provide an estimate of range
time from a single image or images set is a hard enough task, of motion accurate enough for some real applications.
which remains a major obstacle to the implementation of the
vision in mobile robots [1]. II. O PTICAL F LOW
Current trends in robotics research anticipate the application Optical flow or optic flow is the pattern of apparent motion
of robots in public environments that help human beings in of objects, surfaces, and edges in a visual scene caused by the
their daily tasks and their entertainment. Within the scope relative motion between an observer (an eye or a camera) and
of entertainment, we have RoboCup league, which allows the scene. It plays an important role in movement estimation
collaboration and research to make improvements in the fields and its description, which is commonly used in detection tasks,
of artificial intelligence, mobile robots, artificial vision, etc. segmentation and tracking of moving objects in a scene from a
The estimate of an object speed in artificial vision is a difficult set of images. Formally it is said that Optical flow field is the
task, since the vision system has to be very flexible to identify apparent motion of brightness patterns between 2 (or several)
the object that is required, in order not to misclassify similar frames in an image sequence. It is assumed that illumination
objects inside and outside the field. does not change, changes are due to relative motion between
Optic flow is a useful piece of information that can be the scene and the camera, for this we have 3 possibilities:
extracted from images captured by a mobile robot to determine camera still, moving scene.
moving camera, still scene. In this paper we selected an algorithm for optical flow,
moving camera, moving scene. which is based on the Lucas-Kanade method, this algorithm
The motion field assign a velocity vector to each pixel in allows us to estimate the soccer ball speed. This algorithm
the imag. These velocities are induced by the relative motion was chosen mainly because it can be implemented easily and
between the camera and the 3D scene. The motion field is the its computational requirements are low.
projection of the 3D velocities on the image plane. In Figure The following describes the back up of optical flow techni-
1 we can see: que which was implemented. It is noteworthy that a video is
a) Translation perpendicular to a surface. considered as a sequence of images in gray levels.
b) Rotation about axis perpendicular to image plane. II-A. Mathematical Foundations
c) Translation parallel to a surface at a constant distant. Optical Flow is an approximation of the local image motion
d) Translation parallel to an obstacle in front of a more based on local derivatives in a given sequence of images. It is
distant background. assumed that all temporal intensity changes are due to motion
only.
Assume I(x, y, t) is the center pixel in a n × n neighbour-
hood and moves by δx, δy in time δt to I(x+δx, y+δy, t+δt).
Since I(x, y, t) and I(x + δx, y + δy, t + δt) are the images
of the same point. We then have:
I(x, y, t) ≈ I(x + δx, y + δy, t + δt) (1)
where (δx, δy) corresponds to the displacement of the region
at (x, y, t), after some time δt. We can perform a 1st order
Taylor series expansion about I(x, y, t) in the equation (1) to
obtain:
I(x+δx, y +δy, t+δt) = I(x, y, t)+5I ·(δx, δy)+δtI1 +Rn (2)
Video
(b) (c)
Image
Figura 3: Assumptions behind Lucas_Kanade optical flow Processing
AT W 2 Av = AT W 2 b
We used library OpenCV to capture video [9], [10], with
if AT W 2 A is not singular, a solution can be obtained by using programming environment called Visal Studio C + + 2008 (see
the Moore-Penrose pseudoinverse which is a solution in the Figure 5).
COMPUTER
VISUAL STUDIO
Open CV
Image Processing
Lucas-Kanade Algorithm
IV. R ESULTS
In this section we present the implementation results of
pyramidal Lucas-Kanade algorithm in order to detect the speed Figura 8: Velocity ball
and movement of an orange soccer ball used in RoboCup. It’s
important to mention that for this tests the camera position
In Figures 10 and 11 show the displacement ball with
was on top of the scene looking down. Another important
negative movement in the x-axis and negative in the y-axis.
point is how to know the sense of the movement. For this, the
algorithm uses numbers, “1” in the positive sense and “0” for
Next, we present results differents ball movements
the negative sense.
In Figure 6 shows the ball speed in the x-axis and y-axis, Negative movement in the x-axis and positiveve in the
as we can see, all thoswe values are zero because the ball is y-axis (see Figure 12).
not moving. Negative movement in the x-axis and negative in the y-
In Figure 7 we can see the corresponding image of the below axis. (see Figure 13).
figure 6 wich present the ball with velocity zero. Negative movement in the x-axis and negative in the y-
Figures 8 and 9 the ball has posite movement in the x-axis axis with bigger angle. (see Figura 14).
(a)
Figura 9: Direction ball
(b)
Figura 10: Velocity ball Figura 12: Results x negative & y positive.
(b)
(a)
(b)