Connected Component Labeling in C++

…衆ロ難τιáo~ 提交于 2019-11-30 23:08:45

Surprisingly, there is no CCL in OpenCV. However, there is a workaround that is described in the reference manual. See the example for cvDrawContours. When I tried to use it, I had some strange behaviour on first and last rows and columns of an image, but I probably did something wrong.

An alternative way is to use cvBlobs library.

We ended up writing the algorithms for CCL and Union-Find ourselves using the descriptions found on Wikipedia and elsewhere. It seemed easier and faster than adding another library to our application just for this purpose.

Another possibility is to use the source codes provided provided by Ali Rahimi, and you can have a look at this.

Kaushik Acharya

I was able to use disjoint_sets of the boost library for the connected component labeling. But to test, I was trying to create an image with pixel intensities having the value same as its label. This led to the problem which I haven't been able to handle yet. Have a look at the thread.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!