Struct XRCameraFrame
Represents a frame captured by the device camera with included metadata.
Implements
Inherited Members
Namespace: UnityEngine .XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public struct XRCameraFrame : IEquatable<XRCameraFrame>
Constructors
XRCameraFrame(long, float, float, Color, Matrix4x4, Matrix4x4, TrackingState, IntPtr, XRCameraFrameProperties, float, double, float, float, Color, Vector3, SphericalHarmonicsL2, XRTextureDescriptor, float)
Creates a XRCamera
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 |
---|---|---|
long | timestamp | The timestamp of the frame, in nanoseconds. |
float | averageBrightness | The estimated intensity of the frame, in gamma color space. |
float | averageColorTemperature | The estimated color temperature of the frame. |
Color | colorCorrection | The estimated color correction value of the frame. |
Matrix4x4 | projectionMatrix | The 4x4 projection matrix for the frame. |
Matrix4x4 | displayMatrix | The 4x4 display matrix for the frame. |
Tracking |
trackingState | The camera's Tracking |
Int |
nativePtr | The native pointer associated with the frame. |
XRCamera |
properties | The set of flags that indicates which properties are included in the frame.. |
float | averageIntensityInLumens | The estimated intensity of the real-world environment, in lumens. |
double | exposureDuration | The camera exposure duration of the frame, in seconds with sub-millisecond precision. |
float | exposureOffset | The camera exposure offset of the frame for lighting scaling. |
float | mainLightIntensityInLumens | The estimated intensity in lumens of strongest real-world directional light source. |
Color | mainLightColor | The estimated color of the strongest real-world directional light source. |
Vector3 | mainLightDirection | The estimated direction of the strongest real-world directional light source. |
Spherical |
ambientSphericalHarmonics | The ambient spherical harmonic coefficients that represent the real-world lighting. |
XRTexture |
cameraGrain | A texture that simulates the camera's noise. |
float | noiseIntensity | The level of intensity of camera grain noise in a scene. |
XRCameraFrame(long, float, float, Color, Matrix4x4, Matrix4x4, TrackingState, IntPtr, XRCameraFrameProperties, float, double, float, float, Color, Vector3, SphericalHarmonicsL2, XRTextureDescriptor, float, XRCameraFrameExifData)
Creates a XRCamera
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, XRCameraFrameExifData exifData)
Parameters
Type | Name | Description |
---|---|---|
long | timestamp | The timestamp of the frame, in nanoseconds. |
float | averageBrightness | The estimated intensity of the frame, in gamma color space. |
float | averageColorTemperature | The estimated color temperature of the frame. |
Color | colorCorrection | The estimated color correction value of the frame. |
Matrix4x4 | projectionMatrix | The 4x4 projection matrix for the frame. |
Matrix4x4 | displayMatrix | The 4x4 display matrix for the frame. |
Tracking |
trackingState | The camera's Tracking |
Int |
nativePtr | The native pointer associated with the frame. |
XRCamera |
properties | The set of flags that indicates which properties are included in the frame. |
float | averageIntensityInLumens | The estimated intensity of the real-world environment, in lumens. |
double | exposureDuration | The camera exposure duration of the frame, in seconds with sub-millisecond precision. |
float | exposureOffset | The camera exposure offset of the frame for lighting scaling. |
float | mainLightIntensityInLumens | The estimated intensity in lumens of strongest real-world directional light source. |
Color | mainLightColor | The estimated color of the strongest real-world directional light source. |
Vector3 | mainLightDirection | The estimated direction of the strongest real-world directional light source. |
Spherical |
ambientSphericalHarmonics | The ambient spherical harmonic coefficients that represent the real-world lighting. |
XRTexture |
cameraGrain | A texture that simulates the camera's noise. |
float | noiseIntensity | The level of intensity of camera grain noise in a scene. |
XRCamera |
exifData | The EXIF data. |
Properties
ambientSphericalHarmonics
The ambient spherical harmonic coefficients that represent the real-world lighting.
Declaration
[Obsolete("ambientSphericalHarmonics has been deprecated in AR Foundation version 6.0. Use TryGetAmbientSphericalHarmonics instead.")]
public SphericalHarmonicsL2 ambientSphericalHarmonics { get; }
Property Value
Type | Description |
---|---|
Spherical |
The ambient spherical harmonic coefficients. |
Remarks
See Rendering.SphericalHarmonicsL2 for further details.
averageBrightness
The average pixel intensity of the frame in gamma color space, used to match the intensity of light in the real-world environment. Values are in the range [0.0, 1.0] with zero being black and one being white.
Declaration
[Obsolete("averageBrightness has been deprecated in AR Foundation version 6.0. Use TryGetAverageBrightness instead.")]
public float averageBrightness { get; }
Property Value
Type | Description |
---|---|
float | The average pixel intensity of the frame. |
See Also
averageColorTemperature
The estimated color temperature of ambient light in the frame, in degrees Kelvin.
Declaration
[Obsolete("averageColorTemperature has been deprecated in AR Foundation version 6.0. Use TryGetAverageColorTemperature instead.")]
public float averageColorTemperature { get; }
Property Value
Type | Description |
---|---|
float | The estimated color temperature. |
Remarks
A value of 6500 represents neutral (pure white) lighting; lower values indicate a "warmer" yellow or orange tint, and higher values indicate a "cooler" blue tint.
averageIntensityInLumens
The estimated intensity of the real-world environment, in lumens. Represents an average of directional light sources.
Declaration
[Obsolete("averageIntensityInLumens has been deprecated in AR Foundation version 6.0. Use TryGetAverageIntensityInLumens instead.")]
public float averageIntensityInLumens { get; }
Property Value
Type | Description |
---|---|
float | The estimated intensity. |
See Also
cameraGrain
A texture that simulates the camera's noise.
Declaration
[Obsolete("cameraGrain has been deprecated in AR Foundation version 6.0. Use TryGetCameraGrain instead.")]
public XRTextureDescriptor cameraGrain { get; }
Property Value
Type | Description |
---|---|
XRTexture |
The camera grain texture. |
colorCorrection
The estimated color correction value of the frame.
Declaration
[Obsolete("colorCorrection has been deprecated in AR Foundation version 6.0. Use TryGetColorCorrection instead.")]
public Color colorCorrection { get; }
Property Value
Type | Description |
---|---|
Color | The color correction value. |
Remarks
The RGB scale factors are not intended to brighten nor dim the scene. They are only to shift the color of virtual objects towards the color of the light; not intensity of the light.
displayMatrix
The 4x4 display matrix for the frame. Defines how to render the frame to the screen.
Declaration
[Obsolete("displayMatrix has been deprecated in AR Foundation version 6.0. Use TryGetDisplayMatrix instead.")]
public Matrix4x4 displayMatrix { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 | The display matrix. |
exposureDuration
The camera exposure duration of the frame, in seconds with sub-millisecond precision.
Declaration
[Obsolete("exposureDuration has been deprecated in AR Foundation version 6.0. Use TryGetExposureDuration instead.")]
public double exposureDuration { get; }
Property Value
Type | Description |
---|---|
double | The camera exposure duration. |
exposureOffset
The camera exposure offset of the frame for lighting scaling.
Declaration
[Obsolete("exposureOffset has been deprecated in AR Foundation version 6.0. Use TryGetExposureOffset instead.")]
public float exposureOffset { get; }
Property Value
Type | Description |
---|---|
float | The camera exposure offset. |
hasAmbientSphericalHarmonics
Indicates whether ambient
Declaration
[Obsolete("hasAmbientSphericalHarmonics has been deprecated in AR Foundation version 6.0. Use TryGetAmbientSphericalHarmonics instead.")]
public bool hasAmbientSphericalHarmonics { get; }
Property Value
Type | Description |
---|---|
bool | true if the frame has values for ambient spherical harmonics coefficients. Otherwise, false. |
hasAverageBrightness
Indicates whether average
Declaration
[Obsolete("hasAverageBrightness has been deprecated in AR Foundation version 6.0. Use TryGetAverageBrightness instead.")]
public bool hasAverageBrightness { get; }
Property Value
hasAverageColorTemperature
Indicates whether average
Declaration
[Obsolete("hasAverageColorTemperature has been deprecated in AR Foundation version 6.0. Use TryGetAverageColorTemperature instead.")]
public bool hasAverageColorTemperature { get; }
Property Value
hasAverageIntensityInLumens
Indicates whether average
Declaration
[Obsolete("hasAverageIntensityInLumens has been deprecated in AR Foundation version 6.0. Use TryGetAverageIntensityInLumens instead.")]
public bool hasAverageIntensityInLumens { get; }
Property Value
hasCameraGrain
Indicates whether camera
Declaration
[Obsolete("hasCameraGrain has been deprecated in AR Foundation version 6.0. Use TryGetCameraGrain instead.")]
public bool hasCameraGrain { get; }
Property Value
hasColorCorrection
Indicates whether color
Declaration
[Obsolete("hasColorCorrection has been deprecated in AR Foundation version 6.0. Use TryGetColorCorrection instead.")]
public bool hasColorCorrection { get; }
Property Value
hasDisplayMatrix
Indicates whether display
Declaration
[Obsolete("hasDisplayMatrix has been deprecated in AR Foundation version 6.0. Use TryGetDisplayMatrix instead.")]
public bool hasDisplayMatrix { get; }
Property Value
hasExposureDuration
Indicates whether exposure
Declaration
[Obsolete("hasExposureDuration has been deprecated in AR Foundation version 6.0. Use TryGetExposureDuration instead.")]
public bool hasExposureDuration { get; }
Property Value
hasExposureOffset
Indicates whether exposure
Declaration
[Obsolete("hasExposureOffset has been deprecated in AR Foundation version 6.0. Use TryGetExposureOffset instead.")]
public bool hasExposureOffset { get; }
Property Value
hasMainLightColor
Indicates whether main
Declaration
[Obsolete("hasMainLightColor has been deprecated in AR Foundation version 6.0. Use TryGetMainLightColor instead.")]
public bool hasMainLightColor { get; }
Property Value
hasMainLightDirection
Indicates whether main
Declaration
[Obsolete("hasMainLightDirection has been deprecated in AR Foundation version 6.0. Use TryGetMainLightDirection instead.")]
public bool hasMainLightDirection { get; }
Property Value
Type | Description |
---|---|
bool | true if the frame has an estimated main light direction value. Otherwise, false. |
hasMainLightIntensityLumens
Indicates whether main
Declaration
[Obsolete("hasMainLightIntensityLumens has been deprecated in AR Foundation version 6.0. Use TryGetMainLightIntensityLumens instead.")]
public bool hasMainLightIntensityLumens { get; }
Property Value
Type | Description |
---|---|
bool | true if the frame has an estimated main light intensity value. Otherwise, false. |
hasNoiseIntensity
Indicates whether noise
Declaration
[Obsolete("hasNoiseIntensity has been deprecated in AR Foundation version 6.0. Use TryGetNoiseIntensity instead.")]
public bool hasNoiseIntensity { get; }
Property Value
hasProjectionMatrix
Indicates whether projection
Declaration
[Obsolete("hasProjectionMatrix has been deprecated in AR Foundation version 6.0. Use TryGetProjectionMatrix instead.")]
public bool hasProjectionMatrix { get; }
Property Value
hasTimestamp
Indicates whether timestamp
Declaration
[Obsolete("hasTimestamp has been deprecated in AR Foundation version 6.0. Use TryGetTimestamp instead.")]
public bool hasTimestamp { get; }
Property Value
mainLightColor
The estimated color of the strongest directional light source in the real-world environment.
Declaration
[Obsolete("mainLightColor has been deprecated in AR Foundation version 6.0. Use TryGetMainLightColor instead.")]
public Color mainLightColor { get; }
Property Value
Type | Description |
---|---|
Color | The estimated color of the main light. |
mainLightDirection
The estimated direction of the strongest directional light source in the real-world environment.
Declaration
[Obsolete("mainLightDirection has been deprecated in AR Foundation version 6.0. Use TryGetMainLightDirection instead.")]
public Vector3 mainLightDirection { get; }
Property Value
Type | Description |
---|---|
Vector3 | The estimated direction of the main light. |
mainLightIntensityLumens
The estimated intensity in lumens of the strongest directional light source in the real-world environment.
Declaration
[Obsolete("mainLightIntensityLumens has been deprecated in AR Foundation version 6.0. Use TryGetMainLightIntensityLumens instead.")]
public float mainLightIntensityLumens { get; }
Property Value
Type | Description |
---|---|
float | The estimated intensity of the main light. |
nativePtr
The native pointer associated with this frame. The data pointed to by this pointer is specific to provider implementation.
Declaration
public IntPtr nativePtr { get; }
Property Value
Type | Description |
---|---|
Int |
The native pointer. |
noiseIntensity
The level of intensity of camera grain noise in a scene.
Declaration
[Obsolete("noiseIntensity has been deprecated in AR Foundation version 6.0. Use TryGetNoiseIntensity instead.")]
public float noiseIntensity { get; }
Property Value
Type | Description |
---|---|
float | The noise intensity. |
projectionMatrix
The 4x4 projection matrix for the frame.
Declaration
[Obsolete("projectionMatrix has been deprecated in AR Foundation version 6.0. Use TryGetProjectionMatrix instead.")]
public Matrix4x4 projectionMatrix { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 | The projection matrix. |
properties
The set of flags that indicates which properties are included in the frame.
Declaration
public XRCameraFrameProperties properties { get; }
Property Value
Type | Description |
---|---|
XRCamera |
The included camera frame properties. |
timestampNs
The timestamp of the frame, in nanoseconds.
Declaration
[Obsolete("timestampNs has been deprecated in AR Foundation version 6.0. Use TryGetTimestamp instead.")]
public long timestampNs { get; }
Property Value
Type | Description |
---|---|
long | The timestamp. |
trackingState
The camera's Tracking
Declaration
public TrackingState trackingState { get; }
Property Value
Type | Description |
---|---|
Tracking |
The tracking state. |
Methods
Equals(object)
Compares for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | An |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
Equals(XRCameraFrame)
Compares for equality.
Declaration
public bool Equals(XRCameraFrame other)
Parameters
Type | Name | Description |
---|---|---|
XRCamera |
other | The other XRCamera |
Returns
Type | Description |
---|---|
bool | true if the XRCamera |
GetHashCode()
Generates a hash code suitable for use in HashSet
and Dictionary
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash of this XRCamera |
Overrides
ToString()
Generates a string representation of this XRCamera
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string representation of this XRCamera |
Overrides
TryGetAmbientSphericalHarmonics(out SphericalHarmonicsL2)
Get the ambient spherical harmonic coefficients of the frame, if possible.
Declaration
public bool TryGetAmbientSphericalHarmonics(out SphericalHarmonicsL2 ambientSphericalHarmonics)
Parameters
Type | Name | Description |
---|---|---|
Spherical |
ambientSphericalHarmonics | The ambient spherical harmonic coefficients of the frame. Equal to ambient |
Returns
Type | Description |
---|---|
bool | true if the frame has values for ambient spherical harmonics coefficients. Otherwise, false. |
TryGetAverageBrightness(out float)
Get the average brightness of the frame if possible.
Declaration
public bool TryGetAverageBrightness(out float averageBrightness)
Parameters
Type | Name | Description |
---|---|---|
float | averageBrightness | The average pixel intensity of the frame, equal to average |
Returns
Type | Description |
---|---|
bool | true if the frame has an average brightness value. Otherwise, false.
Equal to has |
TryGetAverageColorTemperature(out float)
Get the estimated color temperature of the frame if possible.
Declaration
public bool TryGetAverageColorTemperature(out float averageColorTemperature)
Parameters
Type | Name | Description |
---|---|---|
float | averageColorTemperature | The estimated color temperature of the frame, in degrees Kelvin.
Equal to average |
Returns
Type | Description |
---|---|
bool | true if the frame has an estimated color temperature value. Otherwise, false.
Equal to has |
TryGetAverageIntensityInLumens(out float)
Get the estimated intensity in lumens of the real-world environment, if possible.
Declaration
public bool TryGetAverageIntensityInLumens(out float averageIntensityInLumens)
Parameters
Type | Name | Description |
---|---|---|
float | averageIntensityInLumens | The estimated intensity. Equal to average |
Returns
Type | Description |
---|---|
bool | true if the frame has an estimated intensity value in lumens. Otherwise, false. |
TryGetCameraGrain(out XRTextureDescriptor)
Get the camera grain texture of the frame, if possible.
Declaration
public bool TryGetCameraGrain(out XRTextureDescriptor cameraGrain)
Parameters
Type | Name | Description |
---|---|---|
XRTexture |
cameraGrain | The camera grain texture of the frame. Equal to camera |
Returns
TryGetColorCorrection(out Color)
Get the color correction value of the frame if possible.
Declaration
public bool TryGetColorCorrection(out Color colorCorrection)
Parameters
Type | Name | Description |
---|---|---|
Color | colorCorrection | The color correction value of the frame.
Equal to color |
Returns
TryGetDisplayMatrix(out Matrix4x4)
Get the display matrix for the frame if possible.
Declaration
public bool TryGetDisplayMatrix(out Matrix4x4 displayMatrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | displayMatrix | The display matrix. It is row-major and includes flipping the y-axis of the texture
coordinates. Equal to display |
Returns
TryGetExifData(out XRCameraFrameExifData)
Get the frame's EXIF data, if possible.
Declaration
public bool TryGetExifData(out XRCameraFrameExifData exifData)
Parameters
Type | Name | Description |
---|---|---|
XRCamera |
exifData | The EXIF data. |
Returns
TryGetExposureDuration(out double)
Get the camera exposure duration of the frame, if possible.
Declaration
public bool TryGetExposureDuration(out double exposureDuration)
Parameters
Type | Name | Description |
---|---|---|
double | exposureDuration | The camera exposure duration of the frame. Equal to exposure |
Returns
TryGetExposureOffset(out float)
Get the camera exposure offset of the frame, if possible.
Declaration
public bool TryGetExposureOffset(out float exposureOffset)
Parameters
Type | Name | Description |
---|---|---|
float | exposureOffset | The camera exposure offset of the frame. Equal to exposure |
Returns
TryGetMainLightColor(out Color)
Get the estimated main light color of the frame, if possible.
Declaration
public bool TryGetMainLightColor(out Color mainLightColor)
Parameters
Type | Name | Description |
---|---|---|
Color | mainLightColor | The estimated main light color of the frame. Equal to main |
Returns
TryGetMainLightDirection(out Vector3)
Get the estimated main light direction of the frame, if possible.
Declaration
public bool TryGetMainLightDirection(out Vector3 mainLightDirection)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | mainLightDirection | The estimated main light direction of the frame. Equal to main |
Returns
Type | Description |
---|---|
bool | true if the frame has an estimated main light direction value. Otherwise, false. |
TryGetMainLightIntensityLumens(out float)
Get the estimated main light intensity of the frame, if possible.
Declaration
public bool TryGetMainLightIntensityLumens(out float mainLightIntensityLumens)
Parameters
Type | Name | Description |
---|---|---|
float | mainLightIntensityLumens | The estimated main light intensity of the frame. Equal to main |
Returns
Type | Description |
---|---|
bool | true if the frame has an estimated main light intensity value. Otherwise, false. |
TryGetNoiseIntensity(out float)
Get the camera grain noise intensity of the frame, if possible.
Declaration
public bool TryGetNoiseIntensity(out float noiseIntensity)
Parameters
Type | Name | Description |
---|---|---|
float | noiseIntensity | The camera grain noise intensity of the frame. Equal to noise |
Returns
TryGetProjectionMatrix(out Matrix4x4)
Get the projection matrix for the frame if possible.
Declaration
public bool TryGetProjectionMatrix(out Matrix4x4 projectionMatrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | projectionMatrix | The projection matrix. Equal to projection |
Returns
TryGetTimestamp(out long)
Get the timestamp of the frame if possible.
Declaration
public bool TryGetTimestamp(out long timestampNs)
Parameters
Type | Name | Description |
---|---|---|
long | timestampNs | The timestamp of the camera frame, equal to timestamp |
Returns
Type | Description |
---|---|
bool | true if the frame has a timestamp. Otherwise, false.
Equal to has |
Operators
operator ==(XRCameraFrame, XRCameraFrame)
Compares lhs
and rhs
for equality using Equals(XRCamera
Declaration
public static bool operator ==(XRCameraFrame lhs, XRCameraFrame rhs)
Parameters
Type | Name | Description |
---|---|---|
XRCamera |
lhs | The left-hand-side XRCamera |
XRCamera |
rhs | The right-hand-side XRCamera |
Returns
operator !=(XRCameraFrame, XRCameraFrame)
Compares lhs
and rhs
for inequality using Equals(XRCamera
Declaration
public static bool operator !=(XRCameraFrame lhs, XRCameraFrame rhs)
Parameters
Type | Name | Description |
---|---|---|
XRCamera |
lhs | The left-hand-side XRCamera |
XRCamera |
rhs | The right-hand-side XRCamera |