Dynamic Obstacle Detection Based on Background Compensation in Robot ’ s Movement Spac e

In the safety area of industrial production, robots are required to have the ability of quickly detecting the dynamic obstacles which appear in the working space of robots when robots move along a predefined route. In order to solve the problem of dynamic obstacles detection more effectively, the paper proposes a quick detection method based on background compensation for dynamic obstacles in robot movement space, which makes extraction of feature points on dynamic obstacles in robot movement space, establishes the background model of optical flow velocity field between adjacent frames and makes background compensation for images with the use of blockmatching algorithm in order to realize quick and accurate dynamic obstacles detection in dynamic environment. The experiment results show that the obstacles detection method can effectively eliminate the background movement caused by the movement of camera at the end of robot and can extract a more complete target object. Moreover, it also has good robustness.


Introduction
Dynamic obstacle detection based on background compensation in the robot movement space mainly includes static scene and dynamic scene.The background is relatively fixed in the static scene because camera at the end of robot remains still.So in the static scene, the study of dynamic obstacle detection becomes relatively simple, but existing main problems include illumination changes and so on.Whereas, the background moves as the robot moves in dynamic environment.Besides facing with various disadvantageous factors in static scene, differentiating background with foreground is also essential in dynamic environment [1].What's more, dynamic compensation of background and complex movement of camera add difficulties to obstacle detection.
Moving target detection under complex background mainly includes the following three ways: the background model method [2], inter-frame difference method [3] and the optical flow field method [4].Background model method is mainly used in static or quasi-static video surveillance applications, which can acquire very comprehensive feature data of moving objects, but it is very sensitive to changes in light and other changes in external dynamic scene, and need to use a lot of frames data, which is not suitable for real-time implementation.Inter-difference method, realizing timedomain difference by subtracting images between continuous two or three frames, which is very effective to dynamic scene, but which can not extract all characteristics pixels of a moving target generally, and the premise of which is that background itself is relatively static.The optical flow field method, with strong versatility, can detect target objects effectively when camera makes some complex movements, but along with the limitation of complex computation, therefore it is rather difficult to be implemented in real time.
In this paper, synthesizing three target detection methods above, a method is provided for the detection of dynamic obstacles based on background compensation of robot movement space.As shown in Figure 1, we start from the extraction of moving velocity of feature pixel in grayscale images [5], calculate the optical flow velocity in pixel points using the method based on block matching algorithm, and then establish an optical flow velocity field background model for two frames front and behind, and then compensate for background movement in the moving space, finally accomplish a moving obstacle detection.Experiment shows that the prediction results can effectively detect the spatial mobile obstacles, using optical flow velocity field based on block matching algorithm to accurately describe the movement of background, it also demonstrates that dynamic compensation can eliminate the effects caused by background movement for spatial dynamic obstacle detection effectively.Not only that, the algorithm adopted in the paper has a strong adaptability of dynamic jitter, noise and some other factors like that.

Optical flow velocity field background modeling based on block-matching algorithm
It is hard to differentiate background from dynamic obstacles effectively in robot's movement space because both dynamic obstacles and robot move at the same time.For the phenomena above, the paper computes the optical flow velocity field background model with the use of block-matching optical flow method.The method adopted to build background model is to calculate optical flow velocity field background model for feature points extracted from m u n non-overlapping bits with the same algorithm, which can improve the accuracy of matching between feature points effectively as well as decrease calculation time.

Optical flow algorithm based on block matching
The main thought of the optical flow algorithm based on block matching is to divide an image into m u n non- overlapping bits, supposing that all the pixel points in every image bit have the same displacements, that is every image bit is regarded as a movable object.Presuming that the image sequence at time t corresponds to the image at the frame of k and the image sequence at time W t corresponds to the image at the frame of k+1.And then we search for the most similar image bit with that at the frame of k in the image at the frame of k+1 according to certain matching criterion and search algorithm, and we think that the image bit moves from the position of k frame image to the position of k+1 frame image after moving.As for the matching criterions of block-matching algorithm, because the Mean Absolute Differences (abbreviated as MAD algorithm) doesn't need to take the multiplication, which is used widely with easy and convenient implementation.In real calculation, unnecessary division is able to be removed.Usually, MAD will be turned into SAD [6] , that is, Sum of Absolute Difference, its definition is as follows: The matching criterion not only reflects the similar relationship between two bits, but also the accuracy of moving state of the object achieved by the matching criterion will influence the authenticity and reliability of final optical flow field image directly.On the condition that illumination variation, zooming and rotational motion of the object exist, the optical flow field got by SAD criterion will have obvious discretization and will not exactly reflect the real movement condition of the object.On the basis of assumption of movement conservation, a method is put forward in the paper, which combines SAD matching criterion with gradient-based block-matching criterion to meet the requirements of moving state detection of the object.
Block-matching criterion is combined by SAD matching criterion and gradient-based block-matching criterion.According to the block-matching criterion and the impacts weighting coefficient and gradient have on the images, we can get the following equation: At the same time, the equation of optical flow field of the image is as follows: After combining SAD matching criterion with gradient-based block-matching criterion, the differences between matched blocks and blocks to be matched depend on gradient information of the image instead of grayscale information, which is correspond to gradient conservation assumption when the object moves.At the same time, due to the existence of gradient information of the image, the criterion no longer considers the grayscale conservation between different blocks in two frame images, but asks for the gradient conservation between matching block and original block, which makes the algorithm more accurate to deal with the condition of illumination variation.

Construction of the optical flow velocity field background model
In the process of constructing the optical flow velocity field model, as for block-matching optical flow algorithm, at first, we calculate the optical flow velocity vector 1 v at every feature points for results got by block-matching in current frame at time t.And then we calculate the optical flow velocity vector 2 v at every feature points in current frame at time t-1.The specific calculation method is as follows: 1) we preread one frame image (Template Image) and regard it as a reference frame for calculating optical flow velocity.Supposing that w u v , , are the spatial coordinate information at feature points for every frames respectively.We initialize min successively.According to this algorithm, build the optical flow velocity filed model for velocity relations corresponding to every matching block in every frame and its previous frame.We describe background movement with the use of the optical flow velocity field model.As shown in Figure 2, it is obvious that mobile background is mistaken as an obstacle to be detected when moving state of background changes.Hence, in order to eliminate the influence of background movement caused by robot's movement on dynamic obstacle detection, we need to make dynamic compensation for background of the movement.

Movement background compensation and dynamic obstacle detection
When the condition is that the camera at the end of robot is moving, assuming that there are no obstacles in moving space, so we can think that the reason of causing image background to change is completely due to movement of robot's space.At this time, we make global movement compensation [7] for the image extracted between frames to make the scene in current frame consistent with the scene in compensated frame, which can effectively eliminate background movement caused by robot's spatial movement.As for background movement compensation, the paper adopted the adaptive random point distance block motion estimation method.The basic thought of the algorithm is to take the movement vector information of the image in previous frame as the initial estimate value of searching in current frame and to do match searching in order to increase speed of the algorithm.The specific measures are: 1) inputting the image in current frame and the image in previous frame, and judge the existence and validity of block movement estimation in previous frame; 2) for every block in current frame, establishing two big rhombus searching areas centering on (0, 0) and movement estimation value in previous frame to look for the best matching point; 3) if the best matching point is one point among the other points beyond central area of movement estimation big rhombus in previous frame, we will search this area with the adaptive point distance searching method; 4) if the best matching point falls into the central area of big rhombus searching range centering on movement estimation in previous frame, then we establish a small rhombus area to search centering on this point; 5) according to rhombus searching algorithm, we stop cycling until searching the central part of small rhombus and take the point as the result of movement estimation.
After getting block movement estimation value, we are able to calculate parameter values of the 6 parameters model [8] of the camera.We calculate approximation function numbers for the parametric model with the least square method based on curve-fitting (or data-fitting) in the paper.For the six parameters model: Six parameters are estimated in the model with the method of least square estimation to make the sum of errors (denoted by E) the minimum in the following: In the Eq. ( 5), N represents all the points used in the calculation.
As for the errors caused by the block estimation values partly or overall belonging to the movement target area in the process of estimation calculation of six parameters, every estimation result is assessed with the six parameters fitted.If the bias is bigger than a certain threshold value, then the movement estimation value of the point will be removed and six parameters will be fitted again.Putting all the qualified block movement estimation results into the six parameters model, six parameters are fitted with the least square method.Putting the six parameters model fitted into the centric coordinate of every block, and the motion vectors of the six parameters model are calculated.Because the calculation results may not be integer, pixel value is not obtained for the digitized image.And then we adopt an image interpolation method of closure -bilinear interpolation to receive the statistical properties of both the motion vectors obtained by calculating all the qualified blocks and movement estimation results.
The good background compensation is obtained in the dynamic scene, and dynamic obstacles are detected with the optical flow method in static scene by analyzing and resolving robot's camera six parameters model and combining with block matching optical flow velocity field model.

Experimental results and analysis
The experiment adopts three-dimensional software to build the virtual situation [9] and control the robot to realize the dynamic situation where movable obstacles appear in the path, along which robot approaches the target object little by little (as is shown in Fig. 3) with the first perspective, at the same time, the experiment makes use of the block-matching optical flow method and background compensation algorithm to detect dynamic obstacles.

Figure 3. Dynamic movement situations with the robot's first perspective
We calculate the optical flow velocity vectors in the feature points of every frame after extracting the feature points in every frame image, and then build the background model of the optical flow velocity field by comparing the velocity difference in every frame.After building the background model, the detection of target objects in different frames is respectively conducted with the optical flow method based on the background model.The detection results are shown in Fig. 4.

Figure 4. Detection results of target objects in dynamic background
The experimental results show that dynamic background compensation of the optical flow velocity field has received good detection effects for dynamic obstacles in robot's motion space.Influenced by noises and other factors, there is some phenomena such as vague and distortion in the background model, so we need to make further improvement in post production; in the process of dynamic obstacle detection, the detection for single mobile object has better feasibility and higher accuracy in dynamic background with the blockmatching optical flow method, at the same time, under the influence of the color of background, target objects and surrounding reference objects, integrity of the objects under detection is far from satisfactory, so it requires more improvement about algorithm and image processing.On the whole, the experimental results reach the anticipative design goal, verify the detection algorithm for dynamic obstacles in robot's movement space based on background compensation adequately and demonstrate the feasibility of the algorithm fully.

Conclusions
The paper provides the dynamic obstacle detection algorithm in robot's movement space based on background compensation.Moreover, the paper introduces a kind of novel method about how to establishing the background model of the optical flow velocity field, which simplifies the dynamic modeling in the calculation of the camera affine motion model greatly by means of the background model established.The method is also a very effective method to detect dynamic obstacles when the camera is mobile, because it brings optical flow algorithm's superiority in target detection into full play.The drawback of the algorithm is relatively complex calculation and lower precision, so the algorithm remains to be further optimized.

Figure 2 .
Figure 2. Extracting images from optical flow velocity field