mirror of
https://github.com/opencv/opencv.git
synced 2025-07-26 07:07:37 +08:00
Merge pull request #21382 from stal12:CCL_fix_4conn
This commit is contained in:
commit
53b89e1ee4
@ -1570,7 +1570,7 @@ namespace cv{
|
|||||||
#define CONDITION_S img_row[c - 1] > 0
|
#define CONDITION_S img_row[c - 1] > 0
|
||||||
#define CONDITION_X img_row[c] > 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; \
|
#define ACTION_2 img_labels_row[c] = label; \
|
||||||
P_[label] = label; \
|
P_[label] = label; \
|
||||||
label = label + 1;
|
label = label + 1;
|
||||||
@ -1831,7 +1831,7 @@ namespace cv{
|
|||||||
|
|
||||||
std::vector<LabelT> P_(Plength, 0);
|
std::vector<LabelT> P_(Plength, 0);
|
||||||
LabelT* P = P_.data();
|
LabelT* P = P_.data();
|
||||||
//P[0] = 0;
|
P[0] = 0;
|
||||||
LabelT lunique = 1;
|
LabelT lunique = 1;
|
||||||
|
|
||||||
// First scan
|
// First scan
|
||||||
@ -1851,7 +1851,7 @@ namespace cv{
|
|||||||
#define CONDITION_S img_row[c - 1] > 0
|
#define CONDITION_S img_row[c - 1] > 0
|
||||||
#define CONDITION_X img_row[c] > 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; \
|
#define ACTION_2 img_labels_row[c] = lunique; \
|
||||||
P[lunique] = lunique; \
|
P[lunique] = lunique; \
|
||||||
lunique = lunique + 1; // new label
|
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
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user