qimage.toTensor(tensor)
Fill the Tensor tensor
with data
from QImage qimage
.
Tensor tensor
must have 2 or 3 dimensions.
The first two dimensions must be equal to the
image width and height respectively.
The third dimension must be 1, 3, or 4
for monochromatic, rgb or rgba images.
The qimage
data will be converted to the desired format
and stored into the tensor, each component being
represented by a floating point number in range 0 to 1.
This function returns the filled tensor.
qimage.toTensor(depth)
Create a tensor with data from image qimage
.
Argument depth
must be 1, 3, or 4
for extracting monochromatic, rgb or rgba data.
When depth
is one, this function returns a two-dimensional tensor.
Otherwise it returns a three-dimensional tensor with
the third dimension equal to depth
.
The first two dimensions are always
the image width and height.