https://github.com/daschr/cl-backgen
Generate background images from videos using opencl and pixel averages.
https://github.com/daschr/cl-backgen
background-subtraction computer-vision opencl python videos
Last synced: 9 months ago
JSON representation
Generate background images from videos using opencl and pixel averages.
- Host: GitHub
- URL: https://github.com/daschr/cl-backgen
- Owner: daschr
- License: mit
- Created: 2021-02-27T19:16:17.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-27T19:17:52.000Z (over 5 years ago)
- Last Synced: 2025-03-28T20:17:10.516Z (over 1 year ago)
- Topics: background-subtraction, computer-vision, opencl, python, videos
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Background Generator
* generates a static background image from videos
* uses a opencl kernel which calculates pixel changes by comparing a frame with an history of frames
* optional video deflickering (`--deflicker`) before backsub processing
# Requirements
## Windows
* install [python](https://www.python.org/downloads/windows/)
* `pip install numpy opencv`
* install pyopencl
* `pip install pyopencl` or
* download the right wheel from [here](https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopencl) and f.e. `pip install pyopencl‑2021.1+cl21‑cp39‑cp39‑win_amd64.whl`
## Linux
* `pip install -r requirements.txt`
# Usage
* `python backgen.py --input ` -- generates a background image with default weight and threshold
```
usage: backgen.py [-h] [--input INPUT] [--output OUTPUT] [--vidoutput VIDOUTPUT] [--weight WEIGHT] [--threshold THRESHOLD] [--silent [SILENT]] [--sidebyside [SIDEBYSIDE]] [--deflicker [DEFLICKER]]
This program generates a static background image from videos using an opencl kernel which calculates pixel values based on averages.
optional arguments:
-h, --help show this help message and exit
--input INPUT Path to a video or a sequence of image.
--output OUTPUT Save the last frame to this path
--vidoutput VIDOUTPUT
Write video to path
--weight WEIGHT the weight which a new image gets merged into (0;inf]
--threshold THRESHOLD
threshold which an pixel is seen as changed [1;255]
--silent [SILENT] silent mode, do not show images
--sidebyside [SIDEBYSIDE]
show the generated background and the newest frame side by side
--deflicker [DEFLICKER]
deflickers frames before processing them with backsub
```