@@ -731,6 +731,50 @@ type.
731731CV_EXPORTS_W void blendLinear (InputArray img1, InputArray img2, InputArray weights1, InputArray weights2,
732732 OutputArray result, Stream& stream = Stream::Null());
733733
734+ // ///////////////// Connected Components Labeling /////////////////////
735+
736+ // ! Connected Components Algorithm
737+ enum ConnectedComponentsAlgorithmsTypes {
738+ CCL_DEFAULT = -1 , // !< BKE @cite Allegretti2019 algorithm for 8-way connectivity.
739+ CCL_BKE = 0 , // !< BKE @cite Allegretti2019 algorithm for 8-way connectivity.
740+ };
741+
742+
743+ /* * @brief Computes the Connected Components Labeled image of a binary image.
744+
745+ The function takes as input a binary image and performs Connected Components Labeling. The output
746+ is an image where each Connected Component is assigned a unique label (integer value).
747+ ltype specifies the output label image type, an important consideration based on the total
748+ number of labels or alternatively the total number of pixels in the source image.
749+ ccltype specifies the connected components labeling algorithm to use, currently
750+ BKE @cite Allegretti2019 is supported, see the #ConnectedComponentsAlgorithmsTypes
751+ for details. Note that labels in the output are not required to be sequential.
752+
753+ @param image The 8-bit single-channel image to be labeled.
754+ @param labels Destination labeled image.
755+ @param connectivity Connectivity to use for the labeling procedure. 8 for 8-way connectivity is supported.
756+ @param ltype Output image label type. Currently CV_32S is supported.
757+ @param ccltype Connected components algorithm type (see the #ConnectedComponentsAlgorithmsTypes).
758+
759+ @note A sample program demonstrating Connected Components Labeling in CUDA can be found at\n
760+ opencv_contrib_source_code/modules/cudaimgproc/samples/connected_components.cpp
761+
762+ */
763+ CV_EXPORTS_AS (connectedComponentsWithAlgorithm) void connectedComponents (InputArray image, OutputArray labels,
764+ int connectivity, int ltype, cv::cuda::ConnectedComponentsAlgorithmsTypes ccltype);
765+
766+
767+ /* * @overload
768+
769+ @param image The 8-bit single-channel image to be labeled.
770+ @param labels Destination labeled image.
771+ @param connectivity Connectivity to use for the labeling procedure. 8 for 8-way connectivity is supported.
772+ @param ltype Output image label type. Currently CV_32S is supported.
773+ */
774+ CV_EXPORTS_W void connectedComponents (InputArray image, OutputArray labels,
775+ int connectivity = 8 , int ltype = CV_32S);
776+
777+
734778// ! @}
735779
736780}} // namespace cv { namespace cuda {
0 commit comments