View Source Evision.Nx (Evision v0.1.8)

OpenCV's cv::mat to Nx tensor.

Link to this section Summary

external

Converts a tensor of Nx to Mat of evision (OpenCV).

Transform an Evision.Mat reference to Nx.tensor.

Functions

Raising version of to_mat/1.

Raising version of to_mat/2.

Raising version of to_mat_2d/1.

Raising version of to_nx/1.

Raising version of to_nx/2.

Link to this section external

@spec to_mat(Nx.t()) :: {:ok, reference()} | {:error, String.t()}

Converts a tensor of Nx to Mat of evision (OpenCV).

If the tensor has three dimensions, it is expected to have shape{height, width, channels}.

Link to this function

to_mat(binary, type, rows, cols, channels)

View Source
Link to this function

to_nx(mat, backend \\ Evision.Backend)

View Source

Transform an Evision.Mat reference to Nx.tensor.

The resulting tensor is in the shape {height, width, channels}.

example

Example

iex> {:ok, mat} = Evision.imread("/path/to/exist/img.png")
iex> nx_tensor = Evision.Nx.to_nx(mat)
...> #Nx.Tensor<
...>    u8[1080][1920][3]
...>    [[ ... pixel data ... ]]
...> >

Link to this section Functions

Raising version of to_mat/1.

Raising version of to_mat/2.

Link to this function

to_mat!(binary, type, rows, cols, channels)

View Source

Raising version of to_mat/5.

Raising version of to_mat_2d/1.

Raising version of to_nx/1.

Raising version of to_nx/2.