diff --git a/modules/ximgproc/src/thinning.cpp b/modules/ximgproc/src/thinning.cpp index 0dcceb01410..b3a7dc15eb4 100644 --- a/modules/ximgproc/src/thinning.cpp +++ b/modules/ximgproc/src/thinning.cpp @@ -99,7 +99,7 @@ static void thinningIteration(Mat &img, Mat &marker, const uint8_t* const lut) { // Parallelized iteration over pixels excluding the boundary parallel_for_(Range(1, rows - 1), [&](const Range& range) { for (int i = range.start; i < range.end; i++) { - uchar* imgRow = img.ptr(i); + const uchar* imgRow = img.ptr(i); uchar* markerRow = marker.ptr(i); for (int j = 1; j < cols - 1; j++) { if (imgRow[j]) { @@ -119,7 +119,6 @@ static void thinningIteration(Mat &img, Mat &marker, const uint8_t* const lut) { } }); - // Bitwise AND and reset marker for the next iteration img &= marker; } @@ -132,7 +131,8 @@ void thinning(InputArray input, OutputArray output, int thinningType){ Mat processed = input_ / 255; Mat prev = processed.clone(); - Mat marker,marker_inner = processed(Rect(1, 1, processed.cols - 2, processed.rows - 2)); + Mat marker; + Mat marker_inner = processed(Rect(1, 1, processed.cols - 2, processed.rows - 2)); copyMakeBorder(marker_inner, marker, 1, 1, 1, 1, BORDER_ISOLATED | BORDER_CONSTANT, Scalar(255)); const auto lutIter0 = (thinningType == THINNING_GUOHALL) ? lut_guo_iter0 : lut_zhang_iter0;