- Notifications
You must be signed in to change notification settings - Fork0
Easy to use Python camera interface for NVIDIA Jetson. Harley note: flip method added.
License
harleylara/jetcam
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
JetCam is an easy to use Python camera interface for NVIDIA Jetson.
Works with various USB and CSI cameras using Jetson'sAccelerated GStreamer Plugins
Easily read images as
numpy
arrays withimage = camera.read()
Set the camera to
running = True
to attach callbacks to new frames
JetCam makes it easy to prototype AI projects in Python, especially within the Jupyter Lab programming environment installed inJetCard.
If you find an issue, pleaselet us know!
git clone https://github.com/NVIDIA-AI-IOT/jetcamcd jetcamsudo python3 setup.py install
JetCam is tested against a system configured with theJetCard setup. Different system configurations may require additional steps.
Below we show some usage examples. You can find more in thenotebooks.
CallCSICamera
to use a compatible CSI camera.capture_width
,capture_height
, andcapture_fps
will control the capture shape and rate that images are aquired.width
andheight
control the final output shape of the image as returned by theread
function.flip_method
can rotate/flip the image. This is useful when the mounting of the camera is in a different orientation than the default.
flip_method: (0): none - Identity (no rotation) (1): counterclockwise - Rotate counter-clockwise 90 degrees (2): rotate-180 - Rotate 180 degrees (3): clockwise - Rotate clockwise degrees (4): horizontal-flip - Flip horizontally (5): upper-right-diagonal - Flip across uppright/lower left diagonal (6): vertical-flip - Flip vertically (7): upper-left-diagonal - Flip across uppleft/lower right diagonal
fromjetcam.csi_cameraimportCSICameracamera=CSICamera(width=224,height=224,capture_width=1080,capture_height=720,capture_fps=30,flip_method=0)
CallUSBCamera
to use a compatbile USB camera. The same parameters asCSICamera
apply, along with a parametercapture_device
that indicates the device index. You can check the device index by callingls /dev/video*
.
fromjetcam.usb_cameraimportUSBCameracamera=USBCamera(capture_device=1)
Callread()
to read the latest image as anumpy.ndarray
of data typenp.uint8
and shape(224, 224, 3)
. The color format isBGR8
.
image=camera.read()
Theread
function also updates the camera's internalvalue
attribute.
camera.read()image=camera.value
You can also set the camera torunning = True
, which will spawn a thread that acquires images from the camera. These will update the camera'svalue
attribute automatically. You can attach a callback to the value using thetraitlets library. This will call the callback with the new camera value as well as the old camera value
camera.running=Truedefcallback(change):new_image=change['new']# do some processing...camera.observe(callback,names='value')
These cameras work with theCSICamera
class. Try them out by following the examplenotebook.
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 | |
WaveShare IMX219-83 | 83 | 3280 × 2464 | $46 |
These cameras work with theUSBCamera
class. Try them out by following the examplenotebook.
Model | Infared | FOV | Resolution | Cost |
---|---|---|---|---|
Logitech C270 | 60 | 1280x720 | $18 |
About
Easy to use Python camera interface for NVIDIA Jetson. Harley note: flip method added.
Resources
License
Stars
Watchers
Forks
Packages0
Languages
- Jupyter Notebook74.6%
- Python25.4%