Organized into python module
This commit is contained in:
parent
97a758bdb3
commit
9042afd82d
6 changed files with 14 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ node_modules/
|
|||
package-lock.json
|
||||
.mypy_cache/
|
||||
.vscode/
|
||||
*.egg-info
|
||||
|
|
|
@ -3,6 +3,7 @@ import cv2
|
|||
from pyfakewebcam import FakeWebcam
|
||||
import numpy as np
|
||||
from camera import Camera
|
||||
from argparse import ArgumentParser
|
||||
from signal import signal, SIGINT
|
||||
|
||||
def process_mask(m, shape):
|
||||
|
@ -29,7 +30,7 @@ def get_background(uri=None):
|
|||
backdrop = None
|
||||
if uri is not None:
|
||||
backdrop = cv2.resize(
|
||||
cv2.UMat(cv2.imread('/home/rozek/Pictures/IMG_20191013_181848.jpg')),
|
||||
cv2.UMat(cv2.imread(uri)),
|
||||
(h, w)
|
||||
).get().astype(np.uint8)
|
||||
else:
|
||||
|
@ -43,6 +44,14 @@ def stop(signal_received, stack_frame):
|
|||
running = False
|
||||
print("Stopping...")
|
||||
|
||||
parser = ArgumentParser(description="Virtual Backgrounds with Bodypix")
|
||||
parser.add_argument(
|
||||
"--background",
|
||||
type=str,
|
||||
help="The background to use. If not specified, will be a blur of the initial frame."
|
||||
)
|
||||
args = vars(parser.parse_args())
|
||||
|
||||
|
||||
# Start Camera
|
||||
camera = Camera()
|
||||
|
@ -56,7 +65,7 @@ if __name__ == "__main__":
|
|||
sock = ctx.socket(zmq.REQ)
|
||||
sock.connect('ipc:///tmp/bodypix')
|
||||
|
||||
background, (width, height) = get_background()
|
||||
background, (width, height) = get_background(args['background'])
|
||||
fake = FakeWebcam('/dev/video20', height, width)
|
||||
|
||||
running = True
|
BIN
bodypix-background/__pycache__/__main__.cpython-38.pyc
Normal file
BIN
bodypix-background/__pycache__/__main__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
bodypix-background/__pycache__/camera.cpython-38.pyc
Normal file
BIN
bodypix-background/__pycache__/camera.cpython-38.pyc
Normal file
Binary file not shown.
3
setup.py
3
setup.py
|
@ -7,6 +7,7 @@ setup(name="bodypix-background",
|
|||
install_requires=[
|
||||
"opencv-python~=4.2.0.34",
|
||||
"numpy~=1.18.3",
|
||||
"pyzmq~=19.0.0"
|
||||
"pyzmq~=19.0.0",
|
||||
"pyfakewebcam==0.1.0"
|
||||
]
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue