Recognition of a volleyball ball in video from drone / Habr

Last year, I had fun for the tracking of a volleyball ball using the removal of the OpenCV background with the analysis of the trajectories and even made a service that, based on this information, cuts out boring moments from …

Recognition of a volleyball ball on a video from a drone

Last year, I had fun for the tracking of a volleyball ball using the removal of the OpenCV background with the analysis of the trajectories and even made a service that, based on this information, cuts out boring moments from the game.

The main feedback was – what a stone age to use old -school technologies, you teach a neural network and drove. I tried, but did not take off – very often the ball is so blurred that even with a human eye it can not be distinguished from a random blot, and even a simple binary classifier does not give stable results, which is already talking about detectors and other Yolo.

In general, I threw out this business, but in the spring I started a drone and, of course, the first thing I adapted for volleyball filming. If you raise it to the desired height (12-15 meters), the entire site enters the frame, which gives directly unlimited opportunities for analysis.

The drone camera rests on the hymbal, which extinguishes the vibrations of the device and at the output a stable picture is obtained. I directed my recognition algorithm to this picture, but. Everything turned out to be not so simple.

Noise and no ball

In fact, the pictures from the drone are deceiving – the shaking of the device does not pass without a trace and although Gimbal is perfectly done by his work, the result is capable of deceiving a person, but not a soulless machine – shaking causes small fluctuations in the color of the pixels, and these vibrations are enough to confuse the recognition algorithms background.

For comparison – a similar feed with an old approach looks like this:

There is nothing to do, you will have to look for other approaches. We have OpenCV, so you still don’t have to go far. Instead of the background, we highlight the boundaries of the help of the Canni filter – and we have a black and white sketch for further parsing.

If you set the contour detector on it, everything works fine, the ball manages to hook. Then the trajectory detector is connected and the process goes as in the main algorithm.

And again, for comparison, the same fragment from a fixed camera with borders:

As you can see, the stick has two ends – on the shaking drone, the Canni filter gives the best results, and on a static chamber – generates the excess vonia on which the ball is lost.

But what will happen if these two approaches are combined? For a video from the drone, Cannie will first leave only the necessary figures, and then, you can remove the background.

It turns out the picture is not without noise, but it can already be filtered, and the ball is already visible.

The result is much better, the noise is less (but there is more) and the ball trajectory is recognized quite clearly.

Past articles on the same topic

After the first experience in recognizing sports movements, my hands were combined to do something else.

In the last article, I spoke about my approaches to recognize a volleyball ball in the game. The task is itself.

Not so long ago I wrote about volleyball service, now it's time to describe it from a technical point of ZR.

Related Posts