ImageExtensions Module

Type extensions

Type extension Description

Tensor.loadImage (fileName, ?normalize, ?resize, ?device, ?dtype, ?backend)

Full Usage: Tensor.loadImage (fileName, ?normalize, ?resize, ?device, ?dtype, ?backend)

Parameters:
    fileName : string
    ?normalize : bool
    ?resize : int * int
    ?device : Device
    ?dtype : Dtype
    ?backend : Backend

Returns: Tensor

Load an image file and return it as a tensor

Extended Type: Tensor

fileName : string
?normalize : bool
?resize : int * int
?device : Device
?dtype : Dtype
?backend : Backend
Returns: Tensor

dsharp.loadImage (fileName, ?normalize, ?resize, ?device, ?dtype, ?backend)

Full Usage: dsharp.loadImage (fileName, ?normalize, ?resize, ?device, ?dtype, ?backend)

Parameters:
    fileName : string - The file name of the image to load.
    ?normalize : bool - If True, shift the image to the range (0, 1).
    ?resize : int * int - An optional new size for the image.
    ?device : Device - The desired device of returned tensor. Default: if None, uses Device.Default.
    ?dtype : Dtype - The desired element type of returned tensor. Default: if None, uses Dtype.Default.
    ?backend : Backend - The desired backend of returned tensor. Default: if None, uses Backend.Default.

Returns: Tensor

Load an image file as a tensor.

Extended Type: dsharp

fileName : string

The file name of the image to load.

?normalize : bool

If True, shift the image to the range (0, 1).

?resize : int * int

An optional new size for the image.

?device : Device

The desired device of returned tensor. Default: if None, uses Device.Default.

?dtype : Dtype

The desired element type of returned tensor. Default: if None, uses Dtype.Default.

?backend : Backend

The desired backend of returned tensor. Default: if None, uses Backend.Default.

Returns: Tensor

this.saveImage (fileName, ?pixelMin, ?pixelMax, ?normalize, ?resize, ?gridCols)

Full Usage: this.saveImage (fileName, ?pixelMin, ?pixelMax, ?normalize, ?resize, ?gridCols)

Parameters:
    fileName : string
    ?pixelMin : double
    ?pixelMax : double
    ?normalize : bool
    ?resize : int * int
    ?gridCols : int

Save tensor to an image file using png or jpg format

Extended Type: Tensor

fileName : string
?pixelMin : double
?pixelMax : double
?normalize : bool
?resize : int * int
?gridCols : int

dsharp.saveImage (input, fileName, ?pixelMin, ?pixelMax, ?normalize, ?resize, ?gridCols)

Full Usage: dsharp.saveImage (input, fileName, ?pixelMin, ?pixelMax, ?normalize, ?resize, ?gridCols)

Parameters:
    input : Tensor - The input tensor.
    fileName : string - The name of the file to save to.
    ?pixelMin : double - The minimum pixel value.
    ?pixelMax : double - The maximum pixel value.
    ?normalize : bool - If True, shift the image to the range (0, 1), by the min and max values specified by range.
    ?resize : int * int - An optional new size for the image.
    ?gridCols : int - Number of columns of images in the grid.

Save a given Tensor into an image file.

If the input tensor has 4 dimensions, then make a single image grid.

Extended Type: dsharp

input : Tensor

The input tensor.

fileName : string

The name of the file to save to.

?pixelMin : double

The minimum pixel value.

?pixelMax : double

The maximum pixel value.

?normalize : bool

If True, shift the image to the range (0, 1), by the min and max values specified by range.

?resize : int * int

An optional new size for the image.

?gridCols : int

Number of columns of images in the grid.


© Copyright 2021, DiffSharp Contributors.