Skip to content

Commit e7d828a

Browse files
authored
Update thinning.cpp
1 parent e88d99b commit e7d828a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/ximgproc/src/thinning.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void thinningIteration(Mat &img, Mat &marker, const uint8_t* const lut) {
9999
// Parallelized iteration over pixels excluding the boundary
100100
parallel_for_(Range(1, rows - 1), [&](const Range& range) {
101101
for (int i = range.start; i < range.end; i++) {
102-
uchar* imgRow = img.ptr(i);
102+
const uchar* imgRow = img.ptr(i);
103103
uchar* markerRow = marker.ptr(i);
104104
for (int j = 1; j < cols - 1; j++) {
105105
if (imgRow[j]) {
@@ -119,7 +119,6 @@ static void thinningIteration(Mat &img, Mat &marker, const uint8_t* const lut) {
119119
}
120120
});
121121

122-
// Bitwise AND and reset marker for the next iteration
123122
img &= marker;
124123
}
125124

@@ -132,7 +131,8 @@ void thinning(InputArray input, OutputArray output, int thinningType){
132131
Mat processed = input_ / 255;
133132
Mat prev = processed.clone();
134133

135-
Mat marker,marker_inner = processed(Rect(1, 1, processed.cols - 2, processed.rows - 2));
134+
Mat marker;
135+
Mat marker_inner = processed(Rect(1, 1, processed.cols - 2, processed.rows - 2));
136136
copyMakeBorder(marker_inner, marker, 1, 1, 1, 1, BORDER_ISOLATED | BORDER_CONSTANT, Scalar(255));
137137

138138
const auto lutIter0 = (thinningType == THINNING_GUOHALL) ? lut_guo_iter0 : lut_zhang_iter0;

0 commit comments

Comments
 (0)