OpenCV  3.2.0
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | List of all members
cv::dnn::BlobShape Struct Reference

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...
 

Detailed Description

Lightweight class for storing and processing a shape of blob (or anything else).

Constructor & Destructor Documentation

§ BlobShape() [1/8]

cv::dnn::BlobShape::BlobShape ( )

Creates [1, 1, 1, 1] shape.

Todo:
Make more clearer behavior.

§ BlobShape() [2/8]

cv::dnn::BlobShape::BlobShape ( int  s0)
explicit

Creates 1-dim shape [s0].

§ BlobShape() [3/8]

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.

§ BlobShape() [4/8]

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.

§ BlobShape() [5/8]

cv::dnn::BlobShape::BlobShape ( int  num,
int  cn,
int  rows,
int  cols 
)

Creates 4-dim shape [num, cn, rows, cols].

§ BlobShape() [6/8]

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.

§ BlobShape() [7/8]

cv::dnn::BlobShape::BlobShape ( const std::vector< int > &  sizes)

Creates n-dim shape from the sizes vector.

§ BlobShape() [8/8]

template<int n>
cv::dnn::BlobShape::BlobShape ( const Vec< int, n > &  shape)

Creates n-dim shape from cv::Vec.

Member Function Documentation

§ all()

static BlobShape cv::dnn::BlobShape::all ( int  ndims,
int  fill = 1 
)
static

Creates n-dim shape and fill its by fill.

§ canonicalAxis()

int cv::dnn::BlobShape::canonicalAxis ( int  axis) const

Converts axis index to canonical format (where 0 <= axis < dims()).

§ dims()

int cv::dnn::BlobShape::dims ( ) const

Returns number of dimensions.

§ empty()

static BlobShape cv::dnn::BlobShape::empty ( )
static

Returns empty shape [].

§ equal()

bool cv::dnn::BlobShape::equal ( const BlobShape other) const

Checks equality of two shapes.

§ isEmpty()

bool cv::dnn::BlobShape::isEmpty ( ) const

Returns true if shape is empty (i.e []).

§ like() [1/2]

static BlobShape cv::dnn::BlobShape::like ( const Mat m)
static

Returns shape of passed Mat.

§ like() [2/2]

static BlobShape cv::dnn::BlobShape::like ( const UMat m)
static

Returns shape of passed UMat.

§ operator+()

BlobShape cv::dnn::BlobShape::operator+ ( const BlobShape r) const

Contacenates two shapes.

§ operator==()

bool cv::dnn::BlobShape::operator== ( const BlobShape r) const
See also
equal()

§ operator[]() [1/2]

int cv::dnn::BlobShape::operator[] ( int  axis) const

Does the same thing as size(axis).

§ operator[]() [2/2]

int& cv::dnn::BlobShape::operator[] ( int  axis)

Does the same thing as size(int) const.

§ ptr() [1/2]

const int* cv::dnn::BlobShape::ptr ( ) const

Returns pointer to the first element of continuous size array.

§ ptr() [2/2]

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.

§ size() [1/2]

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.

§ size() [2/2]

int cv::dnn::BlobShape::size ( int  axis) const

Returns the size of the specified axis.

See also
size()

§ slice()

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.

See also
Blob::total(int,int)

§ total() [1/2]

ptrdiff_t cv::dnn::BlobShape::total ( ) const

Returns the product of all sizes of axes.

§ total() [2/2]

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.

See also
Blob::total(int,int)

§ xsize()

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.


The documentation for this struct was generated from the following file: