fixed MatConstIterator<> (ticket #776)
This commit is contained in:
parent
86802ec968
commit
a379d011fd
@ -1808,7 +1808,7 @@ template<typename _Tp> inline Point MatConstIterator_<_Tp>::pos() const
|
||||
CV_DbgAssert( m->dims <= 2 );
|
||||
if( m->isContinuous() )
|
||||
{
|
||||
ptrdiff_t ofs = ptr - (_Tp*)m->data;
|
||||
ptrdiff_t ofs = (const _Tp*)ptr - (const _Tp*)m->data;
|
||||
int y = (int)(ofs / m->cols), x = (int)(ofs - (ptrdiff_t)y*m->cols);
|
||||
return Point(x, y);
|
||||
}
|
||||
|
@ -2203,7 +2203,7 @@ void MatConstIterator::seek(ptrdiff_t ofs, bool relative)
|
||||
y = ofs/m->cols;
|
||||
int y1 = std::min(std::max((int)y, 0), m->rows-1);
|
||||
sliceStart = m->data + y1*m->step[0];
|
||||
sliceEnd = sliceStart + (m->cols-1)*elemSize;
|
||||
sliceEnd = sliceStart + m->cols*elemSize;
|
||||
ptr = y < 0 ? sliceStart : y >= m->rows ? sliceEnd :
|
||||
sliceStart + (ofs - y*m->cols)*elemSize;
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user