diff --git a/modules/highgui/src/grfmt_jpeg2000.cpp b/modules/highgui/src/grfmt_jpeg2000.cpp index 28818e30ca..da5d718dc5 100644 --- a/modules/highgui/src/grfmt_jpeg2000.cpp +++ b/modules/highgui/src/grfmt_jpeg2000.cpp @@ -502,7 +502,7 @@ bool Jpeg2KEncoder::writeComponent16u( void *__img, const Mat& _img ) for( int y = 0; y < h; y++ ) { - uchar* data = _img.data + _img.step*y; + const ushort* data = _img.ptr(y); for( int i = 0; i < ncmpts; i++ ) { for( int x = 0; x < w; x++)