Added a separate --list-dcaps option.

This commit is contained in:
Emiliana 2020-09-26 20:43:06 +02:00
parent eaaf036e76
commit bee8e74cf2
3 changed files with 14 additions and 7 deletions

View file

@ -9,7 +9,8 @@ parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFo
parser.add_argument("-i", "--ip", help="Set IP address for sending tracking data", default="127.0.0.1")
parser.add_argument("-p", "--port", type=int, help="Set port for sending tracking data", default=11573)
if os.name == 'nt':
parser.add_argument("-l", "--list-cameras", type=int, help="Set this to 1 to list the available cameras and quit, set this to 2 to output only the names and to 3 to output camera names and device capabilities", default=0)
parser.add_argument("-l", "--list-cameras", type=int, help="Set this to 1 to list the available cameras and quit, set this to 2 or higher to output only the names", default=0)
parser.add_argument("-a", "--list-dcaps", type=int, help="Set this to -1 to list all cameras and their available capabilities, set this to a camera id to list that camera's capabilities.", default=None)
parser.add_argument("-W", "--width", type=int, help="Set camera and raw RGB width", default=640)
parser.add_argument("-H", "--height", type=int, help="Set camera and raw RGB height", default=360)
parser.add_argument("-F", "--fps", type=int, help="Set camera frames per second", default=24)
@ -67,15 +68,18 @@ if args.log_output != "":
sys.stdout = OutputLog(output_logfile, sys.stdout)
sys.stderr = OutputLog(output_logfile, sys.stderr)
if os.name == 'nt' and args.list_cameras > 0:
if os.name == 'nt' and (args.list_cameras > 0 or not args.list_dcaps is None):
import dshowcapture
cap = dshowcapture.DShowCapture()
if args.list_cameras == 3:
if not args.list_dcaps is None:
info = cap.get_info()
unit = 10000000.;
formats = {0: "Any", 1: "Unknown", 100: "ARGB", 101: "XRGB", 200: "I420", 201: "NV12", 202: "YV12", 203: "Y800", 300: "YVYU", 301: "YUY2", 302: "UYVY", 303: "HDYC (Unsupported)", 400: "MJPEG", 401: "H264" }
for cam in info:
print(f"{cam['id']}: {cam['name']}")
if args.list_dcaps == -1:
print(f"{cam['id']}: {cam['name']}")
if args.list_dcaps != -1 and args.list_dcaps != cam['id']:
continue
for caps in cam['caps']:
format = caps['format']
if caps['format'] in formats:

View file

@ -5,7 +5,7 @@ block_cipher = None
a = Analysis(['facetracker.py'],
pathex=['C:\\OpenSeeFaceBuild'],
binaries=[('dshowcapture/dshowcapture_x86.dll', '.'), ('dshowcapture/dshowcapture_x64.dll', '.'), ('escapi/escapi_x86.dll', '.'), ('escapi/escapi_x64.dll', '.'), ('run.bat', '.'), ('c:/windows/system32/msvcp140.dll', '.'), ('c:/windows/system32/vcomp140.dll', '.'), ('c:/windows/system32/concrt140.dll', '.'), ('c:/windows/system32/vccorlib140.dll', '.')],
binaries=[('dshowcapture/dshowcapture_x86.dll', '.'), ('dshowcapture/dshowcapture_x64.dll', '.'), ('escapi/escapi_x86.dll', '.'), ('escapi/escapi_x64.dll', '.'), ('run.bat', '.'), ('msvcp140.dll', '.'), ('vcomp140.dll', '.'), ('concrt140.dll', '.'), ('vccorlib140.dll', '.')],
datas=[],
hiddenimports=[],
hookspath=[],

View file

@ -2,12 +2,15 @@
facetracker -l 1
set /p cameraNum=Select your camera from the list above and enter the corresponding number:
facetracker -a 1
set /p dcaps=Select your camera mode or -1 for default settings:
set /p width=Select the width:
set /p height=Select the height:
set /p fps=Select the FPS:
facetracker -c %cameraNum% -W %width% -H %height% -F %fps% -v 3 -P 1 --discard-after 0 --scan-every 0 --no-3d-adapt 1 --max-feature-updates 900
facetracker -c %cameraNum% -W %width% -H %height% -F %fps% -D %dcaps% -v 3 -P 1 --discard-after 0 --scan-every 0 --no-3d-adapt 1 --max-feature-updates 900
pause