title: Watershed using c# or c++
body: <p>I am trying to convert the Matlab function <code>watershed</code> into C# or C++.</p>
  
  <p>I tried to use <a href="http://pastebin.com/KXnJ5XkP" rel="nofollow">this code</a> but <code>CvFindContours</code> returns <code>NULL</code> with <a href="http://imageshack.us/photo/my-images/259/normalnx.jpg/" rel="nofollow">this image</a>.</p>
  
  <p>I also tried to use <a href="http://weblogs.sqlteam.com/mladenp/archive/2008/02/11/Watershed-Image-Segmentation-in-C.aspx" rel="nofollow">this implementation</a> but I had issues with <code>FilterGrayToGray</code>.</p>
  
  <p>Does anyone knows how I can solve my problems or how I can calculate watershed on my image? Can someone explain me more precisely meyers flood algorithm for watershed?</p>