From 1305962af7461b8bfa1a5cd7d6056e0fad2b874e Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 14 Dec 2015 18:13:57 +0300 Subject: [PATCH] fixes #5066: laplacian: "y" may contain negative values --- modules/imgproc/src/deriv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index b69656a74d..dacc23d2e8 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -858,7 +858,7 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize, Mat src = _src.getMat(), dst = _dst.getMat(); int y = fx->start(src), dsty = 0, dy = 0; fy->start(src); - const uchar* sptr = src.ptr(y); + const uchar* sptr = src.ptr() + src.step[0] * y; int dy0 = std::min(std::max((int)(STRIPE_SIZE/(CV_ELEM_SIZE(stype)*src.cols)), 1), src.rows); Mat d2x( dy0 + kd.rows - 1, src.cols, wtype );