Git Product home page Git Product logo

bgrm's People

Contributors

blueokiris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bgrm's Issues

Mention dependency, TypeError

Hi, thanks for making this, it would be very useful to use it in Teams!

Just wanted to mention that pip is not listed as a dependency, and it is not always included in the python package depending on the distribution; i.e. on Arch there's python and python-pip separately.

Also, after running make and running the script, I get:

sudo ./bgrm.sh
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Format loopback format result (0 good): 0
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/fra/bgrm/bgrm/__main__.py", line 4, in <module>
    main()
  File "/home/fra/bgrm/bgrm/bgrm.py", line 47, in main
    frame, noBgFrame = cam.getFrame()
TypeError: getFrame() missing 1 required positional argument: 'bgImg'

reporting a few issues I have had on openSuse tumbleweed

Hello!

I have tried to build and use bgrm on my machine, I was very excited to try it out :-)

First problem was that I could not build the kernel module and the output was not too helpful. Later on I realized that I haven't had the kernel headers to build the module. On openSuse it should be enough to install the kernel-devel package, but I have installed the kernel-sources package and that installed kernel-devel as dependency. After this the kernel module build was successful, perhaps mention this in the Readme.

The next problem was when running bgrm.

...
cp: cannot create regular file '.venv/lib/python3.9/site-packages/v4l2.py': No such file or directory
...

I verified the path manually and for some reason on my machine the path is with python3.8 not python3.9:
.venv/lib/python3.8/site-packages/v4l2.py

So I edited that path in bgrm.sh and tried again, but this time it complained that opencv-python is not installed:

$> sudo ./bgrm.sh -b ~/Pictures/Teams/ISS-cupola.webp -H 720
Traceback (most recent call last):
  File "/usr/lib64/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/user/Applications/bgrm/bgrm/__main__.py", line 1, in <module>
    from bgrm import main
  File "/home/user/Applications/bgrm/bgrm/bgrm.py", line 8, in <module>
    pkg_resources.require("opencv-python<=4.4.0.46")
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 886, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'opencv-python<=4.4.0.46' distribution was not found and is required by the application

However, when I try to install it manually, it the requirement appears as satisfied:

sudo /home/user/Applications/bgrm/.venv/bin/python -m pip install opencv-python
Requirement already satisfied: opencv-python in ./.venv/lib64/python3.8/site-packages (4.4.0.46)
Requirement already satisfied: numpy>=1.17.3 in ./.venv/lib64/python3.8/site-packages (from opencv-python) (1.21.3)

So now I'm not too sure what to do anymore, any ideas would be helpful!

And last but not least: thanks a lot for doing this!

Error on Fedora 34: OSError: [Errno 25] Inappropriate ioctl for device

Getting an error while running / loading it. Looks like the cam comes online, then it crashes. I did a fresh clone of the repo just to make sure there wouldn't be any odd things with it.

bgrm on  main took 7s 
❯ sudo ./bgrm.sh --blur                     
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
  File "/usr/lib64/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/hugh/git/bgrm/bgrm/__main__.py", line 4, in <module>
    main()
  File "/home/hugh/git/bgrm/bgrm/bgrm.py", line 28, in main
    formatVirtualCamera(settings, virtCam, cam)
  File "/home/hugh/git/bgrm/bgrm/bgrm.py", line 66, in formatVirtualCamera
    ioctl(virtCam, VIDIOC_S_FMT, format)
OSError: [Errno 25] Inappropriate ioctl for device

On wayland: could not connect to display

Hey,

very nice project!

I was able to bring it to run on xorg (on another laptop), but not on wayland. I am seeing this error:

INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
qt.qpa.xcb: could not connect to display :1.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/path/build/sources/bgrm/.venv/lib/python3.9/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

I tried setting DISPLAY to other values (e.g. WAYLAND_DISPAY). Could these envvars be relevant?

QT_QPA_PLATFORM=wayland
QT_WAYLAND_DISABLE_WINDOWDECORATION=1

Is it even supposed to run on wayland?

Request: compile using nuitka

In the past Ive had great success in compiling binaries from python scripts using nuitka.
This would be great as it will help to get rid of any python dependencies.

Inappropriate ioctl for device error

Hi, I'm having trouble actually getting this set up. I get this error when I try to run the bgrm script:

INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/Desktop/Misc./Software/bgrm/bgrm/main.py", line 4, in
main()
File "/home/Desktop/Misc./Software/bgrm/bgrm/bgrm.py", line 28, in main
formatVirtualCamera(settings, virtCam, cam)
File "/home/Desktop/Misc./Software/bgrm/bgrm/bgrm.py", line 66, in formatVirtualCamera
ioctl(virtCam, VIDIOC_S_FMT, format)
OSError: [Errno 25] Inappropriate ioctl for device

A few weeks ago, I was able to get this running after testing out some other solutions, like linux-fake-webcam; however, it would work on zoom, but not teams, which was my target application. Now I'm not getting it to work at all. Any help would be much appreciated.

low fps when using

i get ~6 fps with bgrm and 30 without, my specs are :
❯ neofetch

OS: Gentoo/Linux x86_64
Host: ROG Strix GL10CS 1.0
Kernel: 5.10.61-gentoo-x86_64
Uptime: 58 mins
Packages: 1106 (emerge)
Shell: zsh 5.8
Resolution: 1920x1080
WM: i3
Theme: Adwaita [GTK2/3]
Icons: Adwaita [GTK2/3]
Terminal: st
Terminal Font: JoyPixels
CPU: Intel i7-9700K (8) @ 4.900GHz
GPU: NVIDIA GeForce GTX 1660 Ti
Memory: 1055MiB / 7880MiB

Cannot install with pipx

I cannot use pip, as the system-wide Python installation is managed by the system package manager:

❯ pip install bgrm
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

which is fine, but I cannot even use pipx as it doesn't recognize any application in the package:

❯ pipx install bgrm
Note: Dependent package 'numpy' contains 3 apps
  - f2py
  - f2py3
  - f2py3.11
Note: Dependent package 'fonttools' contains 4 apps
  - fonttools
  - pyftmerge
  - pyftsubset
  - ttx

No apps associated with package bgrm. Try again with '--include-deps' to include apps of dependent packages, which are listed
above. If you are attempting to install a library, pipx should not be used. Consider using pip or a similar tool instead.

I'm not sure how pipx recognizes applications inside a package.

Operands could not be brodcasted together

❯ python -m bgrm --camera 3 --bg webcam_background.jpg  
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "$HOME/.pyvenv/bgrm/lib/python3.11/site-packages/cv2/qt/plugins"
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Format loopback format result (0 good): 0
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "$HOME/.pyvenv/bgrm/lib/python3.11/site-packages/bgrm/__main__.py", line 4, in <module>
    main()
  File "$HOME/.pyvenv/bgrm/lib/python3.11/site-packages/bgrm/bgrm.py", line 20, in main
    _frame, no_bg_frame, stacked_frames = cam.frames()
                                          ^^^^^^^^^^^^
  File "$HOME/.pyvenv/bgrm/lib/python3.11/site-packages/bgrm/cam.py", line 61, in frames
    no_bg_frame = self._segmentor.removeBG(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/.pyvenv/bgrm/lib/python3.11/site-packages/cvzone/SelfiSegmentationModule.py", line 34, in removeBG
    imgOut = np.where(condition, img, imgBg)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: operands could not be broadcast together with shapes (720,1280,3) (720,1280,3) (960,1280,3) 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.