Skip to main content

Background Remover

The Need

It's been good long while since Microsoft first released a Teams version for Linux and yet, one of Teams' coolest features doesn't exist in said Linux version: removable backgrounds. As someone who uses Linux for their daily driver, this annoys me.

Well, I'm an engineer, so of course, I found a solution.

Using OpenCV and a v4l2loopback device (basically a virtual webcam you can write data to), I threw together a Python application that takes your normal webcam input, removes and replaces the background, and outputs that to the created video device. Problem solved :)

Note, this will work anywhere WebCams are used, not just Teams

How to Use

Dependencies: - python >= 3.8 (3.10 is what's supported officially) - pip - v4l2loopback

Setup:

  1. Configure v4l2loopback (may not be necessary):
    • Recommended something like this:
    export DEVICE_ARR=(`ls /sys/devices/virtual/video4linux | tr -d 'video'`); \
    sudo modprobe v4l2loopback \
        devices=1 exclusive_caps=1 video_nr=${DEVICE_ARR[1]} max_buffers=2 \
        card_label=v4l2lo
    
  2. Install with pip install bgrm

Then, you can run:

  • Run with python -m bgrm <options> (use --help to see all options)
  • Example: python -m bgrm -b ~/Pictures/Wallpapers/ni-skyline-wallpaper.png -w 320 -H 240 -s 2.0

Build from Repo

You can also build the package yourself from source (or grab the latest version from the releases tab)

To do that you need the "poetry" build system.

Run poetry build and install the whl from the dist/ folder

Metadata

Release files for bgrm 8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bgrm 8
File Size Uploaded Provenance Actions
bgrm-8.tar.gz 17.4 kB Without provenance Details for bgrm-8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bgrm 8
File Interpreter ABI Platform Actions
bgrm-8-py3-none-any.whl Python 3 none any Details for bgrm-8-py3-none-any.whl

Total release size: 35.5 kB

Release files / bgrm-8.tar.gz

Download URL bgrm-8.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
11d68dddd44e88882532f4c5481457cec387a5cca6adb75d7bb5db16f965adf0
BLAKE2b-256 checksum
How to use checksums
d5b40334e3545f46c5a6df5336e758167722ab9176ddc603e9068d3d6c1c5011
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / bgrm-8-py3-none-any.whl

Download URL bgrm-8-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b66d5238055d5f7cd27b18ec53f204269fdee8e4f9e3b9a01977d388cd1d7756
BLAKE2b-256 checksum
How to use checksums
e06be95551a7cbc710115c8b91d69b6c05fddea74b11985fbc58eaa3f7b2fe2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Security for bgrm 8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page