Skip to content

Commit 5e6a77a

Browse files
Merge pull request #344 from Unity-Technologies/orthographic-camera-metadata-additions
Add camera projection information to metadata
2 parents af7989a + eb7a137 commit 5e6a77a

File tree

6 files changed

+8
-2
lines changed

6 files changed

+8
-2
lines changed

com.unity.perception/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Added random seed field to the Run in Unity Simulation Window
1818

1919
User can now choose the base folder location to store their generated data.
2020

21+
Added 'projection' field in the capture.sensor metadata. Values are either "perspective" or "orthographic"
22+
2123
### Changed
2224
Increased color variety in instance segmentation images
2325

com.unity.perception/Documentation~/Schema/Synthetic_Dataset_Schema.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ sensor {
140140
translation: <float, float, float> -- Position in meters: (x, y, z) with respect to the ego coordinate system. This is typically fixed during the simulation, but we can allow small variation for domain randomization.
141141
rotation: <float, float, float, float> -- Orientation as quaternion: (w, x, y, z) with respect to ego coordinate system. This is typically fixed during the simulation, but we can allow small variation for domain randomization.
142142
camera_intrinsic: <3x3 float matrix> [optional] -- Intrinsic camera calibration. Empty for sensors that are not cameras.
143+
projection: <string> -- holds the type of projection the camera used for that capture: Options: "perspective" or "orthographic"
143144
144145
# add arbitrary optional key-value pairs for sensor attributes
145146
}
42.7 KB
Loading

com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static JToken ToJToken<T>(T value)
6767
case double v:
6868
return new JValue(v);
6969
case string v:
70-
return new JValue($"\"{v}\"");
70+
return new JValue(v);
7171
case uint v:
7272
return new JValue(v);
7373
}

com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ void CaptureRgbData(Camera cam)
432432
// Record the camera's projection matrix
433433
SetPersistentSensorData("camera_intrinsic", ToProjectionMatrix3x3(cam.projectionMatrix));
434434

435+
// Record the camera's projection type (orthographic or perspective)
436+
SetPersistentSensorData("projection", cam.orthographic ? "orthographic" : "perspective");
437+
435438
var captureFilename = $"{Manager.Instance.GetDirectoryFor(rgbDirectory)}/{k_RgbFilePrefix}{Time.frameCount}.png";
436439
var dxRootPath = $"{rgbDirectory}/{k_RgbFilePrefix}{Time.frameCount}.png";
437440
SensorHandle.ReportCapture(dxRootPath, SensorSpatialData.FromGameObjects(

com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void Float3x3ToJToken_ReturnsArrayFormat(float m00, float m01, float m02,
8585
[TestCase(1u, "1")]
8686
[TestCase(1.0, "1")]
8787
[TestCase(1.0f, "1")]
88-
[TestCase("string", "\"string\"")]
88+
[TestCase("string", "string")]
8989
public void Primitive_ReturnsValue(object o, string jsonExpected)
9090
{
9191
var jsonActual = DatasetJsonUtility.ToJToken(o).ToString();

0 commit comments

Comments
 (0)