rt-net / jnm_jupyternotebook

Jupyter Notebooks for Jetson Nano Mouse
https://rt-net.github.io/tutorials/jnmouse/jupyter-notebook/install.html
Apache License 2.0
3 stars 3 forks source link

Add multi-camera support #4

Closed Tiryoh closed 3 years ago

Tiryoh commented 3 years ago

What does this implement/fix?

マルチカメラをサポートします。

Does this close any currently open issues?

しません。

How has this been tested?

Screenshot from 2021-05-06 17-32-23

import traitlets
import ipywidgets.widgets as widgets
from IPython.display import display
from jnmouse import Camera, bgr8_to_jpeg

camera = Camera.instance(width=224, height=224)
image = widgets.Image(format='jpeg', width=224, height=224)  # this width and height doesn't necessarily have to match the camera
camera_link = traitlets.dlink((camera, 'value'), (image, 'value'), transform=bgr8_to_jpeg)

camera2 = Camera.instance(sensor_id=1, width=224, height=224)
image2 = widgets.Image(format='jpeg', width=224, height=224)  # this width and height doesn't necessarily have to match the camera
camera_link2 = traitlets.dlink((camera2, 'value'), (image2, 'value'), transform=bgr8_to_jpeg)

display(image)
display(image2)

Any other comments?

Checklists