fiblan / webcam-virtual-background Goto Github PK
View Code? Open in Web Editor NEWEnjoying web conference with virtual backgrounds on linux
Enjoying web conference with virtual backgrounds on linux
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?
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.
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
Right today a new Tensorflow Runtime has been launched, claiming much faster and lighter execution. A test might be interesting...
and /dev/video0 is the physical webcam
How do you specify the physical webcam?
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.
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.
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.
(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)
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/bin/webcam-virtual-background-master/bodypix$ node app.js
v14.1.0
rich@myarch:
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.