1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

got rid of Blob and BlobShape completely; use cv::Mat and std::vector<int> instead

This commit is contained in:
Vadim Pisarevsky
2017-04-19 23:20:17 +03:00
parent fd93ae08b6
commit dd54f7a22a
4 changed files with 56 additions and 5 deletions
@@ -270,6 +270,17 @@ std::ostream& operator << (std::ostream& out, const Rect_<_Tp>& rect)
return out << "[" << rect.width << " x " << rect.height << " from (" << rect.x << ", " << rect.y << ")]";
}
static inline std::ostream& operator << (std::ostream& out, const MatSize& msize)
{
int i, dims = msize.p[-1];
for( i = 0; i < dims; i++ )
{
out << msize.p[i];
if( i < dims-1 )
out << " x ";
}
return out;
}
#endif // OPENCV_NOSTL
} // cv
@@ -1215,6 +1215,9 @@ public:
/** @overload */
Mat reshape(int cn, int newndims, const int* newsz) const;
/** @overload */
Mat reshape(int cn, const std::vector<int>& newshape) const;
/** @brief Transposes a matrix.
The method performs matrix transposition by means of matrix expressions. It does not perform the
@@ -1717,6 +1720,12 @@ public:
*/
size_t total() const;
/** @brief Returns the total number of array elements.
The method returns the number of elements within a certain sub-array slice with startDim <= dim < endDim
*/
size_t total(int startDim, int endDim=INT_MAX) const;
//! returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise
int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const;
@@ -807,6 +807,17 @@ size_t Mat::total() const
return p;
}
inline
size_t Mat::total(int startDim, int endDim) const
{
CV_Assert( 0 <= startDim && startDim <= endDim);
size_t p = 1;
int endDim_ = endDim <= dims ? endDim : dims;
for( int i = startDim; i < endDim_; i++ )
p *= size[i];
return p;
}
inline
uchar* Mat::ptr(int y)
{