ImageFormat.Depth16 Field
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
This constant will be removed in the future version. Use Android.Graphics.ImageFormatType enum directly instead of this field.
Android dense depth image format.
[Android.Runtime.Register("DEPTH16", ApiSince=23)]
[System.Obsolete("This constant will be removed in the future version. Use Android.Graphics.ImageFormatType enum directly instead of this field.", true)]
public const Android.Graphics.ImageFormatType Depth16 = 1144402265;
[<Android.Runtime.Register("DEPTH16", ApiSince=23)>]
[<System.Obsolete("This constant will be removed in the future version. Use Android.Graphics.ImageFormatType enum directly instead of this field.", true)>]
val mutable Depth16 : Android.Graphics.ImageFormatType
Field Value
Value = 1144402265- Attributes
Remarks
Android dense depth image format.
Each pixel is 16 bits, representing a depth ranging measurement from a depth camera or similar sensor. The 16-bit sample consists of a confidence value and the actual ranging measurement.
The confidence value is an estimate of correctness for this sample. It is encoded in the 3 most significant bits of the sample, with a value of 0 representing 100% confidence, a value of 1 representing 0% confidence, a value of 2 representing 1/7, a value of 3 representing 2/7, and so on.
As an example, the following sample extracts the range and confidence from the first pixel of a DEPTH16-format android.media.Image
, and converts the confidence to a floating-point value between 0 and 1.f inclusive, with 1.f representing maximum confidence:
ShortBuffer shortDepthBuffer = img.getPlanes()[0].getBuffer().asShortBuffer();
short depthSample = shortDepthBuffer.get()
short depthRange = (short) (depthSample & 0x1FFF);
short depthConfidence = (short) ((depthSample >> 13) & 0x7);
float depthPercentage = depthConfidence == 0 ? 1.f : (depthConfidence - 1) / 7.f;
</p>
This format assumes <ul> <li>an even width</li> <li>an even height</li> <li>a horizontal stride multiple of 16 pixels</li> </ul>
y_size = stride * height
When produced by a camera, the units for the range are millimeters.
Java documentation for android.graphics.ImageFormat.DEPTH16
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.