Introduction


Intercepting a moving object is a fascinating challenge that combines physics, computational modeling, and animation. This project focuses on analyzing and simulating the interception of a moving ball. The goal is to develop a system that can predict the motion of a moving ball based on video input, calculate the necessary trajectory for a thrown ball to intercept it, and visualize the process through animation.

Playing Numerical Shooting Game


<aside>

<aside> <img src="/icons/sign-in_red.svg" alt="/icons/sign-in_red.svg" width="40px" />

Input: A video segment showing a object in motion.

</aside>

<aside> <img src="/icons/sign-in_green.svg" alt="/icons/sign-in_green.svg" width="40px" />

Output: An animation demonstrating the interception process, showing both the thrown ball and the moving ball's trajectories.

</aside>

</aside>

Problem Formulation


Develop a method to extract motion paths of objects from video frames, identify their centers, and model the motion using physical constraints governed by ODEs incorporating gravity and drag. Utilize the model to predict future positions over time and validate the predictions by simulating the object's trajectory along the anticipated path.

The process is broken into three main parts, focusing on extracting, calculating, and simulating key elements to hit targets accurately.

<aside>

Algorithm Formulation


Generated Video

For this specific example, the algorithm is highly sensitive to the input video. The motion path must exhibit a stable trajectory that adheres to the ordinary differential equations (ODEs) defined below. The algorithm is not designed to process arbitrary movement videos; it performs poorly, particularly for scenarios lacking opposing forces or those that model an idealized environment without external influences. For this reason I will be generating my own one with stable gravity, drag and fps.

<aside>

Generated Video

https://www.youtube.com/watch?v=1OYyFiDLVnA

</aside>

Motion Path Extraction

Processing Logic

  1. Load and Pre-process Image:
  2. Foreground Segmentation:
  3. Edge Detection:
  4. Contour Detection and Center Extraction:
  5. Visualization Enhancements:

Implementation

We can encapsulate logic within a single method. Method can be found in**intercept_moving_ball.py** .