diff --git a/BabbleApp/.gitignore b/BabbleApp/.gitignore new file mode 100644 index 0000000..397b4a7 --- /dev/null +++ b/BabbleApp/.gitignore @@ -0,0 +1 @@ +*.log diff --git a/BabbleApp/vivefacialtracker/camera.py b/BabbleApp/vivefacialtracker/camera.py index 32b341e..c4f7048 100644 --- a/BabbleApp/vivefacialtracker/camera.py +++ b/BabbleApp/vivefacialtracker/camera.py @@ -449,6 +449,7 @@ class FTCamera: else: def read(self: 'FTCamera') -> None: """Read frames until requested to exit.""" + self._filter_graph.run() while not self.terminator.terminate_requested: self._filter_graph.grab_frame() time.sleep(0.001) diff --git a/BabbleApp/vivefacialtracker/camera_controller.py b/BabbleApp/vivefacialtracker/camera_controller.py index d4e8502..6469590 100644 --- a/BabbleApp/vivefacialtracker/camera_controller.py +++ b/BabbleApp/vivefacialtracker/camera_controller.py @@ -80,7 +80,8 @@ class FTCameraController: def get_image(self: 'FTCameraController') -> np.ndarray: """Get next image or None.""" try: - frame = self._proc_queue.get(True, 1) + # timeout of 1s is a bit short. 2s is safer + frame = self._proc_queue.get(True, 2) shape = unpack('HHH', frame[0:6]) image = np.frombuffer(frame[6:], dtype=np.uint8).reshape(shape) return image @@ -116,6 +117,13 @@ class FTCameraController: def _read_process(self: 'FTCameraController', queue: multiprocessing.connection.Connection) -> None: + """Read process function.""" + + """ + logging.basicConfig(filename='ViveFaceTracker-ReadThread.log', filemode='w', + encoding='utf-8', level=logging.INFO) + """ + FTCameraController._logger.info("FTCameraController._read_process: ENTER") class Helper(FTCamera.Processor): """Helper."""