TextureOutput
class NatML.Devices.Outputs.TextureOutput : CameraOutput
The TextureOutput
streams CameraImage
instances into a Texture2D
.
The TextureOutput
uses the PixelBufferOutput
to convert images to RGBA888
before uploading to the GPU.
Creating the Output
The texture output is trivially constructed.
Specifying the Orientation
The texture output supports specifying the desired output orientation of the converted texture.
This is especially useful on mobile devices where camera images are always returned in the "natural orientation" of the camera device.
This property is only supported on Android and iOS.
Updating with New Images
The output will convert the CameraImage
into an RGBA8888
pixel buffer and upload it to the GPU. The output supports specifying options that are used when converting the image:
The provided options
can be null
, in which case reasonable defaults are used.
Conversion Options
The ConversionOptions
expose some options that can be used when performing the conversion.
Accessing the Texture
When the output has been updated with a CameraImage
, the texture
will contain the converted pixel data in the correct pixel format and orientation, available in both system and GPU memory.
The format of the texture
is always TextureFormat.RGBA32
.
The texture data is accessible both on the GPU and on the CPU using the Texture2D
data access methods.
Disposing the Output
Refer to the Disposing the Output section of the CameraOutput
class for more information.
Last updated