Skip to content
This repository was archived by the owner on Nov 13, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions main_2024.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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],
Expand Down
6 changes: 4 additions & 2 deletions modules/video_input/video_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]":
"""
Expand Down
3 changes: 2 additions & 1 deletion modules/video_input/video_input_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()
Expand Down