Distinguishing Method of outside Edge in the Tennis Ball-mean Shift Algorithm

Target tracking is widely applied to monitoring, video coding and military industry. It is a challenge for computer vision that how to conduct effective tracking in video sequences. Of that the main section is to choose proper features and search matching algorithm rapidly. As an effective matching algorithm, due to no exhaustive search required, Mean Shift is successfully applied in target tracking requiring high real-time performance. Motion image detect is applied to industry, military and some important fields such as bank, transportations. This study studies sports target tracking base on Mean Shift. Apply it to outside edge distinguishing in tennis, which has practical significances for high-precision judgment in other sports terms.


INTRODUCTION
Arget real-time tracking is very important for computer vision.In recent years, many good algorithms have been proposed, such as recognizing by features such as extracting outline, texture and color, etc, using Fourier and wavelet to conduct target recognition or recognizing objects in neural network, etc (Guan and Ruan, 1996).However, due to complex calculations, many algorithms couldn't be applied to situations with high requirements on real time.Dorin Comaniciu brings Mean Shift algorithm into target tracking, reducing calculating quantity greatly.Therefore, many scholars go on perfecting Mean Shift, who has solved many shortages and disadvantages (Fu and Zhang, 2004).
As an efficient pattern matching algorithm, Mean Shift has successfully applied to many fields with high real-time performance needed (Comaniciu et al., 2000).Mean Shift is important for industrial and military applications.Computer vision has important applications in industry, military and medical area.By that, people can better master the application, such as completing robot vision system for industry and military tasks.Visual image is got by observing world with different forms and methods in varied observation systems.It can directly or indirectly function on eyes and generate visual body.Researches and statistics indicate 75% information is got from images (Comaniciu and Meer, 2002).
Mean Shift was proposed in a study about estimation of probability density gradient functions by Fukunaga in 1975.Its initial content is its name, which is bias mean vector.Here Mean Shift is a noun, which is a vector.However, with its theory developing, its content changes.If we consider Mean Shift as an algorithm, it is an iterative procedure.Firstly, calculate the bias mean of current point.Then move the point to its bias mean.Then consider such point as the start.Go on moving.End until meeting certain conditions.But, Mean Shift didn't catch eyes after a long time.Until 20 years later, in 1995, another important paper about Mean Shift proposed.In this study, Yizong Cheng expanded the basic Mean Shift algorithm in following sections.At first, Yizong Cheng definite a family of nuclear functions.Then bias content has different effects on bias vector with different distances between samples and bias points.Secondly, he sets a weight coefficient, which makes different samples have different effects, which expands applicant area of Mean Shift broadly.Besides, Yizong Cheng proposes possible applicant area of Mean Shift and some specific examples (Zhou et al., 2003).Comaniciu et al. (2000) applies it to analysis of characteristic spaces successfully.It has fine effects on image fine and image division.Comaniciu proves, on some conditions, it is sure to converge to the stable point of nearest probability density function.Therefore, Mean Shift can detect existing mode states of probability density functions.Comaniciu et al. (2000) also consider non-rigid tracking approximately as an optimization problem, making it real-time (Li et al., 2005).
Due to it's widely applicant, our understandings of Mean Shift have increased, but some shortages still exist, which are: • When object is moving fast, traditional Mean Shift is easy to be interrupted by background area.Incorrect tracking will have extremely bad effects (Linpeng, 2006) • When the sizes of object change obviously, especially when it is bigger than that of nuclear width, the constant nuclear width will result in loss of objects.At present, there is no good method.
Although somebody proposes the methods base on moment invariant, it has bad effects on real-time performances.Also someone holds modifying the width of nuclear window in positive and negative 10% increments.It needs to conduct 3 independent Mean Shift tracking calculations in 3 different nuclear on current frame.Choose the one with bigger Bhattacharyya coefficient as best one.When the size reduces, such method has better effect.But when the size expands, the width is hard to expand, but easy to reduce (Liu, 2007).
In our study, video image is obtained from common camera base on USB interface.After transforming to image sequences, image colorful space transforms into HSV (Hue, Saturation and Value).After selecting the tracking object, calculate 1D-H and then calculate the object in next frame.The basic principle is to consider the color information as feature, reflecting them to next image (Qifei, 2007) In recent years, with the network developing, video conference and remote education almost come true.In such applications, head tracking and recognition is essential.So it becomes the hot topic.Many new algorithms come up, such as that base on color information, outline detect, human grey distribution and block features, etc (Sunjian, 2006).
Because color still is the most important and obvious feature, the method base on color is considered as the main parameter to realize tennis detect and tracking.Therefore, it has advantages in no changing while expanding, reducing or micro transforming.Besides, the camera directions have no effect on color.It is easy to analyze the face area in next frame on basis of the last frame's analysis.Besides, it is convenient to calculate, more applicant to real-time system (Wu, 2008).
The typical one is Cam Shift algorithm, which is "Continuously Adaptive Mean Shift".That is a motion tracking algorithm.It realizes tracking by the colors.This study stresses the CAMSHIFT algorithm about motion target recognition and tracking.It is integrated in the libraries of INTEL OPENCV image processing and computer visual functions (Peng et al., 2005).
In Mean Shift, constant a color image and the hue histogram of some initial searching area.It can create single channel reflective projection image base on pixel hue concentration, as a searching table.With that image, find the center of tennis in iterative method.When the moving of searching window center is less than some constant value, or reaching the maximum iterative times, returns the position of tennis (Zhou et al., 2002).The color image expands the Mean Shift to continuous image sequences, which forms Cam Shift.Its basic thought is to conduct Mean Shift calculations on all frames and consider the operation results of last frame as the input values of next frame.Then conduct cyclic iteration, detect and track the each frame can be realized.

Principle of Mean Shift
Most video images are color spaces on RGB, so the information in RGB space should be transformed into HSV space.Rule the space area of RGB and HSV is: ROB (o -255 o -255, o -255) HSV (0 -360 o -255, o -255).At first, we transform the RGB image into HVS color space.The specific formula is: It should be noted, because 360 hue is more than the area of 8-bit binary for a color channel, OPENCV will reflect the hue from 0-360 into 0-180.The later processing should consider that (Tian, 2003).
If nuclear function H (•) meets certain statistic moment limits, it is the probability density function, which can be used in non-parameter probability density estimation.If sample set {x}is obtained by n independent sampling base on nuclear function f (x).The density function estimation is: Then, weight coefficient wmeets the limit condition ∑ Wi = 1.If nuclear H (•) is a shadowing nuclear of some nuclear K (•).The mean bias vector is: (6) M (x) is sampling mean at x.The iterative process for data to move to sampling mean, x←m (x), becomes the mean shift algorithm.The positions of x, which is sequence {x, m (x), m (m (x)),…}, are called as distance of x.The mean shift vector in formula ( 6) is positive proportion to gradients of f (x).
Visual target tracking is to find the object in varied frames.To effectively descry the target, select proper character space F. Use X to indicate image coordinate space, called as position performed space; tracking window to be to indicate possible target area; target mode is tracking target and using symbol with wave line to indicate correlative variants.To image of target model and tracking window, the distance between observer and object can also be reflected.The bigger distance is, the more information is.Therefore, the sizes can be expanded or reduced according to different information contents.The available information can be given by {x i , u i } N i = 1 , of which x i ∈ X'; u i ∈ F , N is the number of pixels in tracking window and target model.
The core study is modeling the target with such information.The shapes and appearances including color distributions are usually complex; the target may transform, parts or the whole are covered, etc; the sizes will change as its distance to camera changes.All those make the modeling difficult.The tracking method base on mean shift can solve the problems above.In the new image, we should calculate its Mass center to find the target needed.The method is to select the calculation area bigger than previous one.Calculate the new mass center in following formula: x n 1 yI(x, y) ( 8) The sizes will change as the distance to camera.A key problem is to regulate the sizes of tracking window.In the tracking methods base on mean shift, if the size is too big, with the too much background, the algorithm will be influenced by background, which makes incorrect tracking; it the size is too small, the result will fluctuate around the true extreme point, which is difficult to find the true position.
In following frames, we consider the mass center in last frame and sizes of searching window as their inputs.Conduct Mean Shift mass centers convergence to find the target.Realize the tracking algorithm in such cyclic.
The convergence rate is influenced by the following factors: Character select, which is the division of grey level.The more painstaking the grey level is, the slower the calculation rate is, the better effect is and the stronger the interruption-resistant is.Otherwise, the convergence ratio is faster but the interruption-resistant is weaker.
The different nuclear function has different calculation time.
The sizes of windows affect the bandwidth of tracker.Ignoring the compute time, the bigger the size is, the bigger the bandwidth is.But the bigger one will take more time.
The difference between the iteration has an effect on the velocity mean shift.The bigger the difference is, the bigger the velocity is.With the iteration times increasing, approximate to 1, the shift step will become very small, approximate to 0.
The convergence of Mean Shift owes to the gradient increasing.But, move towards the sectional gradient direction can only promise convergence in unlimited small iteration.The step size is very important: if it is too large, the algorithm will be scattering; if it is small, the convergence ratio is small.But Mean Shift uses adaptive step, no need to conduct other procedures to search proper step size (for example, steepest descent method needs searching optimal step size).It is an advantage.
Though above analysis, we should compromise among precision, anti-interference ability and real-time performance to find proper parameters.

DETECT EDGE IN HOUGH
Introduction: Hough transformation is the most effective method in curve detective area.
Hough transformation is proposed by Paul Hough in 1962, which conduct straight line detect by mapping image space to parameter space.Its basic idea is to use duality of point and line: the points in the same line in image space correspond to intersecting lines in parameter space; the lines intersecting in a point in parameter space corresponds to the points in a same line in image space.Detect the lines in image space by summarizing the number of lines for each point to cross (Wufang, 2000).
Hough transformation provides a new and effective method, which is applied widely.To use it in a deeper way for detecting other forms of curves, many scholars have done a lot and obtain many performances.It should be noted, the simple forms of straight line function makes it successful.A straight line can be described as y = ax+b.The mapping form is simple.The statistic is only conducted in two-dimensional space, with small calculation content.
Hough transformation has been applied to auto monitoring, shortage judgment of production parts, auto monitoring of production and CAM, etc.Such as mechanic parts detect and positioning system base on Hough transformation; industrial production detective system feature as straight line or curves base on Hough transformation (Wang et al., 2005).

Basic principle:
To conduct edge detect, firstly, distract edge information from original image.Transform it into a binary edge outline image.Then mapping it into straight line b = -xa+y in Hough parameter space.After drawing the straight line in parameter space, conduct statistic in each point.The value of point indicates the number of lines for such point to cross in parameter space.
In specific operations, usually use normal type.Because when the line is parallel to y axis, an in y = ax+b will next to infinite, no method to conduct statistic in parameter space.But the normal type can detect such lines.The normal type in image space x-y is shown as: ρ is the distance between straight line L to origin; θ is the angle between straight line L and x axis.According to the formula above, different points in L in parameter plane ρ-θ are transformed into a series of sinuous curves intersecting at t. Obviously, if t is solved, the detect is completed.In practical calculation, according to data points in image space, calculate the sinuous curve distance in Hough parameter space.Conduct 2dimensional statistic in parameter plane.Select the peak.Such peak is a straight line in image space, so as to realize straight line detect in image space.

JUDGMENT ON OUT OF EDGE BASE ON MEAN SHIFT
The basic function of this design is to track tennis base on Mean Shift, detect straight line in Hough principle, program in vc++ and judge whether the tennis is out of edge.Specifically, get dynamic video or video file in camera.Demonstrate video image on the window body.Transform dynamic video into sequence video.Meanwhile, with Hough straight line detective principle, display the result in window body.Circle the edge.Go on tracking until judging the tennis is out of edge.Then stop.

Realization process:
• Build a tennis color model: Firstly, build a tennis color model.Change the color histogram to form the target model base on weight color distribution figure.The contrast similar intensity between those of target model and particle area, as the references for positioning the target, makes the matching more reasonable.To particle degradation problem, particle re-sampling method base on Mean Shift iteration is proposed.It controls sampling number and area in BH coefficient and forms its adaptive regulation.On the basis of improving particle quality, control the number of particles, so as to eliminate particle degradation, reduce calculation co and content obviously and enhance the real-time performance.
Transform each pixel from RGB space into HSV space.Then conduct statistic on its H. Build H histogram.Take it as color distribution of target.Then x is the distance between some point to area center.Then the center's target color distribution at y c base on such weight function can be indicated as: In kth frame image, we select target in the same way.The color histogram is shown as Fig. 1: • Tracking algorithm description: The procedure can be described as: Step 1: Set the whole image as searching area.
Step 2: initialize size and position of Search window.• Specific realization: Step 1: Get each frame of video in track box of Mean Shift.Track the coordinates of center.Link each neighboring frames.Solve the incline ratio of its straight line section.Get the maximum changing ratio of incline ratio in some frame.Then the land point can be obtained and note that coordinate.
Step 2: Calculate the distance between point and straight line according to the land point in step1 and straight line detected by Hough transformation.
Step 3: Judge whether the tennis is out of edge by judging the distance in step2.When the distance is positive, the tennis is within the edge.
Otherwise it is out of edge, shown as Fig. 2.
Figure 2 is to track motion target, which is tennis, base on Mean Shift and detect the straight line in Hough, which is the edge.conclusion on mean shift: • Tennis motion distance tracking in ideal situation: Ideal situation refers to single background, stable environmental ray and small moving velocity.At that time, Mean Shift can promise tracking the motion of target.The angles' changing can also be shown.But it only can be realized in ideal situation • Prospect and later main content: Mean Shift has certain limits.There are many situations causing tracking errors, such as someone across background; flash ray, too dim environment.When the light is low, saturation is also low (near s0).The hue's noise will be great.Because in such environment, data is discrete and very small, the pixel values are difficult to transform to RGB color space completely.It will result in big fluctuation.
To solve such problem, we ignore the color pixel with low luminance.That is to say, when the situation is too dim, the camera should automatically regulate or enhance luminance.
Otherwise tracking is impossible.The target select is also limited.It is easy to track target with bright colors.But it is easy to lose a piece of white paper, which is because the H is too low.

CONCLUSION
This study completes tennis motion distance tracking in Mean Shift and judge whether it is out of edge.In the process, we find the result still have some distances to credible tracking.The shortages and limits should be realized in future.
This study applies Mean Shift into RGB image.Model in direction histogram and propose target tracking algorithm centering on Mean Shift.The results show, this algorithm isn't influenced by light.In low contrast intensity, it can realize stable and real-time tracking.As a key technology, target detect in complex background is very important, combining with frame information to distract motion target.Video tracking develops fast in recent years, applied to transportation, medicine, military area, etc.Its prospect is broad.And it definitely has better applications in sports.
It models in statistic histogram.It approximately indicates the probability density functions of character distributions in image area.The histogram of target model is written as p; its position is written as p (y).The target position is the observation window coordinate y when p (y) reaches its maximum (or sectional maximum).Considering the conveniences, the character usually is m-level quantified.Then select target according the existing sample color histogram.Calculate the color histogram of target.Among varied color spaces, only H in HSV space (or similar one) can indicate color.So in specific calculations, firstly, transform values in other color spaces into HSV space.Then calculate 1D histogram on H. Calculate the target's histogram.It's a color probability distribution.The peak is the strongest color value.Its surrounding is the edge color.Then the histogram will be kept until stopping tracking or changing target.Then, we project the histogram into next frame.The color of last histogram is shown in the new image.It is its probability distribution in the new frame.It should consider H.The area of H is [0,360], which can't be indicated in a byte.To indicate in a byte, H should be quantified in a proper way.We quantify it into [0,255].

X
Y) is the new mass center.Move the center of calculation area to it.Go on calculating the mass center, until the bias of twice smaller than a certain value.That process is called as Mean Shift.

Fig. 1 :
Fig. 1: Target color histogram add weights of color probability distribution figure.Set different weight values according to its distance to center.x is the distance between some point to area center.Then the center's target color distribution at y c base on such weight function can be indicated as: ) n = The number of pixels in target area b(x i ) = The color index function at xi δ = Dulac function C q = Normalization coefficient.u = Characteristic value of target image, u = 1,.., m.Parameter d = (w, h), indicating the size of target area.K is weight function, whose select conforms to declining weights tactic.Generally, concave function declining strategy is prior to linear one, but linear one is prior to convex function strategy.

Step 3 :
calculate color probability distribution in Search window.The size of such area should be bigger than that of Search window.Step 4: Function Mean Shift.Get new position and size of Search window.Step 5: In next image, initialize position and size of search window in values from step 4. Jump into step 3 and go on operating.

Fig. 2 :
Fig. 2: Track motion target base on Mean Shift • Detect straight line in Hough transformation: A point in original image coordinates corresponds to a straight line in parameter coordinates.Likely, a straight line in parameter coordinates corresponds to a point in original coordinates.Then, all points of the straight line are demonstrated in original coordinates, whose incline ratio and intercepts are the same.Therefore, they correspond to a same point in parameter coordinates.After projecting all points in original coordinates into parameter coordinates, see if there is a convergent point, which corresponds to the straight line in original coordinates.In practical application, the equation y = k*x+b can't indicate the straight line formed as x = c.So in reality, use parameter equation p = x*cosθ+y*sinθ.Then, a point in image plane corresponds to a curve in p-θ plane.Others are the same.In this design, detect straight line in Hough transformation.And get the coordinates of start and end of the straight line.Get its equation: (y-y1)/ (y2-y1) = (x-x1)/(x2-x1).

TENNIS MOTION DISTANCE TRACKING BASE ON MEAN SHIFT Color visual target tracking technology: Video
. Calculate the object in this image as the new source figure.Analyze the next image.