Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 2.1 KB

README.md

File metadata and controls

65 lines (48 loc) · 2.1 KB

2D-bouncing

Simple 2D dataset of bouncing balls

Requirements

Install the python dependancies (pip install -r requirements.txt) and imagemagick

Usage

To generate a dataset of N videos, run:

python src/generate_dataset.py N my_dataset_name

This will create a directory my_dataset_name with a directory per simulation:

.
└── my_dataset_name
    ├── config.yaml
    ├── 0000
    │   ├── config.yaml
    │   ├── positions.csv
    │   ├── frame_000.png
    │   ...
    │   ├── frame_099.png
    │   └── simulation.gif
    ....
    └── N
        └── ...

Each sequence contains a config.yaml file recording the simulation parameters.

Components

Made of 3 components:

  1. Script which generates a dataset of unique simulation parameters (generate_dataset.py). Edit parameter_space to define which parameters the dataset is created over.

  2. Script which takes in the simulation parameters (radius,speed,initial position, etc..), and calculates the position of the ball(s) at each timestep. (simulate.py)

  3. Script which takes the position and draws the ball(s) as an image

    E.g. ./drawCircle.sh 10 50 frame_0.png will draw a circle at (10,50)

    (images are 64x64)

There are also optional utility scripts to apply random obscuring objects (random_masking.sh), and random blurs (random_blurring.sh) to a generated dataset.

Initial proof-of-concept

  • White circle on black background
  • Ball bounces off image edges
  • Vary physical properties:
    • Starting position
    • Ball radius
    • Initial direction
    • Initial speed
    • Gravity
    • Ball mass (only relevent for ball-ball collisions)
    • Random ball intensity jitter
    • Random ball colour/background color
    • Add random ball jitter
    • Add gausian blur
    • Add multiple balls