提交 53b89e1e 编写于 作者: A Alexander Alekhin

Merge pull request #21382 from stal12:CCL_fix_4conn

......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册