diff --git a/config.yaml b/config.yaml index b0dd9811..3fa600cf 100644 --- a/config.yaml +++ b/config.yaml @@ -6,6 +6,7 @@ video_input: camera_name: 0 worker_period: 1.0 # seconds save_prefix: "log_image" + use_picamera: false detect_target: worker_count: 1 diff --git a/main_2024.py b/main_2024.py index f6297226..2fc3eab7 100644 --- a/main_2024.py +++ b/main_2024.py @@ -82,6 +82,7 @@ def main() -> int: VIDEO_INPUT_CAMERA_NAME = config["video_input"]["camera_name"] VIDEO_INPUT_WORKER_PERIOD = config["video_input"]["worker_period"] VIDEO_INPUT_SAVE_NAME_PREFIX = config["video_input"]["save_prefix"] + VIDEO_INPUT_USE_PICAMERA = config["video_input"]["use_picamera"] VIDEO_INPUT_SAVE_PREFIX = str(pathlib.Path(logging_path, VIDEO_INPUT_SAVE_NAME_PREFIX)) DETECT_TARGET_WORKER_COUNT = config["detect_target"]["worker_count"] @@ -182,6 +183,7 @@ def main() -> int: VIDEO_INPUT_CAMERA_NAME, VIDEO_INPUT_WORKER_PERIOD, VIDEO_INPUT_SAVE_PREFIX, + VIDEO_INPUT_USE_PICAMERA, ), input_queues=[], output_queues=[video_input_to_detect_target_queue], diff --git a/modules/common b/modules/common index a32385ee..b737ef80 160000 --- a/modules/common +++ b/modules/common @@ -1 +1 @@ -Subproject commit a32385eefab7d6a5468f5b8f2e708860a5f085d6 +Subproject commit b737ef80474be9db009ad406de838b187f44e40f diff --git a/modules/video_input/video_input.py b/modules/video_input/video_input.py index faaef9ac..189ee6f6 100644 --- a/modules/video_input/video_input.py +++ b/modules/video_input/video_input.py @@ -11,8 +11,10 @@ class VideoInput: Combines image and timestamp together. """ - def __init__(self, camera_name: "int | str", save_name: str = "") -> None: - self.device = camera_device.CameraDevice(camera_name, 1, save_name) + def __init__( + self, camera_name: "int | str", save_name: str = "", use_picamera: bool = False + ) -> None: + self.device = camera_device.CameraDevice(use_picamera, camera_name, 1, save_name) def run(self) -> "tuple[bool, image_and_time.ImageAndTime | None]": """ diff --git a/modules/video_input/video_input_worker.py b/modules/video_input/video_input_worker.py index aa7ea171..f4706181 100644 --- a/modules/video_input/video_input_worker.py +++ b/modules/video_input/video_input_worker.py @@ -13,6 +13,7 @@ def video_input_worker( camera_name: "int | str", period: float, save_name: str, + use_picamera: bool, output_queue: queue_proxy_wrapper.QueueProxyWrapper, controller: worker_controller.WorkerController, ) -> None: @@ -25,7 +26,7 @@ def video_input_worker( output_queue is the data queue. controller is how the main process communicates to this worker process. """ - input_device = video_input.VideoInput(camera_name, save_name) + input_device = video_input.VideoInput(camera_name, save_name, use_picamera) while not controller.is_exit_requested(): controller.check_pause()