This class implements read and write functions for NPY (NumPy) images.
More...
#include <ImageNpy.h>
This class implements read and write functions for NPY (NumPy) images.
◆ decodeImage()
| static Frame Ocean::Media::Special::ImageNpy::decodeImage |
( |
const void * |
buffer, |
|
|
const size_t |
size |
|
) |
| |
|
static |
Decodes a NPY image from a given binary buffer.
- Parameters
-
| buffer | The buffer from which the image will be loaded, must be valid |
| size | The size of the given buffer in bytes, with range [1, infinity) |
- Returns
- The frame containing the image information, an invalid frame if the image could not be loaded
◆ encodeImage()
| static bool Ocean::Media::Special::ImageNpy::encodeImage |
( |
const Frame & |
frame, |
|
|
std::vector< uint8_t > & |
buffer |
|
) |
| |
|
static |
Encodes a given frame as NPY image to a resulting buffer.
- Parameters
-
| frame | The frame to be written, must be valid |
| buffer | The resulting buffer storing the binary information of the NPY image |
- Returns
- True, if succeeded
◆ isFrameTypeSupported()
Returns whether a given pixel format together with a given pixel origin is supported natively.
- Parameters
-
| pixelFormat | The pixel format to be checked |
| pixelOrigin | The pixel origin to be checked |
- Returns
- True, if so; False, if a conversion will be necessary
◆ isPixelFormatSupported()
Returns whether a given pixel format is supported natively.
- Parameters
-
| pixelFormat | The pixel format to be checked |
- Returns
- True, if so; False, if a conversion will be necessary
◆ isPixelOriginSupported()
Returns whether a given pixel origin is supported natively.
- Parameters
-
| pixelOrigin | The pixel origin to be checked |
- Returns
- True, if so; False, if a conversion will be necessary
◆ readHeader()
| static bool Ocean::Media::Special::ImageNpy::readHeader |
( |
const uint8_t *& |
data, |
|
|
size_t & |
size, |
|
|
FrameType & |
frameType, |
|
|
bool & |
isRowMajor, |
|
|
bool & |
isBigEndian |
|
) |
| |
|
staticprotected |
Reads the header of a NPY file.
- Parameters
-
| data | The data buffer, will be moved if the header could be read successfully, must be valid |
| size | The size of the buffer in bytes, will be reduced if the header could be read successfully, must be valid |
| frameType | The resulting frame type |
| isRowMajor | True, if the data is given in row-major order; False, if the data is given in column-major order |
| isBigEndian | True, if the elements are stored in big endian order; False, if they are stored in little endian order or if the byte order does not apply |
- Returns
- True, if succeeded
◆ swapByteOrder()
| static bool Ocean::Media::Special::ImageNpy::swapByteOrder |
( |
Frame & |
frame | ) |
|
|
staticprotected |
Swaps the byte order of every element of a frame in place.
The frame must hold one channel, elements of one byte are left unchanged.
- Parameters
-
| frame | The frame to be swapped, must be valid |
- Returns
- True, if succeeded
◆ translatePixelFormat() [1/2]
| static std::string Ocean::Media::Special::ImageNpy::translatePixelFormat |
( |
const FrameType::PixelFormat |
pixelFormat | ) |
|
|
staticprotected |
Translates the pixel format.
- Parameters
-
| pixelFormat | The pixel format to be translated |
- Returns
- The resulting pixel format as string, empty if unknown
◆ translatePixelFormat() [2/2]
| static FrameType::PixelFormat Ocean::Media::Special::ImageNpy::translatePixelFormat |
( |
const std::string & |
pixelFormat | ) |
|
|
staticprotected |
Translates the pixel format.
- Parameters
-
| pixelFormat | The pixel format to be translated given as string |
- Returns
- The resulting pixel format, FORMAT_UNDEFINED if unknown
The documentation for this class was generated from the following file: