title: OpenCV : number of nested contours
body: <p>This is my first question here, thank you for reading it.</p>
  
  <p>I am trying to count the number of inner contours inside a contour.</p>
  
  <p>I found a nice tutorial showing how to use h_next and v_next</p>
  
  <p><a href="http://jmpelletier.com/a-simple-opencv-tutorial/" rel="nofollow">http://jmpelletier.com/a-simple-opencv-tutorial/</a></p>
  
  <p>The problem is I use Mat and not IplImage.</p>
  
  <p>I tried to convert it with:</p>
  
  <p>Mat *oimg;
  IplImage img = *oimg;</p>
  
  <p>But I get an error when calling cvFindContours.</p>
  
  <p>I also tried usign findContours which is built to work with Mat,</p>
  
  <p>by going through the hierrarchy but it didnt work.</p>
  
  <p>I'm usign C++ and OpenCV2.0</p>
  
  <p>Thanks allot,</p>
  
  <p>Tamir.</p>