Skip to content

Commit 91817bf

Browse files
authored
Merge pull request opencv#21275 from stal12:CCL_improvements
Improve CCL with new algorithms and tests * Improve CCL with new algorithms and tests * Split CCL test into dedicated tests cases
1 parent 49bef1c commit 91817bf

File tree

4 files changed

+1852
-68
lines changed

4 files changed

+1852
-68
lines changed

doc/opencv.bib

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,3 +1278,11 @@ @inproceedings{forstner1987fast
12781278
pages={281--305},
12791279
year={1987}
12801280
}
1281+
@article{Bolelli2021,
1282+
title={One DAG to Rule Them All},
1283+
author={Bolelli, Federico and Allegretti, Stefano and Grana, Costantino},
1284+
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
1285+
year={2021},
1286+
publisher={IEEE},
1287+
doi = {10.1109/TPAMI.2021.3055337}
1288+
}

modules/imgproc/include/opencv2/imgproc.hpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,10 @@ enum ConnectedComponentsTypes {
406406

407407
//! connected components algorithm
408408
enum ConnectedComponentsAlgorithmsTypes {
409-
CCL_DEFAULT = -1, //!< BBDT @cite Grana2010 algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity. The parallel implementation described in @cite Bolelli2017 is available for both BBDT and SAUF.
409+
CCL_DEFAULT = -1, //!< Spaghetti @cite Bolelli2019 algorithm for 8-way connectivity, Spaghetti4C @cite Bolelli2021 algorithm for 4-way connectivity.
410410
CCL_WU = 0, //!< SAUF @cite Wu2009 algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity. The parallel implementation described in @cite Bolelli2017 is available for SAUF.
411411
CCL_GRANA = 1, //!< BBDT @cite Grana2010 algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity. The parallel implementation described in @cite Bolelli2017 is available for both BBDT and SAUF.
412-
CCL_BOLELLI = 2, //!< Spaghetti @cite Bolelli2019 algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity.
412+
CCL_BOLELLI = 2, //!< Spaghetti @cite Bolelli2019 algorithm for 8-way connectivity, Spaghetti4C @cite Bolelli2021 algorithm for 4-way connectivity. The parallel implementation described in @cite Bolelli2017 is available for both Spaghetti and Spaghetti4C.
413413
CCL_SAUF = 3, //!< Same as CCL_WU. It is preferable to use the flag with the name of the algorithm (CCL_SAUF) rather than the one with the name of the first author (CCL_WU).
414414
CCL_BBDT = 4, //!< Same as CCL_GRANA. It is preferable to use the flag with the name of the algorithm (CCL_BBDT) rather than the one with the name of the first author (CCL_GRANA).
415415
CCL_SPAGHETTI = 5, //!< Same as CCL_BOLELLI. It is preferable to use the flag with the name of the algorithm (CCL_SPAGHETTI) rather than the one with the name of the first author (CCL_BOLELLI).
@@ -3912,9 +3912,10 @@ image with 4 or 8 way connectivity - returns N, the total number of labels [0, N
39123912
represents the background label. ltype specifies the output label image type, an important
39133913
consideration based on the total number of labels or alternatively the total number of pixels in
39143914
the source image. ccltype specifies the connected components labeling algorithm to use, currently
3915-
Grana (BBDT) and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes
3916-
for details. Note that SAUF algorithm forces a row major ordering of labels while BBDT does not.
3917-
This function uses parallel version of both Grana and Wu's algorithms if at least one allowed
3915+
Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms
3916+
are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces
3917+
a row major ordering of labels while Spaghetti and BBDT do not.
3918+
This function uses parallel version of the algorithms if at least one allowed
39183919
parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
39193920
39203921
@param image the 8-bit single-channel image to be labeled
@@ -3944,9 +3945,10 @@ image with 4 or 8 way connectivity - returns N, the total number of labels [0, N
39443945
represents the background label. ltype specifies the output label image type, an important
39453946
consideration based on the total number of labels or alternatively the total number of pixels in
39463947
the source image. ccltype specifies the connected components labeling algorithm to use, currently
3947-
Grana's (BBDT) and Wu's (SAUF) @cite Wu2009 algorithms are supported, see the #ConnectedComponentsAlgorithmsTypes
3948-
for details. Note that SAUF algorithm forces a row major ordering of labels while BBDT does not.
3949-
This function uses parallel version of both Grana and Wu's algorithms (statistics included) if at least one allowed
3948+
Bolelli (Spaghetti) @cite Bolelli2019, Grana (BBDT) @cite Grana2010 and Wu's (SAUF) @cite Wu2009 algorithms
3949+
are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces
3950+
a row major ordering of labels while Spaghetti and BBDT do not.
3951+
This function uses parallel version of the algorithms (statistics included) if at least one allowed
39503952
parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
39513953
39523954
@param image the 8-bit single-channel image to be labeled

0 commit comments

Comments
 (0)