View Source Vix.Tensor (vix v0.19.0)
Struct to hold raw pixel data returned by the libvips along with metadata about the binary.
Useful for interoperability between other libraries like Nx, Evision.
See Vix.Vips.Image.write_to_tensor/1
to convert an vix image to tensor.
Link to this section Summary
Types
Struct to hold raw pixel data returned by the Libvips along with metadata about the binary.
Type of the image pixel when image is represented as Tensor.
Functions
Convert Vix image pixel format to Nx tensor type
Link to this section Types
@type t() :: %Vix.Tensor{ data: binary(), names: list(), shape: {non_neg_integer(), non_neg_integer(), non_neg_integer()}, type: tensor_type() }
Struct to hold raw pixel data returned by the Libvips along with metadata about the binary.
:names
will always be [:width, :height, :bands]
@type tensor_type() ::
{:u, 8}
| {:s, 8}
| {:u, 16}
| {:s, 16}
| {:u, 32}
| {:s, 32}
| {:f, 32}
| {:f, 64}
Type of the image pixel when image is represented as Tensor.
This type is useful for interoperability between different libraries. Type value is same as Nx.Type.t()
Link to this section Functions
@spec type(image :: Vix.Vips.Image.t()) :: tensor_type() | no_return()
Convert Vix image pixel format to Nx tensor type
Vix internally uses libvips image format. To ease the interoperability between Vix and other elixir libraries, we can use this function.