@ -188,6 +188,7 @@ inline bool _InputArray::isMat() const { return kind() == _InputArray::MAT; }
inline bool _InputArray : : isUMat ( ) const { return kind ( ) = = _InputArray : : UMAT ; }
inline bool _InputArray : : isMatVector ( ) const { return kind ( ) = = _InputArray : : STD_VECTOR_MAT ; }
inline bool _InputArray : : isUMatVector ( ) const { return kind ( ) = = _InputArray : : STD_VECTOR_UMAT ; }
inline bool _InputArray : : isVecVector ( ) const { return kind ( ) = = _InputArray : : STD_VECTOR_VECTOR ; }
inline bool _InputArray : : isMatx ( ) const { return kind ( ) = = _InputArray : : MATX ; }
inline bool _InputArray : : isVector ( ) const { return kind ( ) = = _InputArray : : STD_VECTOR | |
kind ( ) = = _InputArray : : STD_BOOL_VECTOR | |
@ -321,6 +322,28 @@ _OutputArray _OutputArray::rawOut(std::array<_Tp, _Nm>& arr)
return v ;
}
inline
std : : vector < Mat > & _OutputArray : : getMatVecRef ( ) const
{
CV_Assert ( kind ( ) = = _InputArray : : STD_VECTOR_MAT ) ;
return * ( std : : vector < Mat > * ) obj ;
}
inline
std : : vector < UMat > & _OutputArray : : getUMatVecRef ( ) const
{
CV_Assert ( kind ( ) = = _InputArray : : STD_VECTOR_UMAT ) ;
return * ( std : : vector < UMat > * ) obj ;
}
template < typename _Tp > inline
std : : vector < std : : vector < _Tp > > & _OutputArray : : getVecVecRef ( ) const
{
CV_Assert ( kind ( ) = = _InputArray : : STD_VECTOR_VECTOR ) ;
CV_Assert ( type ( ) = = traits : : Type < _Tp > : : value ) ;
return * ( std : : vector < std : : vector < _Tp > > * ) obj ;
}
///////////////////////////////////////////////////////////////////////////////////////////
inline _InputOutputArray : : _InputOutputArray ( ) { init ( 0 + ACCESS_RW , 0 ) ; }
@ -460,27 +483,35 @@ CV__DEBUG_NS_END
template < typename _Tp > inline
Mat : : Mat ( const std : : vector < _Tp > & vec , bool copyData )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 2 ) , rows ( ( int ) vec . size ( ) ) ,
cols ( 1 ) , data ( 0 ) , datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) , allocator ( 0 ) , u ( 0 ) , size ( & rows ) , step ( 0 )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 1 ) , rows ( 1 ) ,
cols ( ( int ) vec . size ( ) ) , data ( 0 ) , datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) ,
allocator ( 0 ) , u ( 0 ) , size ( & cols )
{
step . buf [ 1 ] = sizeof ( _Tp ) ;
step . buf [ 0 ] = cols * step . buf [ 1 ] ;
step . p = & step . buf [ 1 ] ;
if ( vec . empty ( ) )
return ;
if ( ! copyData )
{
step [ 0 ] = step [ 1 ] = sizeof ( _Tp ) ;
datastart = data = ( uchar * ) & vec [ 0 ] ;
datalimit = dataend = datastart + row s * step [ 0 ] ;
datalimit = dataend = datastart + col s * step [ 0 ] ;
}
else
Mat ( ( int ) vec . size ( ) , 1 , traits : : Type < _Tp > : : value , ( uchar * ) & vec [ 0 ] ) . copyTo ( * this ) ;
{
int nelems = ( int ) vec . size ( ) ;
Mat ( 1 , & nelems , traits : : Type < _Tp > : : value , ( uchar * ) & vec [ 0 ] ) . copyTo ( * this ) ;
}
}
template < typename _Tp , typename > inline
Mat : : Mat ( const std : : initializer_list < _Tp > list )
: Mat ( )
{
CV_Assert ( list . size ( ) ! = 0 ) ;
Mat ( ( int ) list . size ( ) , 1 , traits : : Type < _Tp > : : value , ( uchar * ) list . begin ( ) ) . copyTo ( * this ) ;
int nelems = ( int ) list . size ( ) ;
CV_Assert ( nelems ! = 0 ) ;
Mat ( 1 , & nelems , traits : : Type < _Tp > : : value , ( uchar * ) list . begin ( ) ) . copyTo ( * this ) ;
}
template < typename _Tp > inline
@ -497,16 +528,20 @@ Mat::Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp
template < typename _Tp , std : : size_t _Nm > inline
Mat : : Mat ( const std : : array < _Tp , _Nm > & arr , bool copyData )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 2 ) , rows ( ( int ) arr . size ( ) ) ,
cols ( 1 ) , data ( 0 ) , datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) , allocator ( 0 ) , u ( 0 ) , size ( & rows ) , step ( 0 )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 1 ) , rows ( 1 ) ,
cols ( ( int ) arr . size ( ) ) , data ( 0 ) , datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) ,
allocator ( 0 ) , u ( 0 ) , size ( & cols ) , step ( 0 )
{
step . buf [ 1 ] = sizeof ( _Tp ) ;
step . buf [ 0 ] = cols * step . buf [ 1 ] ;
step . p = & step . buf [ 1 ] ;
if ( arr . empty ( ) )
return ;
if ( ! copyData )
{
step [ 0 ] = step [ 1 ] = sizeof ( _Tp ) ;
datastart = data = ( uchar * ) arr . data ( ) ;
datalimit = dataend = datastart + row s * step [ 0 ] ;
datalimit = dataend = datastart + col s * step [ 0 ] ;
}
else
Mat ( ( int ) arr . size ( ) , 1 , traits : : Type < _Tp > : : value , ( uchar * ) arr . data ( ) ) . copyTo ( * this ) ;
@ -514,14 +549,16 @@ Mat::Mat(const std::array<_Tp, _Nm>& arr, bool copyData)
template < typename _Tp , int n > inline
Mat : : Mat ( const Vec < _Tp , n > & vec , bool copyData )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 2 ) , rows ( n ) , cols ( 1 ) , data ( 0 ) ,
datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) , allocator ( 0 ) , u ( 0 ) , size ( & row s) , step ( 0 )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 1 ) , rows ( 1 ) , cols ( n ) , data ( 0 ) ,
datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) , allocator ( 0 ) , u ( 0 ) , size ( & col s) , step ( 0 )
{
if ( ! copyData )
{
step [ 0 ] = step [ 1 ] = sizeof ( _Tp ) ;
step . p = & step . buf [ 1 ] ;
step . buf [ 1 ] = sizeof ( _Tp ) ;
step . buf [ 0 ] = cols * step . buf [ 1 ] ;
datastart = data = ( uchar * ) vec . val ;
datalimit = dataend = datastart + rows * step [ 0 ] ;
datalimit = dataend = datastart + col s * step [ 0 ] ;
}
else
Mat ( n , 1 , traits : : Type < _Tp > : : value , ( void * ) vec . val ) . copyTo ( * this ) ;
@ -535,8 +572,9 @@ Mat::Mat(const Matx<_Tp,m,n>& M, bool copyData)
{
if ( ! copyData )
{
step [ 0 ] = cols * sizeof ( _Tp ) ;
step [ 1 ] = sizeof ( _Tp ) ;
step . p = & step . buf [ 0 ] ;
step . buf [ 1 ] = sizeof ( _Tp ) ;
step . buf [ 0 ] = n * sizeof ( _Tp ) ;
datastart = data = ( uchar * ) M . val ;
datalimit = dataend = datastart + rows * step [ 0 ] ;
}
@ -546,18 +584,21 @@ Mat::Mat(const Matx<_Tp,m,n>& M, bool copyData)
template < typename _Tp > inline
Mat : : Mat ( const Point_ < _Tp > & pt , bool copyData )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 2 ) , rows ( 2 ) , cols ( 1 ) , data ( 0 ) ,
datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) , allocator ( 0 ) , u ( 0 ) , size ( & row s) , step ( 0 )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 1 ) , rows ( 1 ) , cols ( 2 ) , data ( 0 ) ,
datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) , allocator ( 0 ) , u ( 0 ) , size ( & col s) , step ( 0 )
{
if ( ! copyData )
{
step [ 0 ] = step [ 1 ] = sizeof ( _Tp ) ;
step . p = & step . buf [ 1 ] ;
step . buf [ 1 ] = sizeof ( _Tp ) ;
step . buf [ 0 ] = cols * step . buf [ 1 ] ;
datastart = data = ( uchar * ) & pt . x ;
datalimit = dataend = datastart + rows * step [ 0 ] ;
datalimit = dataend = datastart + col s * step [ 0 ] ;
}
else
{
create ( 2 , 1 , traits : : Type < _Tp > : : value ) ;
int sz = 2 ;
create ( 1 , & sz , traits : : Type < _Tp > : : value ) ;
( ( _Tp * ) data ) [ 0 ] = pt . x ;
( ( _Tp * ) data ) [ 1 ] = pt . y ;
}
@ -565,14 +606,16 @@ Mat::Mat(const Point_<_Tp>& pt, bool copyData)
template < typename _Tp > inline
Mat : : Mat ( const Point3_ < _Tp > & pt , bool copyData )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 2 ) , rows ( 3 ) , cols ( 1 ) , data ( 0 ) ,
datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) , allocator ( 0 ) , u ( 0 ) , size ( & row s) , step ( 0 )
: flags ( MAGIC_VAL + traits : : Type < _Tp > : : value + CV_MAT_CONT_FLAG ) , dims ( 1 ) , rows ( 1 ) , cols ( 3 ) , data ( 0 ) ,
datastart ( 0 ) , dataend ( 0 ) , datalimit ( 0 ) , allocator ( 0 ) , u ( 0 ) , size ( & col s) , step ( 0 )
{
if ( ! copyData )
{
step [ 0 ] = step [ 1 ] = sizeof ( _Tp ) ;
step . p = & step . buf [ 1 ] ;
step . buf [ 1 ] = sizeof ( _Tp ) ;
step . buf [ 0 ] = cols * step . buf [ 1 ] ;
datastart = data = ( uchar * ) & pt . x ;
datalimit = dataend = datastart + rows * step [ 0 ] ;
datalimit = dataend = datastart + col s * step [ 0 ] ;
}
else
{
@ -724,7 +767,10 @@ const _Tp* Mat::ptr(int y) const
inline
uchar * Mat : : ptr ( int i0 , int i1 )
{
CV_DbgAssert ( dims > = 2 ) ;
if ( dims < = 1 ) {
CV_DbgAssert ( i0 = = 0 ) ;
return ptr ( i1 ) ;
}
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) i1 < ( unsigned ) size . p [ 1 ] ) ;
@ -734,7 +780,10 @@ uchar* Mat::ptr(int i0, int i1)
inline
const uchar * Mat : : ptr ( int i0 , int i1 ) const
{
CV_DbgAssert ( dims > = 2 ) ;
if ( dims < = 1 ) {
CV_DbgAssert ( i0 = = 0 ) ;
return ptr ( i1 ) ;
}
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) i1 < ( unsigned ) size . p [ 1 ] ) ;
@ -744,7 +793,10 @@ const uchar* Mat::ptr(int i0, int i1) const
template < typename _Tp > inline
_Tp * Mat : : ptr ( int i0 , int i1 )
{
CV_DbgAssert ( dims > = 2 ) ;
if ( dims < = 1 ) {
CV_DbgAssert ( i0 = = 0 ) ;
return ptr < _Tp > ( i1 ) ;
}
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) i1 < ( unsigned ) size . p [ 1 ] ) ;
@ -754,7 +806,10 @@ _Tp* Mat::ptr(int i0, int i1)
template < typename _Tp > inline
const _Tp * Mat : : ptr ( int i0 , int i1 ) const
{
CV_DbgAssert ( dims > = 2 ) ;
if ( dims < = 1 ) {
CV_DbgAssert ( i0 = = 0 ) ;
return ptr < _Tp > ( i1 ) ;
}
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) i1 < ( unsigned ) size . p [ 1 ] ) ;
@ -864,26 +919,28 @@ const _Tp* Mat::ptr(const int* idx) const
template < int n > inline
uchar * Mat : : ptr ( const Vec < int , n > & idx )
{
CV_DbgAssert ( dims = = n ) ;
return Mat : : ptr ( idx . val ) ;
}
template < int n > inline
const uchar * Mat : : ptr ( const Vec < int , n > & idx ) const
{
CV_DbgAssert ( dims = = n ) ;
return Mat : : ptr ( idx . val ) ;
}
template < typename _Tp , int n > inline
_Tp * Mat : : ptr ( const Vec < int , n > & idx )
{
CV_DbgAssert ( elemSize ( ) = = sizeof ( _Tp ) ) ;
CV_DbgAssert ( dims = = n & & elemSize ( ) = = sizeof ( _Tp ) ) ;
return Mat : : ptr < _Tp > ( idx . val ) ;
}
template < typename _Tp , int n > inline
const _Tp * Mat : : ptr ( const Vec < int , n > & idx ) const
{
CV_DbgAssert ( elemSize ( ) = = sizeof ( _Tp ) ) ;
CV_DbgAssert ( dims = = n & & elemSize ( ) = = sizeof ( _Tp ) ) ;
return Mat : : ptr < _Tp > ( idx . val ) ;
}
@ -891,7 +948,11 @@ const _Tp* Mat::ptr(const Vec<int, n>& idx) const
template < typename _Tp > inline
_Tp & Mat : : at ( int i0 , int i1 )
{
CV_DbgAssert ( dims < = 2 ) ;
if ( dims < 2 ) {
CV_DbgAssert ( i0 = = 0 ) ;
return at < _Tp > ( i1 ) ;
}
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) ( i1 * DataType < _Tp > : : channels ) < ( unsigned ) ( size . p [ 1 ] * channels ( ) ) ) ;
@ -902,7 +963,11 @@ _Tp& Mat::at(int i0, int i1)
template < typename _Tp > inline
const _Tp & Mat : : at ( int i0 , int i1 ) const
{
CV_DbgAssert ( dims < = 2 ) ;
if ( dims < 2 ) {
CV_DbgAssert ( i0 = = 0 ) ;
return at < _Tp > ( i1 ) ;
}
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) ( i1 * DataType < _Tp > : : channels ) < ( unsigned ) ( size . p [ 1 ] * channels ( ) ) ) ;
@ -913,7 +978,11 @@ const _Tp& Mat::at(int i0, int i1) const
template < typename _Tp > inline
_Tp & Mat : : at ( Point pt )
{
CV_DbgAssert ( dims < = 2 ) ;
if ( dims < 2 ) {
CV_DbgAssert ( pt . y = = 0 ) ;
return at < _Tp > ( pt . x ) ;
}
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) pt . y < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) ( pt . x * DataType < _Tp > : : channels ) < ( unsigned ) ( size . p [ 1 ] * channels ( ) ) ) ;
@ -924,7 +993,11 @@ _Tp& Mat::at(Point pt)
template < typename _Tp > inline
const _Tp & Mat : : at ( Point pt ) const
{
CV_DbgAssert ( dims < = 2 ) ;
if ( dims < 2 ) {
CV_DbgAssert ( pt . y = = 0 ) ;
return at < _Tp > ( pt . x ) ;
}
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) pt . y < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) ( pt . x * DataType < _Tp > : : channels ) < ( unsigned ) ( size . p [ 1 ] * channels ( ) ) ) ;
@ -935,10 +1008,14 @@ const _Tp& Mat::at(Point pt) const
template < typename _Tp > inline
_Tp & Mat : : at ( int i0 )
{
CV_DbgAssert ( dims < = 2 ) ;
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) ( size . p [ 0 ] * size . p [ 1 ] ) ) ;
CV_DbgAssert ( elemSize ( ) = = sizeof ( _Tp ) ) ;
if ( dims < = 1 ) {
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) cols ) ;
return ( ( _Tp * ) data ) [ i0 ] ;
}
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) ( size . p [ 0 ] * size . p [ 1 ] ) ) ;
if ( isContinuous ( ) | | size . p [ 0 ] = = 1 )
return ( ( _Tp * ) data ) [ i0 ] ;
if ( size . p [ 1 ] = = 1 )
@ -950,16 +1027,20 @@ _Tp& Mat::at(int i0)
template < typename _Tp > inline
const _Tp & Mat : : at ( int i0 ) const
{
CV_DbgAssert ( dims < = 2 ) ;
CV_DbgAssert ( data ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) ( size . p [ 0 ] * size . p [ 1 ] ) ) ;
CV_DbgAssert ( elemSize ( ) = = sizeof ( _Tp ) ) ;
if ( isContinuous ( ) | | size . p [ 0 ] = = 1 )
if ( dims < = 1 ) {
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) cols ) ;
return ( ( const _Tp * ) data ) [ i0 ] ;
if ( size . p [ 1 ] = = 1 )
return * ( const _Tp * ) ( data + step . p [ 0 ] * i0 ) ;
}
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) ( rows * cols ) ) ;
if ( isContinuous ( ) | | rows = = 1 )
return ( ( const _Tp * ) data ) [ i0 ] ;
if ( cols = = 1 )
return * ( const _Tp * ) ( data + step . buf [ 0 ] * i0 ) ;
int i = i0 / cols , j = i0 - i * cols ;
return ( ( const _Tp * ) ( data + step . p [ 0 ] * i ) ) [ j ] ;
return ( ( const _Tp * ) ( data + step . buf [ 0 ] * i ) ) [ j ] ;
}
template < typename _Tp > inline
@ -1146,8 +1227,7 @@ void Mat::push_back(const _Tp& elem)
* this = Mat ( 1 , 1 , traits : : Type < _Tp > : : value , ( void * ) & elem ) . clone ( ) ;
return ;
}
CV_Assert ( traits : : Type < _Tp > : : value = = type ( ) & & cols = = 1
/* && dims == 2 (cols == 1 implies dims == 2) */ ) ;
CV_Assert ( traits : : Type < _Tp > : : value = = type ( ) & & cols = = 1 ) ;
const uchar * tmp = dataend + step [ 0 ] ;
if ( ! isSubmatrix ( ) & & isContinuous ( ) & & tmp < = datalimit )
{
@ -1193,8 +1273,9 @@ int MatSize::dims() const CV_NOEXCEPT
inline
Size MatSize : : operator ( ) ( ) const
{
CV_DbgAssert ( dims ( ) < = 2 ) ;
return Size ( p [ 1 ] , p [ 0 ] ) ;
int d = dims ( ) ;
CV_DbgAssert ( d < = 2 ) ;
return d = = 2 ? Size ( p [ 1 ] , p [ 0 ] ) : Size ( p [ 0 ] , 1 ) ;
}
inline
@ -1236,13 +1317,13 @@ bool MatSize::operator != (const MatSize& sz) const CV_NOEXCEPT
inline
MatStep : : MatStep ( ) CV_NOEXCEPT
{
p = buf ; p [ 0 ] = p [ 1 ] = 0 ;
p = buf ; p [ 0 ] = p [ 1 ] = 0 ; p [ 2 ] = 153 ;
}
inline
MatStep : : MatStep ( size_t s ) CV_NOEXCEPT
{
p = buf ; p [ 0 ] = s ; p [ 1 ] = 0 ;
p = buf ; p [ 0 ] = s ; p [ 1 ] = 0 ; p [ 2 ] = 153 ;
}
inline
@ -1259,14 +1340,14 @@ size_t& MatStep::operator[](int i) CV_NOEXCEPT
inline MatStep : : operator size_t ( ) const
{
CV_DbgAssert ( p = = buf ) ;
return buf [ 0 ] ;
CV_DbgAssert ( p = = buf | | p = = buf + 1 ) ;
return * p ;
}
inline MatStep & MatStep : : operator = ( size_t s )
{
CV_DbgAssert ( p = = buf ) ;
buf [ 0 ] = s ;
CV_DbgAssert ( p = = buf | | p = = buf + 1 ) ;
* p = s ;
return * this ;
}
@ -1475,6 +1556,12 @@ void Mat_<_Tp>::create(int _dims, const int* _sz)
Mat : : create ( _dims , _sz , traits : : Type < _Tp > : : value ) ;
}
template < typename _Tp > inline
void Mat_ < _Tp > : : createSameSize ( InputArray m )
{
_OutputArray ( * this ) . createSameSize ( m , traits : : Type < _Tp > : : value ) ;
}
template < typename _Tp > inline
void Mat_ < _Tp > : : release ( )
{
@ -1612,8 +1699,13 @@ const _Tp* Mat_<_Tp>::operator [](int y) const
template < typename _Tp > inline
_Tp & Mat_ < _Tp > : : operator ( ) ( int i0 , int i1 )
{
CV_DbgAssert ( dims < = 2 ) ;
if ( dims < = 1 ) {
CV_DbgAssert ( i0 = = 0 ) ;
CV_DbgAssert ( 0 < = i1 & & i1 < size . p [ 0 ] ) ;
return ( ( _Tp * ) data ) [ i1 ] ;
}
CV_DbgAssert ( data ) ;
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) i1 < ( unsigned ) size . p [ 1 ] ) ;
CV_DbgAssert ( type ( ) = = traits : : Type < _Tp > : : value ) ;
@ -1623,8 +1715,13 @@ _Tp& Mat_<_Tp>::operator ()(int i0, int i1)
template < typename _Tp > inline
const _Tp & Mat_ < _Tp > : : operator ( ) ( int i0 , int i1 ) const
{
CV_DbgAssert ( dims < = 2 ) ;
if ( dims < = 1 ) {
CV_DbgAssert ( i0 = = 0 ) ;
CV_DbgAssert ( 0 < = i1 & & i1 < size . p [ 0 ] ) ;
return ( ( const _Tp * ) data ) [ i1 ] ;
}
CV_DbgAssert ( data ) ;
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( ( unsigned ) i0 < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) i1 < ( unsigned ) size . p [ 1 ] ) ;
CV_DbgAssert ( type ( ) = = traits : : Type < _Tp > : : value ) ;
@ -1634,8 +1731,13 @@ const _Tp& Mat_<_Tp>::operator ()(int i0, int i1) const
template < typename _Tp > inline
_Tp & Mat_ < _Tp > : : operator ( ) ( Point pt )
{
CV_DbgAssert ( dims < = 2 ) ;
if ( dims < = 1 ) {
CV_DbgAssert ( pt . y = = 0 ) ;
CV_DbgAssert ( 0 < = pt . x & & pt . x < size . p [ 0 ] ) ;
return ( ( _Tp * ) data ) [ pt . x ] ;
}
CV_DbgAssert ( data ) ;
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( ( unsigned ) pt . y < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) pt . x < ( unsigned ) size . p [ 1 ] ) ;
CV_DbgAssert ( type ( ) = = traits : : Type < _Tp > : : value ) ;
@ -1645,8 +1747,13 @@ _Tp& Mat_<_Tp>::operator ()(Point pt)
template < typename _Tp > inline
const _Tp & Mat_ < _Tp > : : operator ( ) ( Point pt ) const
{
CV_DbgAssert ( dims < = 2 ) ;
if ( dims < = 1 ) {
CV_DbgAssert ( pt . y = = 0 ) ;
CV_DbgAssert ( 0 < = pt . x & & pt . x < size . p [ 0 ] ) ;
return ( ( const _Tp * ) data ) [ pt . x ] ;
}
CV_DbgAssert ( data ) ;
CV_DbgAssert ( dims = = 2 ) ;
CV_DbgAssert ( ( unsigned ) pt . y < ( unsigned ) size . p [ 0 ] ) ;
CV_DbgAssert ( ( unsigned ) pt . x < ( unsigned ) size . p [ 1 ] ) ;
CV_DbgAssert ( type ( ) = = traits : : Type < _Tp > : : value ) ;
@ -3319,9 +3426,7 @@ bool UMat::isSubmatrix() const
inline
size_t UMat : : elemSize ( ) const
{
size_t res = dims > 0 ? step . p [ dims - 1 ] : 0 ;
CV_DbgAssert ( res ! = 0 ) ;
return res ;
return CV_ELEM_SIZE ( flags ) ;
}
inline