ARSemanticManager
Provides access to the Scene Semantics API.
Summary
Inheritance
Inherits from:UnityEngine::MonoBehaviour
Public functions |
|
---|---|
GetSemanticLabelFraction(SemanticLabel queryLabel)
|
float
Retrieves the percentage of pixels in the most recent semantics image that are
queryLabel . |
IsSemanticModeSupported(SemanticMode mode)
|
Checks whether the provided
SemanticMode is supported on this device with the selected camera configuration. |
TryGetSemanticConfidenceTexture(ref Texture2D texture)
|
bool
Attempts to get a texture representing the semantic confidence image corresponding to the current frame.
|
TryGetSemanticTexture(ref Texture2D texture)
|
bool
Attempts to get a texture representing the semantic image for the current frame.
|
Public functions
GetSemanticLabelFraction
float GetSemanticLabelFraction( SemanticLabel queryLabel )
Retrieves the percentage of pixels in the most recent semantics image that are queryLabel
.
This call is more efficient than retrieving the image and performing a pixel-wise search for the detected label.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The fraction of pixels in the most recent semantic image that contains the query label. This value is in the range 0.0 to 1.0. If no pixels are present with that label, or if an invalid label is provided, this call returns 0.0.
|
IsSemanticModeSupported
FeatureSupported IsSemanticModeSupported( SemanticMode mode )
Checks whether the provided SemanticMode
is supported on this device with the selected camera configuration.
The current list of supported devices is documented on the ARCore supported devices page.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
Indicates whether the given mode is supported on this device. It will return
FeatureSupported.Unknown if the session is still under initialization. |
TryGetSemanticConfidenceTexture
bool TryGetSemanticConfidenceTexture( ref Texture2D texture )
Attempts to get a texture representing the semantic confidence image corresponding to the current frame.
The texture format is TextureFormat.Alpha8
, with each pixel representing the estimated confidence of the corresponding pixel in the semantic image. See the Scene Semantics Developer Guide for more information.
The confidence value is between 0 and 255, inclusive, with 0 representing the lowest confidence and 255 representing the highest confidence in the semantic class prediction.
In order to obtain a valid result from this function, you must set the session's SemanticMode
to SemanticMode.Enabled
. Use ARSemanticManager.IsSemanticModeSupported(SemanticMode)
to query for support for Scene Semantics.
The size of the semantic confidence image is the same size as the image obtained by ARSemanticManager.TryGetSemanticTexture(ref Texture2D)
.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
True if the semantic confidence image texture was filled. Otherwise, false.
|
TryGetSemanticTexture
bool TryGetSemanticTexture( ref Texture2D texture )
Attempts to get a texture representing the semantic image for the current frame.
The texture format is TextureFormat.R8
. Each pixel in the image is an 8-bit unsigned integer representing a semantic class label. SemanticLabel
is the list of possible pixel labels. See the Scene Semantics Developer Guide for more information.
In order to obtain a valid result from this function, you must set the session's SemanticMode
to SemanticMode.Enabled
. Use ARSemanticManager.IsSemanticModeSupported(SemanticMode)
to query for support for Scene Semantics.
The width of the semantic image is currently 256 pixels. The height of the image depends on the device and will match its display aspect ratio.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
True if the semantic image texture was filled. Otherwise, false.
|