View Source Evision.Nx (Evision v0.1.9)
OpenCV's cv::mat to Nx tensor.
Link to this section Summary
external
Transform an Evision.Mat
reference to Nx.tensor
.
Link to this section external
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}
.
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 ... ]]
...> >