package torch
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=7a712ae0e8c7f5452f628377d80a5bb4
sha512=22314b655bc6b5e5c970cbab8d132eae36ee0b8fb0a96b63727899442eb70fe00bd1895d7cc718a85b58bc2b2b4ea6820fa288a19346f095e5de18f7e47c2d02
doc/torch.vision/Torch_vision/Stb_image/index.html
Module Torch_vision.Stb_imageSource
Image representation
type 'kind buffer = ('a, 'b, Bigarray.c_layout) Bigarray.Array1.t constraint 'kind = ('a, 'b) Bigarray.kindbuffer simply is an alias to a bigarray with c_layout. The buffer type serves two purposes:
- representing input files,
- representing the raw pixels of an image.
Two kind of pixel buffers are manipulated:
- int8 for images with 8-bit channels
- float32 for images with floating point channels
type 'kind t = private {width : int;height : int;channels : int;offset : int;stride : int;data : 'kind buffer;
}A record describing an image. The buffer contains channels * width * height items, in this order:
- channels are interleaved
- each pixel is made of
channelsitems - each line is made of
widthpixels - image is made of
heightlines
Creating image
Image accessors
Image decoding
Load an 8-bit per channel image from a filename. If channels is specified, it has to be between 1 and 4 and the decoded image will be processed to have the requested number of channels.
Load a floating point channel image from a filename. See load for channels parameter.
Decode an 8-bit per channel image from a buffer. See load for channels parameter.
Decode a floating point channel image from a buffer. See load for channels parameter.
Low-level interface
Functions are similar to the above one, except memory is not managed by OCaml GC. It has to be released explicitly with free_unmanaged function.
You get slightly faster load times, more deterministic memory use and more responsibility. Use at your own risk!
Image filtering
Generate one level of mipmap: downsample image half in each dimension. In mipmap imgin imgout:
- imgout.channels must be imgin.channels
- imgout.width must be imgin.width / 2
- imgout.height must be imgin.height / 2
- imgout.data will be filled with downsampled imgin.data