Giter VIP home page Giter VIP logo

webcam-virtual-background's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

webcam-virtual-background's Issues

Issue running faky.py (with python 3.9.7) / app.js

when I run ./install.sh, I get
ERROR: Could not find a version that satisfies the requirement opencv-python==4.2.0.32
ERROR: No matching distribution found for opencv-python==4.2.0.32

And later on, when I run fake.py with python 3.9, I get the following:
(venv) :/home/markus/webcam-virtual-background-master/fakecam# python fake.py Traceback (most recent call last): File "/home/markus/webcam-virtual-background-master/fakecam/fake.py", line 2, in <module> import cv2 ModuleNotFoundError: No module named 'cv2'
Why?

a few hints...

Thank you Fiblan for sharing. This is a very interesting project, with lots of suggestions.
I added a few "issues" providing some (hopefully) useful hints.

Fixing errors with N-API during installation or at first run

Hello Fiblan!
Nice to meet you here again.
A few suggestions for newbies like me, if I'm allowed.
If you get an error when running install.sh, such as:
The N-API version of this Node instance is 1. This module supports N-API version(s)...
then node.js needs an upgrade. I would suggest installing nvm and using it to update node:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
nvm install node v10.16.3
node --version

then rebuild the tensorflow module for node.js:

cd bodypix
npm rebuild @tensorflow/tfjs-node build-addon-from-source

New Tensorflow Runtime?

Right today a new Tensorflow Runtime has been launched, claiming much faster and lighter execution. A test might be interesting...

Background compatibility

If your mask is not well fitting your head, try to choose a background picture that fits the amount of light in your real room. In particular, if the room is well illuminated, with a light background, try to find a picture that matches it. On the other hand, if your background is a bit darker, find a dark picture.

Why not multithreading?

I would suggest to change the socket communication to multithread processing, with a thread that computes the mask and the other that composes the mask with the background.
The overall computation speed and overload should improve dramatically.

Fix for slow background updating

Some notebooks may be very slow (my notebook is a bit old, for example), so it might be better to change the interval between two "samples" of the foreground mask. Otherwise the background/background border will be updated too slowly.
Unless Master Fiblan decides to add a controllable parameter to the application, in order to change such interval we have to modify the code a little bit:

cd fakecam
vi fake.py

go to row 91
change 30 to a more suitable value (for my veeery slow notebook, I changed it to 1).
close and run as per instructions.

[Suggestion] video as a background

(this is easy!) adding the possibility to use a video file (in "loop") or a video from a second camera as the background. Loop-ing a (background) video can be obtained by adding a simple control when retrieving each frame from the (background) video. Something like:

ret, frame = cap.read() 
    if ret:
        cv2.imshow("Image", frame)
    else:
       print('no video')
       cap.set(cv2.CAP_PROP_POS_FRAMES, 0)

node core dumps with illegal instruction

Hello. I really like the idea of this project. Trying to follow your non-Docker instructions.
Here is the result of install.sh
rich@myarch:~/bin/webcam-virtual-background-master$ ./install.sh
Defaulting to user installation because normal site-packages is not writeable
Collecting numpy==1.18.2
Using cached numpy-1.18.2-cp38-cp38-manylinux1_x86_64.whl (20.6 MB)
Collecting opencv-python==4.2.0.32
Using cached opencv_python-4.2.0.32-cp38-cp38-manylinux1_x86_64.whl (28.2 MB)
Requirement already satisfied: requests==2.23.0 in /usr/lib/python3.8/site-packages (from -r fakecam/requirements.txt (line 3)) (2.23.0)
Collecting pyfakewebcam==0.1.0
Using cached pyfakewebcam-0.1.0.tar.gz (12 kB)
Requirement already satisfied: chardet>=3.0.2 in /usr/lib/python3.8/site-packages (from requests==2.23.0->-r fakecam/requirements.txt (line 3)) (3.0.4)
Requirement already satisfied: idna>=2.5 in /usr/lib/python3.8/site-packages (from requests==2.23.0->-r fakecam/requirements.txt (line 3)) (2.9)
Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.8/site-packages (from requests==2.23.0->-r fakecam/requirements.txt (line 3)) (1.25.9)
Installing collected packages: numpy, opencv-python, pyfakewebcam
Running setup.py install for pyfakewebcam ... done
Successfully installed numpy-1.18.2 opencv-python-4.2.0.32 pyfakewebcam-0.1.0
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
audited 167 packages in 1.536s
1 package is looking for funding
run npm fund for details
found 0 vulnerabilities

I created my v4l2loopback on /dev/video20 and modified fake.py line 24.
I get this error when attempting to run 'node app.js':
rich@myarch:/bin/webcam-virtual-background-master/bodypix$ node --version
v14.1.0
rich@myarch:
/bin/webcam-virtual-background-master/bodypix$ node app.js
Illegal instruction (core dumped)

I've never used node.js or Docker before. Any guidance on debugging this? Any commands I could issue to give you more information?
Regards,
RichM

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.