Main Content

getCameraList

R2026b

Get a list of available cameras on the NVIDIA hardware

Description

Add-On Required: This feature requires the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms add-on.

camlist = getCameraList(hwObj) returns a table containing the name, Linux® device number, and available pixel formats for the cameras detected on the NVIDIA® target hardware. The getCameraList function lists cameras connected to both the USB and camera peripheral interfaces (CSI) of the target board.

example

Examples

collapse all

You can connect to the CSI camera connected to an NVIDIA platform and capture images from the camera.

Create a live hardware connection from MATLAB® to the NVIDIA hardware by using the jetson function.

hwObj = jetson;

To find the camera name, use the getCameraList function. The function returns a table with the camera names, device IDs, available resolutions, and available formats.

camlist = getCameraList(hwObj);
              Camera Name              Video Device     Available Resolutions    Pixel Formats
    _______________________________    _____________    _____________________    _____________

    "Microsoft LifeCam Cinema(TM):"    "/dev/video0"    "(View resolutions)"      "YUYV,MJPG" 

To determine the available resolutions, click the View Resolutions link in the Available Resolutions column. This code shows a snippet of the output from the link.

Resolutions: [160 120],[176 144],[320 240],[352 288],[416 240],[424 240],[640 360],...

Create a camera object by using the name of the camera from the list and a supported resolution.

camObj = camera(hwObj,"Microsoft LifeCam Cinema(TM):",[1280 720])
camObj = 

  camera with properties:

            Map: [1×1 containers.Map]
           Name: 'Microsoft LifeCam Cinema(TM):'
      ImageSize: [1280 720]
    VideoDevice: '/dev/video0'
    PixelFormat: "YUYV"

Capture a frame from the camera by using the snapshot function.

img = snapshot(cam);
figure();
imagesc(img);
drawnow;

Desk with a pyramid on top of it. The pyramid says "Thanks" and contains an image of an L-shaped membrane

Input Arguments

collapse all

Connection to a specific NVIDIA hardware board, specified as a jetson or drive object.

Output Arguments

collapse all

Table containing the list of cameras that the software detects on the target hardware. the table contains the name, Linux device number, and available pixel formats for the cameras. For example,

camlist =

  2×3 table

             Camera Name              Video Device     Pixel Formats        
    ______________________________    _____________    _____________

    "vi-output, ov5693 2-0036"        "/dev/video0"    "BG10"
    "Logitech Webcam C925e"           "/dev/video0"    "YUYV,MJPG" 

When you click on View resolutions, you can view the supported resolutions.

Resolutions: [1280 720],[1280 800],[160 120],[176 144], ...
[320 240],[352 288],[416 240],[424 240],[640 360], ...
[640 480],[800 448],[800 600],[960 544]

For information on accessing data in tables, see Access Data in Tables.

Version History

Introduced in R2019a