Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrated camera_factory in video_input #232

Merged
merged 9 commits into from
Dec 22, 2024
Merged

integrated camera_factory in video_input #232

merged 9 commits into from
Dec 22, 2024

Conversation

Aleksa-M
Copy link
Contributor

@Aleksa-M Aleksa-M commented Dec 3, 2024

No description provided.

Copy link
Member

@maxlou05 maxlou05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

@@ -6,6 +6,8 @@


CAMERA = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename this to camera option? Also, isn't there an enum for what each number means? Please use the enum

@@ -12,7 +12,8 @@
def video_input_worker(
camera_name: "int | str",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the CameraOption enum class. Then, you will need to change the config.yaml to include this option. You will also need to change the config loading portion of the code (similar to DETECT_TARGET_OPTION_INT).



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_option: int, width: int, height: int) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make camera_option the enum

Copy link
Collaborator

@Xierumeng Xierumeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
main_2024.py Outdated Show resolved Hide resolved
main_2024.py Outdated Show resolved Hide resolved
modules/video_input/video_input.py Outdated Show resolved Hide resolved
modules/video_input/video_input.py Outdated Show resolved Hide resolved
camera_name: "int | str",
period: float,
save_name: str,
period: int,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move period with the worker parameters. Also should be float.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It currently is a worker parameter? I changed it to float

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant immediately above output_queue . Then the parameters for the class object and the worker are grouped separately.

modules/video_input/video_input_worker.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@Xierumeng Xierumeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
modules/video_input/video_input.py Outdated Show resolved Hide resolved
modules/video_input/video_input.py Outdated Show resolved Hide resolved
modules/video_input/video_input.py Show resolved Hide resolved
modules/video_input/video_input.py Outdated Show resolved Hide resolved
tests/integration/test_video_input_hardware.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@Xierumeng Xierumeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

config.yaml Outdated Show resolved Hide resolved
main_2024.py Outdated Show resolved Hide resolved
main_2024.py Outdated Show resolved Hide resolved
main_2024.py Outdated Show resolved Hide resolved
main_2024.py Outdated Show resolved Hide resolved
width is the width of the images the camera takes in pixels.
height is the height of the images the camera takes in pixels.
camera_config specifies camera settings.
maybe_image_name is name of iamge log files. Set to None to not log any images.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this to align with logger.

Spelling.

Copy link
Collaborator

@Xierumeng Xierumeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

Comment on lines 15 to 16
WIDTH = 1920
HEIGHT = 1200
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration test is failing for me, I suggest a resolution of 640x480 .

VIDEO_INPUT_WORKER_PERIOD = 1.0
CAMERA = 0
CAMERA = camera_factory.CameraOption.OPENCV
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also failing here, but for some reason there is a conversion which results in this being float in the worker function.

Copy link
Collaborator

@Xierumeng Xierumeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, thanks!

@maxlou05 maxlou05 merged commit a268391 into main Dec 22, 2024
1 check passed
@maxlou05 maxlou05 deleted the camera-refactor branch December 22, 2024 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants