Added an option to disable escapi for video input on Windows.
This commit is contained in:
parent
935a5fdf91
commit
5c4d4b7b14
2 changed files with 8 additions and 4 deletions
|
|
@ -35,6 +35,8 @@ parser.add_argument("--gaze-tracking", type=int, help="When set to 1, experiment
|
|||
parser.add_argument("--face-id-offset", type=int, help="When set, this offset is added to all face ids, which can be useful for mixing tracking data from multiple network sources", default=0)
|
||||
parser.add_argument("--repeat-video", type=int, help="When set to 1 and a video file was specified with -c, the tracker will loop the video until interrupted", default=0)
|
||||
parser.add_argument("--dump-points", type=str, help="When set to a filename, the current face 3D points are made symmetric and dumped to the given file when quitting the visualization with the \"q\" key", default="")
|
||||
if os.name == 'nt':
|
||||
parser.add_argument("--use-escapi", type=int, help="When set to 1, escapi will be used for video input instead of OpenCV", default=1)
|
||||
args = parser.parse_args()
|
||||
|
||||
os.environ["OMP_NUM_THREADS"] = "1"
|
||||
|
|
@ -70,7 +72,9 @@ if args.faces >= 40:
|
|||
fps = 0
|
||||
if os.name == 'nt':
|
||||
fps = args.fps
|
||||
input_reader = InputReader(args.capture, args.raw_rgb, args.width, args.height, fps)
|
||||
input_reader = InputReader(args.capture, args.raw_rgb, args.width, args.height, fps, use_escapi=True if args.use_escapi == 1 else False)
|
||||
else:
|
||||
input_reader = InputReader(args.capture, args.raw_rgb, args.width, args.height, fps, use_escapi=False)
|
||||
if type(input_reader.reader) == VideoReader:
|
||||
fps = 0
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ class VideoReader():
|
|||
self.cap.release()
|
||||
|
||||
class CameraReader(VideoReader):
|
||||
def __init__(self, capture, width, height, fps):
|
||||
def __init__(self, capture, width, height, fps, use_escapi=True):
|
||||
self.device = None
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.fps = fps
|
||||
if os.name == 'nt':
|
||||
if os.name == 'nt' and use_escapi:
|
||||
escapi.init()
|
||||
self.device = capture
|
||||
self.buffer = escapi.init_camera(self.device, self.width, self.height, self.fps)
|
||||
|
|
@ -88,7 +88,7 @@ class RawReader:
|
|||
self.open = False
|
||||
|
||||
class InputReader():
|
||||
def __init__(self, capture, raw_rgb, width, height, fps):
|
||||
def __init__(self, capture, raw_rgb, width, height, fps, use_escapi=False):
|
||||
self.reader = None
|
||||
try:
|
||||
if raw_rgb > 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue