0

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?

Miki
  • 40,887
  • 13
  • 123
  • 202
Anis
  • 36
  • 4
  • mmm... maybe try 4-way connectivity? – beaker Apr 05 '16 at 15:54
  • I tried it also. the skeleton was not considered as a single connected component. – Anis Apr 05 '16 at 16:46
  • Now I'm confused. What are you trying to detect as a connected component in the image above? The white contours (which are connected together), or the black discs inside the contours? If you invert the image and use 4-connection you should be able to get the two discs. – beaker Apr 05 '16 at 16:52

0 Answers0