Class TextureConverter
Provides methods for converting between textures and tensors.
Inherited Members
Namespace: Unity.Sentis
Syntax
public static class TextureConverter
Methods
RenderToScreen(TensorFloat, TextureTransform)
Write the float data in a tensor to the frame buffer. Sentis only writes batch == 0 to the frame buffer.
If the width and height of the tensor don't match the width and height of the frame buffer, Sentis applies linear resampling.
Declaration
public static void RenderToScreen(TensorFloat tensor, TextureTransform transform = default(TextureTransform))
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | tensor | |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
RenderToScreen(CommandBuffer, TensorFloat, TextureTransform)
Appends the write the float data in a tensor to the frame buffer texture in a CommandBuffer. Sentis only writes batch == 0 to the frame buffer.
If the width and height of the tensor don't match the width and height of the frame buffer, Sentis applies linear resampling.
Declaration
public static void RenderToScreen(CommandBuffer cb, TensorFloat tensor, TextureTransform transform = default(TextureTransform))
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
TensorFloat | tensor | |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
RenderToScreen(CommandBuffer, TensorFloat, RenderTargetIdentifier, TextureTransform)
Appends the write the float data in a tensor to the render target identifier in a CommandBuffer. Sentis only writes batch == 0 to the frame buffer.
If the width and height of the tensor don't match the width and height of the frame buffer, Sentis applies linear resampling.
Declaration
public static void RenderToScreen(CommandBuffer cb, TensorFloat tensor, RenderTargetIdentifier rte, TextureTransform transform = default(TextureTransform))
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
TensorFloat | tensor | |
RenderTargetIdentifier | rte | |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
RenderToTexture(TensorFloat, RenderTexture, TextureTransform)
Write the float data in a tensor to a render texture. Sentis only writes batch == 0 to the render texture.
If the width and height of the tensor don't match the width and height of the render texture, Sentis applies linear resampling.
Declaration
public static void RenderToTexture(TensorFloat tensor, RenderTexture renderTexture, TextureTransform transform = default(TextureTransform))
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | tensor | |
RenderTexture | renderTexture | The render texture to write to. If the value is |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
RenderToTexture(CommandBuffer, TensorFloat, RenderTexture, TextureTransform)
Appends the write the float data in a tensor to a render texture in a CommandBuffer. Sentis only writes batch == 0 to the render texture.
If the width and height of the tensor don't match the width and height of the render texture, Sentis applies linear resampling.
Declaration
public static void RenderToTexture(CommandBuffer cb, TensorFloat tensor, RenderTexture renderTexture, TextureTransform transform = default(TextureTransform))
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
TensorFloat | tensor | |
RenderTexture | renderTexture | The render texture to write to. If the value is |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
ToTensor(CommandBuffer, RenderTargetIdentifier, Tensor, TextureTransform)
Appends the conversion of a RenderTargetIdentifier to a TensorFloat
to a CommandBuffer. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static void ToTensor(CommandBuffer cb, RenderTargetIdentifier rte, Tensor tensor = null, TextureTransform transform = default(TextureTransform))
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
RenderTargetIdentifier | rte | The RenderTargetIdentifier to convert. |
Tensor | tensor | |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
ToTensor(CommandBuffer, Texture, Int32, Int32, Int32)
Appends the conversion of a texture to a TensorFloat
to a CommandBuffer`. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static TensorFloat ToTensor(CommandBuffer cb, Texture texture, int width = -1, int height = -1, int channels = -1)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | |
Texture | texture | The texture to convert. Must be a Texture2D. |
Int32 | width | The width of the output tensor. If the value is -1, Sentis uses the texture to infer the width. |
Int32 | height | The height of the output tensor. If the value is -1, Sentis uses the texture to infer the height. |
Int32 | channels | The numbers of channels of the output tensor. If the value is -1, Sentis uses the texture to infer the number of channels. |
Returns
Type | Description |
---|---|
TensorFloat |
ToTensor(CommandBuffer, Texture, TextureTransform)
Appends the conversion of a texture to a TensorFloat
to a CommandBuffer. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static TensorFloat ToTensor(CommandBuffer cb, Texture texture, TextureTransform transform)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
Texture | texture | The texture to convert. Must be a Texture2D. |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
Returns
Type | Description |
---|---|
TensorFloat |
ToTensor(Texture, Int32, Int32, Int32)
Converts a texture to a TensorFloat
. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static TensorFloat ToTensor(Texture texture, int width = -1, int height = -1, int channels = -1)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to convert. Must be a Texture2D. |
Int32 | width | The width of the output tensor. If the value is -1, Sentis uses the texture to infer the width. |
Int32 | height | The height of the output tensor. If the value is -1, Sentis uses the texture to infer the height. |
Int32 | channels | The numbers of channels of the output tensor. If the value is -1, Sentis uses the texture to infer the number of channels. |
Returns
Type | Description |
---|---|
TensorFloat |
ToTensor(Texture, TextureTransform)
Converts a texture to a TensorFloat
. The number of channels of the output tensor can be at most the number of channels in the input texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static TensorFloat ToTensor(Texture texture, TextureTransform transform)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to convert. Must be a Texture2D. |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
Returns
Type | Description |
---|---|
TensorFloat |
ToTexture(TensorFloat, Int32, Int32, Int32, Boolean)
Converts the data in a tensor to a render texture. Sentis only writes batch == 0 to the render texture.
If the width and height of the render texture don't match the width and height of the tensor, Sentis applies linear resampling.
Declaration
public static RenderTexture ToTexture(TensorFloat tensor, int width = -1, int height = -1, int channels = -1, bool broadcastChannels = false)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | tensor | |
Int32 | width | The width of the output render texture. If the value is -1, Sentis uses the tensor to infer the width. |
Int32 | height | The height of the output render texture. If the value is -1, Sentis uses the tensor to infer the height. |
Int32 | channels | The numbers of channels of the output render texture. If the value is -1, Sentis uses the tensor to infer the number of channels. |
Boolean | broadcastChannels | When the value is |
Returns
Type | Description |
---|---|
RenderTexture |
ToTexture(TensorFloat, TextureTransform)
Converts the data in a tensor to a render texture. Sentis only writes batch == 0 to the render texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static RenderTexture ToTexture(TensorFloat tensor, TextureTransform transform)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | tensor | |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
Returns
Type | Description |
---|---|
RenderTexture |
ToTexture(CommandBuffer, TensorFloat, Int32, Int32, Int32, Boolean)
Appends the convertion of the data in a tensor to a render texture to a CommandBuffer. Sentis only writes batch == 0 to the render texture.
If the width and height of the render texture don't match the width and height of the tensor, Sentis applies linear resampling.
Declaration
public static RenderTexture ToTexture(CommandBuffer cb, TensorFloat tensor, int width = -1, int height = -1, int channels = -1, bool broadcastChannels = false)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | The CommandBuffer buffer to append graphics command to. |
TensorFloat | tensor | |
Int32 | width | The width of the output render texture. If the value is -1, Sentis uses the tensor to infer the width. |
Int32 | height | The height of the output render texture. If the value is -1, Sentis uses the tensor to infer the height. |
Int32 | channels | The numbers of channels of the output render texture. If the value is -1, Sentis uses the tensor to infer the number of channels. |
Boolean | broadcastChannels | When the value is |
Returns
Type | Description |
---|---|
RenderTexture |
ToTexture(CommandBuffer, TensorFloat, TextureTransform)
Appends the conversion of the data in a tensor to a render texture in a CommandBuffer. Sentis only writes batch == 0 to the render texture.
If the width and height of the output tensor don't match the width and height of the texture, Sentis applies linear resampling.
Declaration
public static RenderTexture ToTexture(CommandBuffer cb, TensorFloat tensor, TextureTransform transform)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cb | |
TensorFloat | tensor | |
TextureTransform | transform | The optional settings for the conversion. Refer to TextureTransform for more information. |
Returns
Type | Description |
---|---|
RenderTexture |