mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
Fix the bug of Mat_<>::opeartor []
`template<typename _Tp> inline const _Tp* Mat_<_Tp>::operator [](int y) const` does not support 3d matrix since it checks rows. This operator[] shall check size.p[0] instead.
This commit is contained in:
parent
502aa1f053
commit
207218e920
@ -1634,14 +1634,14 @@ Mat_<_Tp> Mat_<_Tp>::operator()(const std::vector<Range>& ranges) const
|
|||||||
template<typename _Tp> inline
|
template<typename _Tp> inline
|
||||||
_Tp* Mat_<_Tp>::operator [](int y)
|
_Tp* Mat_<_Tp>::operator [](int y)
|
||||||
{
|
{
|
||||||
CV_DbgAssert( 0 <= y && y < rows );
|
CV_DbgAssert( 0 <= y && y < size.p[0] );
|
||||||
return (_Tp*)(data + y*step.p[0]);
|
return (_Tp*)(data + y*step.p[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp> inline
|
template<typename _Tp> inline
|
||||||
const _Tp* Mat_<_Tp>::operator [](int y) const
|
const _Tp* Mat_<_Tp>::operator [](int y) const
|
||||||
{
|
{
|
||||||
CV_DbgAssert( 0 <= y && y < rows );
|
CV_DbgAssert( 0 <= y && y < size.p[0] );
|
||||||
return (const _Tp*)(data + y*step.p[0]);
|
return (const _Tp*)(data + y*step.p[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user