docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Class CameraSensor

    A sensor that wraps a Camera object to generate visual observations for an agent.

    Inheritance
    object
    CameraSensor
    Implements
    ISensor
    IDisposable
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.MLAgents.Sensors
    Assembly: solution.dll
    Syntax
    public class CameraSensor : ISensor, IDisposable

    Constructors

    Name Description
    CameraSensor(Camera, int, int, bool, string, SensorCompressionType, ObservationType)

    Creates and returns the camera sensor.

    Properties

    Name Description
    Camera

    The Camera used for rendering the sensor observations.

    CompressionType

    The compression type used by the sensor.

    Methods

    Name Description
    Dispose()

    Clean up the owned Texture2D.

    GetBuiltInSensorType()

    Return the corresponding BuiltInSensorType for the sensor.

    GetCompressedObservation()

    Generates a compressed image. This can be valuable in speeding-up training.

    GetCompressionSpec()

    Return information on the compression type being used. If no compression is used, return Default().

    GetName()

    Accessor for the name of the sensor.

    GetObservationSpec()

    Returns a description of the observations that will be generated by the sensor. The shape will be 1 x h x w for grayscale and 3 x h x w for color. The dimensions have translational equivariance along width and height, and no property along the channels dimension.

    ObservationToTexture(Camera, Texture2D, int, int)

    Renders a Camera instance to a 2D texture at the corresponding resolution.

    Reset()

    Resets the internal state of the sensor. This is called at the end of an Agent's episode. Most implementations can leave this empty.

    Update()

    Update any internal state of the sensor. This is called once per each agent step.

    Write(ObservationWriter)

    Writes out the generated, uncompressed image to the provided ObservationWriter.

    Extension Methods

    SensorExtensions.ObservationSize(ISensor)
    In This Article
    Back to top
    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