I used OpenCV 4.5 (x64 release build).
And I\'ve tested the function cv::connectedComponents for 10000x10000 matrices both dense and sparse.
The execution time