opencv 运动追踪
介绍 (Introduction)
In my previous work, I used pre-trained Yolov3 model to detect and used SORT (simple online and realtime tracking) to track football players from video. Then I used OpenCV’s getPerspectiveTransform function to convert the video to bird’s-eye view.
在我以前的工作中,我使用了预先训练的Yolov3模型来检测并使用SORT(简单的在线和实时跟踪)从视频中跟踪足球运动员。 然后,我使用OpenCVgetPerspectiveTransform函数将视频转换为鸟瞰图。
One of the problems of this work is that the model cannot tell the difference between teams. It will be good if the program is able to identify players’ team instead of just detecting ‘person’. To further improve this, I wish to include a function which tells the difference based on the colors of players’ jersey.
这项工作的问题之一是模型无法区分团队之间的差异。 如果程序能够识别玩家的团队而不仅仅是检测“人”,那将是很好的。 为了进一步改善这一点,我希望包含一个功能,该功能根据球员球衣的颜色来区分差异。
Two approaches I can think of now to this problem.
我现在可以想到两种解决这个问题的方法。
- Train an object detection model using custom dataset containing 3 classes — the players of two teams and referees. This approach might not be practical for real application because one has to train a specific model before every match. 使用包含3个类的自定义数据集训练对象检测模型-两个团队的球员和裁判。 这种方法对于实际应用可能不切实际,因为必须在每次比赛之前训练一种特定的模型。
- Use to current object detection model and extract the color information from the detections. Based on that I can identify the color of players’ jersey. 用于当前物体检测模型并从检测中提取颜色信息。 基于此,我可以识别球员球衣的颜色。
I decided to try approach 2 using OpenCV.
我决定尝试使用OpenCV方法2。
足球视频 (Football video)
The stationary football video is downloaded from