diff --git a/scripts/async_posture.py b/scripts/async_posture.py index 865560d..ae52dab 100644 --- a/scripts/async_posture.py +++ b/scripts/async_posture.py @@ -1,7 +1,9 @@ import logging import pprint +import argparse from models.pose_detection.routines import PostureProcess +from models.pose_detection.frame_capturer import RaspCapturer, OpenCVCapturer from data.routines import destroy_database, init_database, create_user, get_postures logger = logging.getLogger(__name__) @@ -9,6 +11,11 @@ def main() -> None: logging.basicConfig(level=logging.DEBUG) + parser = argparse.ArgumentParser() + parser.add_argument("-p", "--pi", action="store_true") + args = parser.parse_args() + logger.debug(args) + logger.debug("Testing PostureProces") logger.debug("Destroying database") destroy_database() @@ -17,7 +24,7 @@ def main() -> None: logger.debug("Inserting user") user_id = create_user() logger.debug("starting postures %s", get_postures()) - process = PostureProcess() + process = PostureProcess(frame_capturer=RaspCapturer if args.pi else OpenCVCapturer) for i in range(200): logger.debug("Parent process running") diff --git a/scripts/test_face_match_pi.py b/scripts/test_face_match_pi.py new file mode 100644 index 0000000..3cb274b --- /dev/null +++ b/scripts/test_face_match_pi.py @@ -0,0 +1,24 @@ +import argparse +import logging + +import cv2 + +from models.face_recognition.recognition import get_face_match + +logger = logging.getLogger(__name__) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("image_path") + args = parser.parse_args() + logger.debug("Reading image") + face = cv2.imread(args.image_path) + logger.debug("Checking for a match") + matched_id = get_face_match(face) + + logger.debug("Matched user %d", matched_id) + + +if __name__ == "__main__": + main()