Skip to content

Commit e88d99b

Browse files
committed
Update thinning.cpp
1 parent d6c0c94 commit e88d99b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/ximgproc/src/thinning.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ static void thinningIteration(Mat &img, Mat &marker, const uint8_t* const lut) {
125125

126126
// Apply the thinning procedure to a given image
127127
void thinning(InputArray input, OutputArray output, int thinningType){
128-
Mat processed = input.getMat().clone();
129-
CV_CheckTypeEQ(processed.type(), CV_8UC1, "");
130-
// Enforce the range of the input image to be in between 0 - 255
131-
processed /= 255;
128+
Mat input_ = input.getMat();
129+
CV_Assert(!input_.empty());
130+
CV_CheckTypeEQ(input_.type(), CV_8UC1, "");
131+
132+
Mat processed = input_ / 255;
132133
Mat prev = processed.clone();
133134

134135
Mat marker,marker_inner = processed(Rect(1, 1, processed.cols - 2, processed.rows - 2));

0 commit comments

Comments
 (0)