CameraImage
readonly struct NatML.Devices.CameraImage
Camera images provide information about their size:
/// <summary>
/// Image width.
/// </summary>
int width { get; }
The image width.
/// <summary>
/// Image height.
/// </summary>
int height { get; }
The image height.
/// <summary>
/// Image timestamp in nanoseconds.
/// </summary>
long timestamp { get; }
The image timestamp in nanoseconds.
For camera images generated by
CameraDevice
instances, the timestamp is based on the system media clock./// <summary>
/// Image format.
/// </summary>
Format format { get; }
The image format. Only a fixed set of image formats are supported:
/// <summary>
/// Image buffer format.
/// </summary>
enum Format {
/// <summary>
/// Unknown image format.
/// </summary>
Unknown = 0,
/// <summary>
/// Generic YUV 420 planar format.
/// </summary>
YCbCr420 = 1,
/// <summary>
/// RGBA8888.
/// </summary>
RGBA8888 = 2,
/// <summary>
/// BGRA8888.
/// </summary>
BGRA8888 = 3,
}
/// <summary>
/// Whether the image is vertically mirrored.
/// </summary>
bool verticallyMirrored { get; }
Some camera devices generate images that are vertically mirrored, depending on their facing. This property reports whether images should be mirrored to correct this transformation.
The camera image contains either an interleaved or planar pixel buffer, depending on the image
format
./// <summary>
/// Image pixel buffer.
/// </summary>
NativeArray<byte> pixelBuffer { get; }
For interleaved images, the
pixelBuffer
contains a contiguous pixel buffer with the pixel data.Pixel buffers may contain padding bytes, defined by the image
rowStride
.For planar images, the
pixelBuffer
is uninitialized./// <summary>
/// Image plane for planar formats.
/// </summary>
Plane[] planes { get; }
For planar images, the
planes
contains an array of CameraImage.Plane
instances referring to each plane within the image.For interleaved images, the
planes
property is null
./// <summary>
/// Camera device that this buffer was generated from.
/// </summary>
IMediaDevice<CameraImage> device { get; }
The
device
identifies the camera device that the image was generated from.Camera images can provide their EXIF metadata:
/// <summary>
/// Exposure bias value in EV.
/// </summary>
float? exposureBias { get; }
The exposure bias value in EV.
/// <summary>
/// Image exposure duration in seconds.
/// </summary>
float? exposureDuration { get; }
The exposure duration in seconds.
/// <summary>
/// Sensor sensitivity ISO value.
/// </summary>
float? ISO { get; }
The sensor sensitivity ISO value.
/// <summary>
/// Camera focal length in millimeters.
/// </summary>
float? focalLength { get; }
The camera focal length in millimeters.
/// <summary>
/// Image aperture f-number.
/// </summary>
float? fNumber { get; }
The image aperture f-number.
/// <summary>
/// Ambient brightness.
/// </summary>
float? brightness { get; }
The ambient brightness.
/// <summary>
/// Camera intrinsics as a flattened row-major 3x3 matrix.
/// </summary>
float[] intrinsics { get; }
The camera intrinsic matrix in row-major layout.
Last modified 10mo ago