From 16ccf75a8aa3f9d1353894f646f08418e0951c7f Mon Sep 17 00:00:00 2001 From: Alessandro Cauduro Date: Thu, 9 Apr 2020 11:21:27 -0300 Subject: [PATCH] Correct readme and read command line parameters --- README.md | 11 +++++++---- faceit_live.py | 13 +++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3f4aef5..0ae6237 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,6 @@ $ sudo modprobe v4l2loopback exclusive_caps=1 card_label="faceit_live" video_nr= $ v4l2-ctl -d /dev/video1 -c timeout=1000 ``` -# v4l2loopback-ctl set-timeout-image caio.png /dev/video1 - Change the video_nr above in case you already have a webcam running on /dev/video1 @@ -100,13 +98,18 @@ Put in the `./media/` directory the images in jpg/png you want to play with. $ python faceit_live.py ``` -## Parameters +## Shortcuts --webcam # the videoid of the Webcam e.g. 0 if /dev/video0 (default is 0) --image # the face to use for transformations, put the files inside media (by default it loads the first image in the folder) --streamto # the /dev/video number to stream to (default is 1) ## Example ``` -$ python faceit_live.py --webcam 0 --stream 1 --image oliver.jpg +$ python faceit_live.py --webcam_id 0 --stream_id 1 ``` +## Shortcuts when running +``` +N - cycle next image in media folder +C - recenter webcam +``` \ No newline at end of file diff --git a/faceit_live.py b/faceit_live.py index e6a0ece..96961ad 100644 --- a/faceit_live.py +++ b/faceit_live.py @@ -14,18 +14,27 @@ import pyfakewebcam import pyautogui import os import glob +from argparse import Namespace +import argparse warnings.filterwarnings("ignore") ############## setup #### stream = True media_path = './media/' model_path = 'model/' -webcam_id = 2 + +parser = argparse.ArgumentParser() +parser.add_argument('--webcam_id', type = int, default = 2) +parser.add_argument('--stream_id', type = int, default = 1) +args = parser.parse_args() + + +webcam_id = args.webcam_id webcam_height = 480 webcam_width = 640 screen_width, screen_height = pyautogui.size() -stream_id = 1 +stream_id = args.stream_id first_order_path = 'first-order-model/' sys.path.insert(0,first_order_path) reset = True