Skip to content

Commit

Permalink
Update thinning.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
sturkmen72 authored Oct 3, 2024
1 parent e88d99b commit e7d828a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/ximgproc/src/thinning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand All @@ -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;
}

Expand All @@ -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;
Expand Down

0 comments on commit e7d828a

Please sign in to comment.