docs.unity3d.com
    Show / Hide Table of Contents

    Class PerceptionCamera

    Captures ground truth from the associated Camera.

    Inheritance
    Object
    PerceptionCamera
    Namespace: UnityEngine.Perception.GroundTruth
    Syntax
    public class PerceptionCamera : MonoBehaviour

    Fields

    captureRgbImages

    Whether camera output should be captured to disk.

    Declaration
    public bool captureRgbImages
    Field Value
    Type Description
    Boolean

    captureTriggerMode

    The method of triggering captures for this camera.

    Declaration
    public CaptureTriggerMode captureTriggerMode
    Field Value
    Type Description
    CaptureTriggerMode

    description

    A human-readable description of the camera.

    Declaration
    public string description
    Field Value
    Type Description
    String

    firstCaptureFrame

    Frame number at which this camera starts capturing.

    Declaration
    public int firstCaptureFrame
    Field Value
    Type Description
    Int32

    framesBetweenCaptures

    The number of frames to simulate and render between the camera's scheduled captures. Setting this to 0 makes the camera capture every frame.

    Declaration
    public int framesBetweenCaptures
    Field Value
    Type Description
    Int32

    ID

    The string ID of this camera sensor

    Declaration
    public string ID
    Field Value
    Type Description
    String

    manualSensorAffectSimulationTiming

    Have this unscheduled (manual capture) camera affect simulation timings (similar to a scheduled camera) by requesting a specific frame delta time.

    Declaration
    public bool manualSensorAffectSimulationTiming
    Field Value
    Type Description
    Boolean

    RgbCaptureReadback

    An event that executes for each captured RGB image that is read from GPU memory back to CPU memory.

    Declaration
    public Action<int, NativeArray<Color32>> RgbCaptureReadback
    Field Value
    Type Description
    Action<Int32, NativeArray<Color32>>

    showVisualizations

    Turns on/off the realtime visualization capability.

    Declaration
    public bool showVisualizations
    Field Value
    Type Description
    Boolean

    simulationDeltaTime

    The simulation frame time (seconds) for this camera. E.g. 0.0166 translates to 60 frames per second. This will be used as Unity's , causing a fixed number of frames to be generated for each second of elapsed simulation time regardless of the capabilities of the underlying hardware.

    Declaration
    public float simulationDeltaTime
    Field Value
    Type Description
    Single

    useAsyncReadbackIfSupported

    A toggle for choosing whether to use async or synchronous readback APIs to transfer captured RGB image data from the GPU back to the CPU. The more performant option of async readbacks is enabled by default.

    Declaration
    public static bool useAsyncReadbackIfSupported
    Field Value
    Type Description
    Boolean

    Properties

    attachedCamera

    Caches access to the camera attached to the perception camera.

    Declaration
    public Camera attachedCamera { get; }
    Property Value
    Type Description
    Camera

    captureFrameCount

    The number of capture-able frames that have been generated

    Declaration
    public static int captureFrameCount { get; }
    Property Value
    Type Description
    Int32

    labelers

    The CameraLabeler instances which will be run for this PerceptionCamera.

    Declaration
    public IReadOnlyList<CameraLabeler> labelers { get; }
    Property Value
    Type Description
    IReadOnlyList<CameraLabeler>

    SensorHandle

    The SensorHandle associated with this camera. Use this to report additional annotations and metrics at runtime.

    Declaration
    public SensorHandle SensorHandle { get; }
    Property Value
    Type Description
    SensorHandle

    Methods

    AddLabeler(CameraLabeler)

    Add the given CameraLabeler to the PerceptionCamera. It will be set up and executed by this PerceptionCamera each frame it captures data.

    Declaration
    public void AddLabeler(CameraLabeler cameraLabeler)
    Parameters
    Type Name Description
    CameraLabeler cameraLabeler

    The labeler to add to this PerceptionCamera

    RemoveLabeler(CameraLabeler)

    Removes the given CameraLabeler from the list of labelers under this PerceptionCamera, if it is in the list. The labeler is cleaned up in the process. Labelers removed from a PerceptionCamera should not be used again.

    Declaration
    public bool RemoveLabeler(CameraLabeler cameraLabeler)
    Parameters
    Type Name Description
    CameraLabeler cameraLabeler
    Returns
    Type Description
    Boolean

    RemovePersistentSensorData(String)

    Removes a persistent sensor data object.

    Declaration
    public bool RemovePersistentSensorData(string key)
    Parameters
    Type Name Description
    String key

    The key of the object to remove.

    Returns
    Type Description
    Boolean

    True if a data object was removed. False if it was not set.

    RequestCapture()

    Requests a capture from this camera on the next rendered frame. Can only be used when using Manual capture mode.

    Declaration
    public void RequestCapture()

    SetPersistentSensorData(String, Object)

    Add a data object which will be added to the dataset with each capture. Overrides existing sensor data associated with the given key.

    Declaration
    public void SetPersistentSensorData(string key, object data)
    Parameters
    Type Name Description
    String key

    The key to associate with the data.

    Object data

    An object containing the data. Will be serialized into json.

    Events

    InstanceSegmentationImageReadback

    Invoked when instance segmentation images are read back from the graphics system. The first parameter is the Time.frameCount at which the objects were rendered. May be invoked many frames after the objects were rendered.

    Declaration
    public event Action<int, NativeArray<Color32>, RenderTexture> InstanceSegmentationImageReadback
    Event Type
    Type Description
    Action<Int32, NativeArray<Color32>, RenderTexture>

    RenderedObjectInfosCalculated

    Invoked when RenderedObjectInfos are calculated. The first parameter is the Time.frameCount at which the objects were rendered. This may be called many frames after the objects were rendered.

    Declaration
    public event Action<int, NativeArray<RenderedObjectInfo>> RenderedObjectInfosCalculated
    Event Type
    Type Description
    Action<Int32, NativeArray<RenderedObjectInfo>>
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023