using UnityEngine; namespace MLAgents.Sensors { /// /// A SensorComponent that creates a . /// [AddComponentMenu("ML Agents/Camera Sensor", (int)MenuGroup.Sensors)] public class CameraSensorComponent : SensorComponent { /// /// Camera object that provides the data to the sensor. /// public new Camera camera; /// /// Name of the generated object. /// public string sensorName = "CameraSensor"; /// /// Width of the generated image. /// public int width = 84; /// /// Height of the generated image. /// public int height = 84; /// /// Whether to generate grayscale images or color. /// public bool grayscale; /// /// The compression type to use for the sensor. /// public SensorCompressionType compression = SensorCompressionType.PNG; /// /// Creates the /// /// The created object for this component. public override ISensor CreateSensor() { return new CameraSensor(camera, width, height, grayscale, sensorName, compression); } /// /// Computes the observation shape of the sensor. /// /// The observation shape of the associated object. public override int[] GetObservationShape() { return CameraSensor.GenerateShape(width, height, grayscale); } } }