Easy to use Python camera interface for NVIDIA Jetson
JetCam is an easy to use Python camera interface for NVIDIA Jetson.
Easily read images as
image = camera.read()
Set the camera to
running = Trueto attach callbacks to new frames
JetCam makes it easy to prototype AI projects in Python, especially within the Jupyter Lab programming environment installed in JetCard.
If you find an issue, please let us know!
git clone https://github.com/NVIDIA-AI-IOT/jetcam cd jetcam sudo python3 setup.py install
JetCam is tested against a system configured with the JetCard setup. Different system configurations may require additional steps.
Below we show some usage examples. You can find more in the notebooks.
CSICamerato use a compatible CSI camera.
capture_fpswill control the capture shape and rate that images are aquired.
heightcontrol the final output shape of the image as returned by the
from jetcam.csi_camera import CSICamera
camera = CSICamera(width=224, height=224, capture_width=1080, capture_height=720, capture_fps=30)
USBCamerato use a compatbile USB camera. The same parameters as
CSICameraapply, along with a parameter
capture_devicethat indicates the device index. You can check the device index by calling
from jetcam.usb_camera import USBCamera
camera = USBCamera(capture_device=1)
read()to read the latest image as a
numpy.ndarrayof data type
(224, 224, 3). The color format is
image = camera.read()
readfunction also updates the camera's internal
camera.read() image = camera.value
You can also set the camera to
running = True, which will spawn a thread that acquires images from the camera. These will update the camera's
valueattribute automatically. You can attach a callback to the value using the traitlets library. This will call the callback with the new camera value as well as the old camera value
camera.running = True
def callback(change): new_image = change['new'] # do some processing...
| Model | Infared | FOV | Resolution | Cost | |:-------|:-----:|:---:|:---:|:----:| | Raspberry Pi Camera V2 | | 62.2 | 3280x2464 | $25 | | Raspberry Pi Camera V2 (NOIR) | x | 62.2 | 3280x2464 | $31 | | Arducam IMX219 CS lens mount | | | 3280x2464 | $65 | | Arducam IMX219 M12 lens mount | | | 3280x2464 | $60 | | LI-IMX219-MIPI-FF-NANO | | | 3280x2464 | $29 | | WaveShare IMX219-77 | | 77 | 3280x2464 | $19 | | WaveShare IMX219-77IR | x | 77 | 3280x2464 | $21 | | WaveShare IMX219-120 | | 120 | 3280x2464 | $20 | | WaveShare IMX219-160 | | 160 | 3280x2464 | $23 | | WaveShare IMX219-160IR | x | 160 | 3280x2464 | $25 | | WaveShare IMX219-200 | | 200 | 3280x2464 | $27 |
| Model | Infared | FOV | Resolution | Cost | |:-------|:-----:|:---:|:---:|:----:| | Logitech C270 | | 60 | 1280x720 | $18 |