Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Easy to use Python camera interface for NVIDIA Jetson. Harley note: flip method added.

License

NotificationsYou must be signed in to change notification settings

harleylara/jetcam

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 

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 asnumpy arrays withimage = camera.read()

  • Set the camera torunning = 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!

Setup

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.

Usage

Below we show some usage examples. You can find more in thenotebooks.

Create CSI camera

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)

Create USB camera

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)

Read

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

Callback

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')

Cameras

CSI Cameras

These cameras work with theCSICamera class. Try them out by following the examplenotebook.

ModelInfaredFOVResolutionCost
Raspberry Pi Camera V262.23280x2464$25
Raspberry Pi Camera V2 (NOIR)x62.23280x2464$31
Arducam IMX219 CS lens mount3280x2464$65
Arducam IMX219 M12 lens mount3280x2464$60
LI-IMX219-MIPI-FF-NANO3280x2464$29
WaveShare IMX219-77773280x2464$19
WaveShare IMX219-77IRx773280x2464$21
WaveShare IMX219-1201203280x2464$20
WaveShare IMX219-1601603280x2464$23
WaveShare IMX219-160IRx1603280x2464$25
WaveShare IMX219-2002003280x2464$27
WaveShare IMX219-83833280 × 2464$46

USB Cameras

These cameras work with theUSBCamera class. Try them out by following the examplenotebook.

ModelInfaredFOVResolutionCost
Logitech C270601280x720$18

See also

  • JetBot - An educational AI robot based on NVIDIA Jetson Nano

  • JetRacer - An educational AI racecar using NVIDIA Jetson Nano

  • JetCard - An SD card image for web programming AI projects with NVIDIA Jetson Nano

  • torch2trt - An easy to use PyTorch to TensorRT converter

About

Easy to use Python camera interface for NVIDIA Jetson. Harley note: flip method added.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jupyter Notebook74.6%
  • Python25.4%

[8]ページ先頭

©2009-2025 Movatter.jp