I'm working on features extraction from digits skeletons with OpenCV 3.1.0 on C++.
I'm looking for a method that give me the number of closed contours in an a skeleton image (for example 2 for 8, 1 for 0,6,9 and 0 for 1,2,3,4,5,7). I used the method connectedComponents()
of OpenCV with 8-way connectivity but it didnt give me the hoped result. I get always 2 connected components in all images.
The problem is that the inside and outside of the shape are 8-way connected so they are considered as one component.
This image will explain the main problem:
Is there a solution to get these features?