pull/21382/head
Stefano Allegretti 3 years ago
parent 06b74c87da
commit c685293297
  1. 6
      modules/imgproc/src/connectedcomponents.cpp
  2. 11
      modules/imgproc/test/test_connectedcomponents.cpp

@ -1570,7 +1570,7 @@ namespace cv{
#define CONDITION_S img_row[c - 1] > 0
#define CONDITION_X img_row[c] > 0
#define ACTION_1 // nothing to do
#define ACTION_1 img_labels_row[c] = 0;
#define ACTION_2 img_labels_row[c] = label; \
P_[label] = label; \
label = label + 1;
@ -1831,7 +1831,7 @@ namespace cv{
std::vector<LabelT> P_(Plength, 0);
LabelT* P = P_.data();
//P[0] = 0;
P[0] = 0;
LabelT lunique = 1;
// First scan
@ -1851,7 +1851,7 @@ namespace cv{
#define CONDITION_S img_row[c - 1] > 0
#define CONDITION_X img_row[c] > 0
#define ACTION_1 // nothing to do
#define ACTION_1 img_labels_row[c] = 0;
#define ACTION_2 img_labels_row[c] = lunique; \
P[lunique] = lunique; \
lunique = lunique + 1; // new label

@ -789,5 +789,16 @@ TEST(Imgproc_ConnectedComponents, single_column)
}
TEST(Imgproc_ConnectedComponents, 4conn_regression_21366)
{
Mat src = Mat::zeros(Size(10, 10), CV_8UC1);
{
Mat labels, stats, centroids;
EXPECT_NO_THROW(cv::connectedComponentsWithStats(src, labels, stats, centroids, 4));
}
}
}
} // namespace

Loading…
Cancel
Save