Class representing a multi-dimensional array (Tensor), typically used for deep learning inference. More...
Functions | |
| Tensor (const TensorParameters ¶ms={}) | |
| Default constructor. More... | |
| Tensor (const Tensor &tensor) | |
| Copy constructor (shallow copy). More... | |
| void | alloc (const TensorParameters ¶ms) |
| Allocates the Tensor memory. More... | |
| std::vector< size_t > | getDims () const |
| Returns the dimensions of the Tensor. More... | |
| size_t | getElementCount () const |
| Returns the total number of elements in the Tensor. More... | |
| TensorParameters | getParameters () const |
| Returns the parameters used to create or define the Tensor. More... | |
| void | alloc (size_t width, size_t height, MAT_TYPE mat_type, MEM memory_type=MEM::CPU) |
| Allocates the sl::Mat memory. More... | |
| void | alloc (Resolution resolution, MAT_TYPE mat_type, MEM memory_type=MEM::CPU) |
| Allocates the sl::Mat memory. More... | |
| void | free (MEM memory_type=MEM::BOTH) |
| Free the owned memory. More... | |
| ERROR_CODE | updateCPUfromGPU (cudaStream_t stream=0) |
| Downloads data from DEVICE (GPU) to HOST (CPU), if possible. More... | |
| ERROR_CODE | updateGPUfromCPU (cudaStream_t stream=0, int GPU_id=0) |
| Uploads data from HOST (CPU) to DEVICE (GPU), if possible. More... | |
| ERROR_CODE | copyTo (Mat &dst, COPY_TYPE cpyType=COPY_TYPE::CPU_CPU, cudaStream_t stream=0) const |
| Copies data an other sl::Mat (deep copy). More... | |
| ERROR_CODE | setFrom (const Mat &src, COPY_TYPE cpyType=COPY_TYPE::CPU_CPU, cudaStream_t stream=0) |
| Copies data from an other sl::Mat (deep copy). More... | |
| ERROR_CODE | read (const String &filePath) |
| Reads an image from a file. More... | |
| ERROR_CODE | write (const String &filePath, sl::MEM memory_type=sl::MEM::CPU, int compression_level=-1) |
| Writes the sl::Mat (only if sl::MEM::CPU is available) into a file defined by its extension. More... | |
| template<typename T > | |
| ERROR_CODE | setTo (const T &value, const sl::MEM memory_type=MEM::CPU, cudaStream_t stream=0) |
| Fills the sl::Mat with the given value. More... | |
| template<typename N > | |
| ERROR_CODE | setValue (const size_t x, const size_t y, const N &value, const sl::MEM memory_type=MEM::CPU) |
| Sets a value to a specific point in the matrix. More... | |
| template<typename N > | |
| ERROR_CODE | getValue (const size_t x, const size_t y, N *value, const MEM memory_type=MEM::CPU) const |
| Get the value of a specific point in the matrix. More... | |
| size_t | getWidth () const |
| Returns the width of the matrix. More... | |
| size_t | getHeight () const |
| Returns the height of the matrix. More... | |
| const Resolution & | getResolution () const & |
| Returns the resolution (width and height) of the matrix. More... | |
| Resolution | getResolution () && |
| Returns the resolution (width and height) of the matrix. More... | |
| void | getResolution () const &&=delete |
| Prevent method from being called by temporaries (such as rvalue) More... | |
| size_t | getChannels () const |
| Returns the number of values stored in one pixel. More... | |
| MAT_TYPE | getDataType () const |
| Returns the format of the matrix. More... | |
| MEM | getMemoryType () const |
| Returns the type of memory (CPU and/or GPU). More... | |
| template<typename N > | |
| N * | getPtr (const MEM memory_type=MEM::CPU) const |
| Returns the CPU or GPU data pointer. More... | |
| size_t | getStepBytes (const MEM memory_type=MEM::CPU) const |
| Returns the memory step in bytes (size of one pixel row). More... | |
| template<typename N > | |
| size_t | getStep (const MEM memory_type=MEM::CPU) const |
| Returns the memory step in number of elements (size in one pixel row). More... | |
| size_t | getStep (MEM memory_type=MEM::CPU) const |
| Returns the memory step in number of elements (size in one pixel row). More... | |
| size_t | getPixelBytes () const |
| Returns the size of one pixel in bytes. More... | |
| size_t | getWidthBytes () const |
| Returns the size of a row in bytes. More... | |
| String | getInfos () const |
| Returns the information about the sl::Mat into a sl::String. More... | |
| bool | isInit () const |
| Returns whether the sl::Mat is initialized or not. More... | |
| bool | isMemoryOwner () const |
| Returns whether the sl::Mat is the owner of the memory it accesses. More... | |
| ERROR_CODE | clone (const Mat &src) |
| Duplicates a sl::Mat by copy (deep copy). More... | |
| ERROR_CODE | move (Mat &dst) |
| Moves the data of the sl::Mat to another sl::Mat. More... | |
| ERROR_CODE | convertColor (sl::MEM memory=sl::MEM::CPU, cudaStream_t stream=0, bool swap_RB_channels=true) |
| Convert the color channels of the Mat (RGB<->BGR or RGBA<->BGRA) This methods works only on 8U_C4 or 8U_C3. More... | |
Static Functions | |
| static ERROR_CODE | convertColor (Mat &mat1, Mat &mat2, bool swap_RB_channels, bool remove_alpha_channels, sl::MEM memory=sl::MEM::CPU, cudaStream_t stream=0) |
| Convert the color channels of the Mat into another Mat This methods works only on 8U_C4 if remove_alpha_channels is enabled, or 8U_C4 and 8U_C3 if swap_RB_channels is enabled The inplace method sl::Mat::convertColor can be used for only swapping the Red and Blue channel efficiently. More... | |
| static void | swap (Mat &mat1, Mat &mat2) |
| Swaps the content of the provided sl::Mat (only swaps the pointers, no data copy). More... | |
Attributes | |
| String | name |
| Variable used in verbose mode to indicate which sl::Mat is printing informations. More... | |
| bool | verbose = false |
| Whether the sl::Mat can display informations. More... | |
| Timestamp | timestamp = 0 |
| Timestamp of the last manipulation of the data of the matrix by a method/function. More... | |
Protected Member Functions | |
| void | ref (const Mat &mat) |
Protected Attributes | |
| Resolution | size |
| size_t | channels = 0 |
| size_t | step_gpu = 0 |
| size_t | step_cpu = 0 |
| size_t | pixel_bytes = 0 |
| MAT_TYPE | data_type = MAT_TYPE::U8_C1 |
| MEM | mem_type = MEM::CPU |
| std::shared_ptr< uchar1 > | ptr_cpu = NULL |
| std::shared_ptr< uchar1 > | ptr_gpu = NULL |
| bool | init = false |
| bool | memory_owner = false |
Class representing a multi-dimensional array (Tensor), typically used for deep learning inference.
| Tensor | ( | const TensorParameters & | params = {} | ) |
Default constructor.
| params | : Parameters defining the Tensor creation and pre-processing. |
Copy constructor (shallow copy).
| tensor | : The sl::Tensor to copy. |
| void alloc | ( | const TensorParameters & | params | ) |
| std::vector<size_t> getDims | ( | ) | const |
Returns the dimensions of the Tensor.
| size_t getElementCount | ( | ) | const |
Returns the total number of elements in the Tensor.
| TensorParameters getParameters | ( | ) | const |
Returns the parameters used to create or define the Tensor.
|
protectedinherited |
Allocates the sl::Mat memory.
| width | : Width of the matrix in pixels. |
| height | : Height of the matrix in pixels. |
| mat_type | : Type of the matrix (sl::MAT_TYPE::F32_C1, sl::MAT_TYPE::U8_C4, etc.). |
| memory_type | : Where the buffer will be stored (sl::MEM::CPU and/or sl::MEM::GPU). |
|
inherited |
Allocates the sl::Mat memory.
| resolution | : Size of the matrix in pixels. |
| mat_type | : Type of the matrix (sl::MAT_TYPE::F32_C1, sl::MAT_TYPE::U8_C4, etc.). |
| memory_type | : Where the buffer will be stored (sl::MEM::CPU and/or sl::MEM::GPU). |
Free the owned memory.
| memory_type | : Specifies whether you want to free the sl::MEM::CPU and/or sl::MEM::GPU memory. |
|
inherited |
Downloads data from DEVICE (GPU) to HOST (CPU), if possible.
| stream | : Specifies the GPU stream to be used to enable asynchronous overlapping. Default: 0 (synchronous) |
|
inherited |
Uploads data from HOST (CPU) to DEVICE (GPU), if possible.
| stream | : Specifies the GPU stream to be used to enable asynchronous overlapping. Default: 0 (synchronous) |
| GPU_id | : Specifies the GPU id to be used. Default: 0 (first GPU). |
|
inherited |
Copies data an other sl::Mat (deep copy).
| dst | : sl::Mat where the data will be copied. |
| cpyType | : Specifies the memory that will be used for the copy. |
| stream | : Specifies the GPU stream to be used to enable asynchronous overlapping. Default: 0 (synchronous) |
|
inherited |
Copies data from an other sl::Mat (deep copy).
| src | : sl::Mat where the data will be copied from. |
| cpyType | : Specifies the memory that will be used for the copy. |
| stream | : Specifies the GPU stream to be used to enable asynchronous overlapping. Default: 0 (synchronous) |
|
inherited |
Reads an image from a file.
| filePath | : Path of the file to read (including the name and extension). |
|
inherited |
Writes the sl::Mat (only if sl::MEM::CPU is available) into a file defined by its extension.
| filePath | : Path of the file to write in (including the name and extension). |
| memory_type | : Memory type (CPU or GPU) of the sl::Mat. |
| compression_level | : Level of compression between 0 (lowest compression == highest size == highest quality(jpg)) and 100 (highest compression == lowest size == lowest quality(jpg)). |
|
inherited |
Fills the sl::Mat with the given value.
This method overwrites all the matrix.
| value | : Value to be copied all over the matrix. |
| memory_type | : Which buffer to fill, CPU and/or GPU. |
| stream | : a cuda stream to put the compute to (default 0). |
|
inherited |
Sets a value to a specific point in the matrix.
| x | : Column of the point to change. |
| y | : Row of the point to change. |
| value | : Value to be set. |
| memory_type | : Which memory will be updated. |
|
inherited |
Get the value of a specific point in the matrix.
| x | : Column of the point to get the value from. |
| y | : Row of the point to get the value from. |
| value | : Pointer to the value to be filled. |
| memory_type | : Which memory should be read. |
|
inlineinherited |
Returns the width of the matrix.
|
inlineinherited |
Returns the height of the matrix.
|
inlineinherited |
Returns the resolution (width and height) of the matrix.
|
inlineinherited |
Returns the resolution (width and height) of the matrix.
|
deleteinherited |
Prevent method from being called by temporaries (such as rvalue)
|
inlineinherited |
Returns the number of values stored in one pixel.
|
inlineinherited |
Returns the format of the matrix.
|
inlineinherited |
Returns the type of memory (CPU and/or GPU).
Returns the CPU or GPU data pointer.
| memory_type | : Specifies whether you want sl::MEM::CPU or sl::MEM::GPU. |
Returns the memory step in bytes (size of one pixel row).
| memory_type | : Specifies whether you want sl::MEM::CPU or sl::MEM::GPU step. |
Returns the memory step in number of elements (size in one pixel row).
| memory_type | : Specifies whether you want sl::MEM::CPU or sl::MEM::GPU step. |
Returns the memory step in number of elements (size in one pixel row).
| memory_type | : Specifies whether you want sl::MEM::CPU or sl::MEM::GPU step. |
|
inlineinherited |
Returns the size of one pixel in bytes.
|
inlineinherited |
Returns the size of a row in bytes.
|
inherited |
Returns the information about the sl::Mat into a sl::String.
|
inlineinherited |
|
inlineinherited |
|
inherited |
|
inherited |
|
inherited |
Convert the color channels of the Mat (RGB<->BGR or RGBA<->BGRA) This methods works only on 8U_C4 or 8U_C3.
|
staticinherited |
Convert the color channels of the Mat into another Mat This methods works only on 8U_C4 if remove_alpha_channels is enabled, or 8U_C4 and 8U_C3 if swap_RB_channels is enabled The inplace method sl::Mat::convertColor can be used for only swapping the Red and Blue channel efficiently.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
Variable used in verbose mode to indicate which sl::Mat is printing informations.
Default set to "n/a" to avoid empty string if not filled.
|
inherited |
Whether the sl::Mat can display informations.