Struct XRCameraFrame
Parameters of the Unity Camera that might be necessary or useful to the provider.
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Syntax
public struct XRCameraFrame : IEquatable<XRCameraFrame>
Constructors
XRCameraFrame(Int64, Single, Single, Color, Matrix4x4, Matrix4x4, TrackingState, IntPtr, XRCameraFrameProperties, Single, Double, Single, Single, Color, Vector3, SphericalHarmonicsL2, XRTextureDescriptor, Single)
Creates a XRCameraFrame.
Declaration
public XRCameraFrame(long timestamp, float averageBrightness, float averageColorTemperature, Color colorCorrection, Matrix4x4 projectionMatrix, Matrix4x4 displayMatrix, TrackingState trackingState, IntPtr nativePtr, XRCameraFrameProperties properties, float averageIntensityInLumens, double exposureDuration, float exposureOffset, float mainLightIntensityInLumens, Color mainLightColor, Vector3 mainLightDirection, SphericalHarmonicsL2 ambientSphericalHarmonics, XRTextureDescriptor cameraGrain, float noiseIntensity)
Parameters
| Type | Name | Description |
|---|---|---|
| Int64 | timestamp | The timestamp, in nanoseconds, associated with this frame. |
| Single | averageBrightness | The estimated brightness of the scene. |
| Single | averageColorTemperature | The estimated color temperature of the scene. |
| Color | colorCorrection | The estimated color correction value of the scene. |
| Matrix4x4 | projectionMatrix | The 4x4 projection matrix for the camera frame. |
| Matrix4x4 | displayMatrix | The 4x4 display matrix for the camera frame. |
| TrackingState | trackingState | The TrackingState associated with the camera. |
| IntPtr | nativePtr | A native pointer associated with this frame. |
| XRCameraFrameProperties | properties | The set of all flags indicating which properties are included in the frame. |
| Single | averageIntensityInLumens | The estimated intensity, in lumens, of the scene. |
| Double | exposureDuration | The camera exposure duration, in seconds with sub-millisecond precision, of the scene. |
| Single | exposureOffset | The camera exposure offset of the scene for lighting scaling. |
| Single | mainLightIntensityInLumens | The estimated intensity in lumens of the most influential real-world light in the scene. |
| Color | mainLightColor | The estimated color of the most influential real-world light in the scene. |
| Vector3 | mainLightDirection | The estimated direction of the most influential real-world light in the scene. |
| SphericalHarmonicsL2 | ambientSphericalHarmonics | The ambient spherical harmonic coefficients that represent lighting in the real-world. |
| XRTextureDescriptor | cameraGrain | A texture that simulates the camera's noise. |
| Single | noiseIntensity | The level of intensity of camera grain noise in a scene. |
Properties
ambientSphericalHarmonics
The ambient spherical harmonic coefficients that represent lighting in the real-world.
Declaration
public readonly SphericalHarmonicsL2 ambientSphericalHarmonics { get; }
Property Value
| Type | Description |
|---|---|
| SphericalHarmonicsL2 | The ambient spherical harmonic coefficients that represent lighting in the real-world. |
Remarks
See Rendering.SphericalHarmonicsL2 for further details.
averageBrightness
The estimated brightness of the scene.
Declaration
public readonly float averageBrightness { get; }
Property Value
| Type | Description |
|---|---|
| Single | The estimated brightness of the scene. |
averageColorTemperature
The estimated color temperature of the scene.
Declaration
public readonly float averageColorTemperature { get; }
Property Value
| Type | Description |
|---|---|
| Single | The estimated color temperature of the scene. |
averageIntensityInLumens
The estimated intensity, in lumens, of the scene.
Declaration
public readonly float averageIntensityInLumens { get; }
Property Value
| Type | Description |
|---|---|
| Single | The estimated intensity, in lumens, of the scene. |
cameraGrain
A texture that simulates the camera's noise.
Declaration
public readonly XRTextureDescriptor cameraGrain { get; }
Property Value
| Type | Description |
|---|---|
| XRTextureDescriptor | A texture that simulates the camera's noise. |
colorCorrection
The estimated color correction value of the scene.
Declaration
public readonly Color colorCorrection { get; }
Property Value
| Type | Description |
|---|---|
| Color | The estimated color correction value of the scene. |
displayMatrix
The 4x4 display matrix for the camera frame.
Declaration
public readonly Matrix4x4 displayMatrix { get; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4 | The 4x4 display matrix for the camera frame. |
exposureDuration
The camera exposure duration, in seconds with sub-millisecond precision, of the scene.
Declaration
public readonly double exposureDuration { get; }
Property Value
| Type | Description |
|---|---|
| Double | The camera exposure duration, in seconds with sub-millisecond precision, of the scene. |
exposureOffset
The camera exposure offset of the scene for lighting scaling.
Declaration
public readonly float exposureOffset { get; }
Property Value
| Type | Description |
|---|---|
| Single | The camera exposure offset of the scene for lighting scaling. |
hasAmbientSphericalHarmonics
True if the frame has the ambient spherical harmonics coefficients of the scene.
Declaration
public readonly bool hasAmbientSphericalHarmonics { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasAverageBrightness
True if the frame has an average brightness.
Declaration
public readonly bool hasAverageBrightness { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasAverageColorTemperature
True if the frame has an average color temperature.
Declaration
public readonly bool hasAverageColorTemperature { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasAverageIntensityInLumens
True if the frame has an average intensity in lumens.
Declaration
public readonly bool hasAverageIntensityInLumens { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasCameraGrain
True if the frame has a camera grain texture.
Declaration
public readonly bool hasCameraGrain { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasColorCorrection
True if the frame has a color correction value.
Declaration
public readonly bool hasColorCorrection { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasDisplayMatrix
True if the frame has a display matrix.
Declaration
public readonly bool hasDisplayMatrix { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasExposureDuration
True if the frame has an exposure duration in seconds with sub-millisecond precision.
Declaration
public readonly bool hasExposureDuration { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasExposureOffset
True if the frame has an exposure offset for scaling lighting.
Declaration
public readonly bool hasExposureOffset { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasMainLightColor
True if the frame has the estimated main light color of the scene.
Declaration
public readonly bool hasMainLightColor { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasMainLightDirection
True if the frame has the estimated main light direction of the scene.
Declaration
public readonly bool hasMainLightDirection { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasMainLightIntensityLumens
True if the frame has the estimated main light channel-wise intensity of the scene.
Declaration
public readonly bool hasMainLightIntensityLumens { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasNoiseIntensity
True if the frame has a camera grain noise.
Declaration
public readonly bool hasNoiseIntensity { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasProjectionMatrix
True if the frame has a projection matrix.
Declaration
public readonly bool hasProjectionMatrix { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
hasTimestamp
True if the frame has a timestamp.
Declaration
public readonly bool hasTimestamp { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
mainLightColor
The estimated color of the most influential real-world light in the scene.
Declaration
public readonly Color mainLightColor { get; }
Property Value
| Type | Description |
|---|---|
| Color | The estimated color of the most influential real-world light in the scene. |
mainLightDirection
The estimated direction of the most influential real-world light in the scene.
Declaration
public readonly Vector3 mainLightDirection { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 | The estimated direction of the most influential real-world light in the scene. |
mainLightIntensityLumens
The estimated intensity in lumens of the most influential real-world light in the scene.
Declaration
public readonly float mainLightIntensityLumens { get; }
Property Value
| Type | Description |
|---|---|
| Single | The estimated intensity in lumens of the most influential real-world light in the scene. |
nativePtr
A native pointer associated with this frame. The data pointed to by this pointer is specific to provider implementation.
Declaration
public readonly IntPtr nativePtr { get; }
Property Value
| Type | Description |
|---|---|
| IntPtr | The native pointer associated with this frame. |
noiseIntensity
The level of intensity of camera grain noise in a scene.
Declaration
public readonly float noiseIntensity { get; }
Property Value
| Type | Description |
|---|---|
| Single | The level of intensity of camera grain noise in a scene. |
projectionMatrix
The 4x4 projection matrix for the camera frame.
Declaration
public readonly Matrix4x4 projectionMatrix { get; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4 | The 4x4 projection matrix for the camera frame. |
properties
The set of all flags indicating which properties are included in the frame.
Declaration
public readonly XRCameraFrameProperties properties { get; }
Property Value
| Type | Description |
|---|---|
| XRCameraFrameProperties | The set of all flags indicating which properties are included in the frame. |
timestampNs
The timestamp, in nanoseconds, associated with this frame.
Declaration
public readonly long timestampNs { get; }
Property Value
| Type | Description |
|---|---|
| Int64 | The timestamp, in nanoseconds, associated with this frame. |
trackingState
The TrackingState associated with the camera.
Declaration
public readonly TrackingState trackingState { get; }
Property Value
| Type | Description |
|---|---|
| TrackingState | The tracking state associated with the camera. |
Methods
Equals(Object)
Compares for equality.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | An |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Overrides
Equals(XRCameraFrame)
Compares for equality.
Declaration
public bool Equals(XRCameraFrame other)
Parameters
| Type | Name | Description |
|---|---|---|
| XRCameraFrame | other | The other XRCameraFrame to compare against. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Implements
GetHashCode()
Generates a hash code suitable for use in HashSet and Dictionary.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | A hash of the XRCameraFrame. |
Overrides
ToString()
Generates a string representation of this XRCameraFrame suitable for debugging purposes.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String | A string representation of this XRCameraFrame. |
Overrides
TryGetAverageBrightness(out Single)
Provides the brightness for the whole image as an average of all pixels' brightness.
Declaration
public bool TryGetAverageBrightness(out float averageBrightness)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | averageBrightness | An estimated average brightness for the environment. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
TryGetAverageColorTemperature(out Single)
Provides the color temperature for the whole image as an average of all pixels' color temperature.
Declaration
public bool TryGetAverageColorTemperature(out float averageColorTemperature)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | averageColorTemperature | An estimated color temperature. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
TryGetAverageIntensityInLumens(out Single)
Provides the intensity, in lumens, for the environment.
Declaration
public bool TryGetAverageIntensityInLumens(out float averageIntensityInLumens)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | averageIntensityInLumens | An estimated average intensity, in lumens, for the environment. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
TryGetDisplayMatrix(out Matrix4x4)
Provides the display matrix defining how texture is being rendered on the screen.
Declaration
public bool TryGetDisplayMatrix(out Matrix4x4 displayMatrix)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4x4 | displayMatrix | The display matrix for rendering. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
TryGetProjectionMatrix(out Matrix4x4)
Provides the projection matrix for the camera frame.
Declaration
public bool TryGetProjectionMatrix(out Matrix4x4 projectionMatrix)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4x4 | projectionMatrix | The projection matrix used by the |
Returns
| Type | Description |
|---|---|
| Boolean |
|
TryGetTimestamp(out Int64)
Provides a timestamp of the camera frame.
Declaration
public bool TryGetTimestamp(out long timestampNs)
Parameters
| Type | Name | Description |
|---|---|---|
| Int64 | timestampNs | The timestamp of the camera frame. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Operators
Equality(XRCameraFrame, XRCameraFrame)
Compares lhs and rhs for equality using Equals(XRCameraFrame).
Declaration
public static bool operator ==(XRCameraFrame lhs, XRCameraFrame rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| XRCameraFrame | lhs | The left-hand-side XRCameraFrame of the comparison. |
| XRCameraFrame | rhs | The right-hand-side XRCameraFrame of the comparison. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Inequality(XRCameraFrame, XRCameraFrame)
Compares lhs and rhs for inequality using Equals(XRCameraFrame).
Declaration
public static bool operator !=(XRCameraFrame lhs, XRCameraFrame rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| XRCameraFrame | lhs | The left-hand-side XRCameraFrame of the comparison. |
| XRCameraFrame | rhs | The right-hand-side XRCameraFrame of the comparison. |
Returns
| Type | Description |
|---|---|
| Boolean |
|