1 using System.Collections.Generic;
6 namespace droid.Runtime.Prototyping.Sensors.BoundingBox {
10 [AddComponentMenu(SensorComponentMenuPath._ComponentMenuPath
11 +
"Experimental/ScreenSpaceBoundingBox" 12 + SensorComponentMenuPath._Postfix)]
15 [RequireComponent(typeof(Utilities.GameObjects.BoundingBoxes.BoundingBox))]
21 public override string PrototypingTypeName {
get {
return "BoundingBox"; } }
23 Utilities.GameObjects.BoundingBoxes.BoundingBox _bounding_box = null;
25 [SerializeField] Rect _out_rect =
new Rect();
31 this._bounding_box = this.GetComponent<Utilities.GameObjects.BoundingBoxes.BoundingBox>();
34 [SerializeField]
bool NormaliseObservation =
true;
35 public override IEnumerable<float> FloatEnumerable {
get {
return new List<float>(); } }
42 var rect = this._bounding_box.ScreenSpaceBoundingRect(this._camera);
44 if (this.NormaliseObservation) {
47 var target = this._camera.targetTexture;
53 var r = this._camera.pixelRect;
58 this._out_rect = rect.Normalise(w, h);
60 this._out_rect = rect;
65 $
"{{\"x\":{this._out_rect.x},\n\"y\":{this._out_rect.y},\n\"w\":{this._out_rect.width},\n\"h\":{this._out_rect.height}}}";
67 this.ObservationValue = str_rep;
73 public string ObservationValue {
get;
set; }
75 public override string ToString() {
return this.ObservationValue; }
override void UpdateObservation()
override string ToString()