Main Content

read

Return image data captured with camera

Since R2024b

    Description

    image = read(camera) returns image data that is captured with the camera specified by camera in the 3D environment.

    [image,depth] = read(camera) returns depth and image data of the image that is captured with the camera specified by camera in the simulation 3D environment. To enable the depth output argument, set the EnableDepthOutput argument of the sim3d.sensors.Camera object to true.

    [image,semantic] = read(camera) returns semantic and image data of the image that is captured with the camera specified by camera in the simulation 3D environment. To enable the semantic output argument, set the EnableSemanticOutput argument of sim3d.sensors.Camera object to true.

    [image,depth,semantic] = read(camera) returns depth, semantic, and image data of the image that is captured with the camera specified by camera in the simulation 3D environment. To enable the depth and semantic output arguments, set the EnableDepthOutput and EnableSemanticOutput arguments of the sim3d.sensors.Camera object to true. You can use these images to visualize and verify your driving algorithms. You can also develop depth estimation and semantic segmentation algorithms.

    Input Arguments

    collapse all

    Virtual camera that captures the image, specified as a sim3d.sensors.Camera object.

    Example: camera = sim3d.sensors.Camera

    Output Arguments

    collapse all

    The table summarizes each type of output data and how to enable it.

    OutputDescriptionArgument to Enable OutputSample Visualization

    image

    RGB image data captured by the cameraNot applicable

    Sample image output of a city scene

    depth

    Depth map with values from 0 m to 1000 meters

    EnableDepthOutput of sim3d.sensors.Camera object

    Sample depth output of a city scene

    semantic

    Semantic segmentation map of label IDs that correspond to objects in the scene

    EnableSemanticOutput of sim3d.sensors.Camera object

    Sample image semantic segmentation of a city scene

    Image data returned by camera, returned as an m-by-n-by-3 array of RGB triplet values. m is the vertical resolution of the image. n is the horizontal resolution of the image.

    Data Types: uint8

    Object depth for each pixel in the image, returned as an m-by-n array. m is the vertical resolution of the image. n is the horizontal resolution of the image. Depth is in the range from 0 to 1000 meters.

    Dependencies

    To enable depth output, set the EnableDepthOutput argument of the sim3d.sensors.Camera object to 1.

    Semantic label identifier for each pixel in the image, output as an m-by-n array of RGB triplet values. m is the vertical resolution of the image. n is the horizontal resolution of the image.

    The table shows the object IDs used in the default scenes. If a scene contains an object that does not have an assigned ID, that object is assigned an ID of 0. The detection of lane markings is not supported.

    IDType
    0

    None/default

    1

    Building

    2

    Not used

    3

    Other

    4

    Pedestrians

    5

    Pole

    6

    Lane Markings

    7

    Road

    8

    Sidewalk

    9

    Vegetation

    10

    Vehicle

    11

    Not used

    12

    Generic traffic sign

    13

    Stop sign

    14

    Yield sign

    15

    Speed limit sign

    16

    Weight limit sign

    17-18

    Not used

    19

    Left and right arrow warning sign

    20

    Left chevron warning sign

    21

    Right chevron warning sign

    22

    Not used

    23

    Right one-way sign

    24

    Not used

    25

    School bus only sign

    26-38

    Not used

    39

    Crosswalk sign

    40

    Not used

    41

    Traffic signal

    42

    Curve right warning sign

    43

    Curve left warning sign

    44

    Up right arrow warning sign

    45-47

    Not used

    48

    Railroad crossing sign

    49

    Street sign

    50

    Roundabout warning sign

    51

    Fire hydrant

    52

    Exit sign

    53

    Bike lane sign

    54-56

    Not used

    57

    Sky

    58

    Curb

    59

    Flyover ramp

    60

    Road guard rail

    61Bicyclist
    62-66

    Not used

    67

    Deer

    68-70

    Not used

    71

    Barricade

    72

    Motorcycle

    73-255

    Not used

    Dependencies

    To enable semantic output, set the EnableSemanticOutput argument of the sim3d.sensors.Camera object to 1.

    Version History

    Introduced in R2024b