Introduction


This project aims to use the Shooting Method and other numerical methods to calculate the vertical and horizontal velocities needed for an object to hit a target, based on given conditions and motion differential equations.

Playing Numerical Shooting Game


<aside>

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

Input: Image of a randomly scattered targets.

</aside>

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

Output: Animation simulating shooter hitting targets.

</aside>

image.png

</aside>

Problem Formulation


Identify scattered targets in an input image using image processing, then sequentially shoot down each target from a fixed shooter’s position. The projectile motion is governed by ODEs considering gravity and drag. The process includes target identification, trajectory simulation, and animated visualization of the projectile hitting each target.

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

<aside>

Algorithm Formulation


Target Extraction

Processing Logic

  1. Load and Pre-process Image:

    Begin by loading the RGB image, truncating it to specific height and width if necessary and then converting it to grayscale and apply blur if necessary. This reduces computational complexity, allowing for faster processing speed.

  2. Edge Detection:

    Apply an edge detection technique, such as the Sobel Matrix, to highlight the boundaries of objects. Given that the input image doesn't feature a complex background, the choice of kernel has minimal impact on the result.

  3. Clustering with DBSCAN:

    Use DBSCAN to cluster the edge-detected points. This helps in identifying distinct target balls, allowing for the calculation of their centers and radii.

Implementation

We can encapsulate related methods within a class. This approach separates method calls logically and avoids cluttering the main codebase. For this purpose, an Image_Processor,DBSCAN and TargetExtractor classes has been implemented in object_detection.py.

Example