OpenCV
3.2.0
Open Source Computer Vision
|
Lightweight class for storing and processing a shape of blob (or anything else). More...
#include "blob.hpp"
Public Member Functions | |
BlobShape () | |
Creates [1, 1, 1, 1] shape. More... | |
BlobShape (int s0) | |
Creates 1-dim shape [s0 ]. More... | |
BlobShape (int s0, int s1) | |
BlobShape (int s0, int s1, int s2) | |
BlobShape (int num, int cn, int rows, int cols) | |
Creates 4-dim shape [num , cn , rows , cols ]. More... | |
BlobShape (int ndims, const int *sizes) | |
Creates n-dim shape from the sizes array; if sizes is NULL then shape will contain unspecified data. More... | |
BlobShape (const std::vector< int > &sizes) | |
Creates n-dim shape from the sizes vector. More... | |
template<int n> | |
BlobShape (const Vec< int, n > &shape) | |
Creates n-dim shape from cv::Vec. More... | |
int | canonicalAxis (int axis) const |
Converts axis index to canonical format (where 0 <= axis < dims()). More... | |
int | dims () const |
Returns number of dimensions. More... | |
bool | equal (const BlobShape &other) const |
Checks equality of two shapes. More... | |
bool | isEmpty () const |
Returns true if shape is empty (i.e []). More... | |
BlobShape | operator+ (const BlobShape &r) const |
Contacenates two shapes. More... | |
bool | operator== (const BlobShape &r) const |
int | operator[] (int axis) const |
Does the same thing as size(axis). More... | |
int & | operator[] (int axis) |
Does the same thing as size(int) const. More... | |
const int * | ptr () const |
Returns pointer to the first element of continuous size array. More... | |
int * | ptr () |
int & | size (int axis) |
Returns reference to the size of the specified axis . More... | |
int | size (int axis) const |
Returns the size of the specified axis . More... | |
BlobShape | slice (int startAxis, int endAxis=INT_MAX) const |
Constructs new shape from axes in range [startAxis ; endAxis ). More... | |
ptrdiff_t | total () const |
Returns the product of all sizes of axes. More... | |
ptrdiff_t | total (int startAxis, int endAxis=INT_MAX) const |
Computes the product of sizes of axes among the specified axes range [startAxis ; endAxis ). More... | |
int | xsize (int axis) const |
Returns the size of the specified axis . More... | |
Static Public Member Functions | |
static BlobShape | all (int ndims, int fill=1) |
Creates n-dim shape and fill its by fill . More... | |
static BlobShape | empty () |
Returns empty shape []. More... | |
static BlobShape | like (const Mat &m) |
Returns shape of passed Mat. More... | |
static BlobShape | like (const UMat &m) |
Returns shape of passed UMat. More... | |
Lightweight class for storing and processing a shape of blob (or anything else).
cv::dnn::BlobShape::BlobShape | ( | ) |
Creates [1, 1, 1, 1] shape.
|
explicit |
Creates 1-dim shape [s0
].
cv::dnn::BlobShape::BlobShape | ( | int | s0, |
int | s1 | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
cv::dnn::BlobShape::BlobShape | ( | int | s0, |
int | s1, | ||
int | s2 | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
cv::dnn::BlobShape::BlobShape | ( | int | num, |
int | cn, | ||
int | rows, | ||
int | cols | ||
) |
Creates 4-dim shape [num
, cn
, rows
, cols
].
cv::dnn::BlobShape::BlobShape | ( | int | ndims, |
const int * | sizes | ||
) |
Creates n-dim shape from the sizes
array; if sizes
is NULL then shape will contain unspecified data.
cv::dnn::BlobShape::BlobShape | ( | const std::vector< int > & | sizes | ) |
Creates n-dim shape from the sizes
vector.
cv::dnn::BlobShape::BlobShape | ( | const Vec< int, n > & | shape | ) |
Creates n-dim shape from cv::Vec.
|
static |
Creates n-dim shape and fill its by fill
.
int cv::dnn::BlobShape::canonicalAxis | ( | int | axis | ) | const |
Converts axis
index to canonical format (where 0 <= axis
< dims()).
int cv::dnn::BlobShape::dims | ( | ) | const |
Returns number of dimensions.
|
static |
Returns empty shape [].
bool cv::dnn::BlobShape::equal | ( | const BlobShape & | other | ) | const |
Checks equality of two shapes.
bool cv::dnn::BlobShape::isEmpty | ( | ) | const |
Returns true if shape is empty (i.e []).
int cv::dnn::BlobShape::operator[] | ( | int | axis | ) | const |
Does the same thing as size(axis).
int& cv::dnn::BlobShape::operator[] | ( | int | axis | ) |
Does the same thing as size(int) const.
const int* cv::dnn::BlobShape::ptr | ( | ) | const |
Returns pointer to the first element of continuous size array.
int* cv::dnn::BlobShape::ptr | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
int& cv::dnn::BlobShape::size | ( | int | axis | ) |
Returns reference to the size of the specified axis
.
Negative axis
is supported, in this case a counting starts from the last axis, i. e. -1 corresponds to last axis. If non-existing axis was passed then an error will be generated.
int cv::dnn::BlobShape::size | ( | int | axis | ) | const |
Returns the size of the specified axis
.
BlobShape cv::dnn::BlobShape::slice | ( | int | startAxis, |
int | endAxis = INT_MAX |
||
) | const |
Constructs new shape from axes in range [startAxis
; endAxis
).
Negative axis indexing can be used.
ptrdiff_t cv::dnn::BlobShape::total | ( | ) | const |
Returns the product of all sizes of axes.
ptrdiff_t cv::dnn::BlobShape::total | ( | int | startAxis, |
int | endAxis = INT_MAX |
||
) | const |
Computes the product of sizes of axes among the specified axes range [startAxis
; endAxis
).
Negative axis indexing can be used.
int cv::dnn::BlobShape::xsize | ( | int | axis | ) | const |
Returns the size of the specified axis
.
Does the same thing as size(int) const, but if non-existing axis will be passed then 1 will be returned, therefore this function always finishes successfully.