https://github.com/poloclub/greenscreen-coordinates
Homography-based Method to Compute Green Screen Coordinates
https://github.com/poloclub/greenscreen-coordinates
Last synced: 5 months ago
JSON representation
Homography-based Method to Compute Green Screen Coordinates
- Host: GitHub
- URL: https://github.com/poloclub/greenscreen-coordinates
- Owner: poloclub
- License: bsd-3-clause
- Created: 2023-07-13T22:37:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-15T00:08:53.000Z (over 2 years ago)
- Last Synced: 2024-05-12T00:47:37.507Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 146 KB
- Stars: 0
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Homography-based Method to Compute Green Screen Coordinates
## What does this code do?
The Python program [gs_homography.py](gs_homography.py) computes the coordinates of the 4 corners of the green screen on each video frame in the videos of the [multi-object tracking scenario in Armory](https://github.com/twosixlabs/armory/blob/master/armory/data/adversarial/carla_mot_dev.py), **assuming accurate green screen coordinates are present on the reference frame of the video**.The reference frame can either be the first frame of the video, or explicity provided as a [parameter](homography.json).
## Why write this code?
We develop this program because we have observed that the existing green screen coordinates are not stationary in the virtual world of some video frames, causing the green screen (or patch that would be placed on the green screen) to "move."## What does the program do the video frames and green screen coordinates?
The program copies the original videos from a user-provided path (i.e., the "old" dataset), to a new location at a path provided the user (we call this the "new" dataset), and computes and stores the computed green screen coordinates in the new dataset as calculated according to the parameters provided in [homography.json](homography.json).The program also visualizes the green screen coordinates of the old data as red dots and new data as yellow dots. The video frames with the visualized coordinates are stored in the `rgb_w_coords` subfolder within each video folder at the new dataset's path. Below we show an example of how the coordinates may be corrected by the program ("before" in red vs "after" in yellow).

## How to run the program?
```bash
python3 gs_homography.py {json file}
```While running the program it is necessary to ensure the reference frames from `old_data` have accurate green screen coordinates