title: Image (color?) segmentation with opencv C++
body: <p><img src="https://i.stack.imgur.com/E9ItQ.png" alt="http://i.imgur.com/iIv4gJa.png"></p>
  
  <p>As the graph showed, I'd like to input image and get several segments as a result like that.</p>
  
  <p>It's just like cluster the closest color segment, so I think it's close to the concept of "meanshift"?</p>
  
  <p>I've searched relevant questions here but still don't know how to start and construct the structure in opencv C++. I'm looking for some advises, and I'll be very appreciate if getting a piece of implementation code for me to reference! Thanks for any help!!</p>
  
  <p>==================================================</p>
  
  <p>Edit 5/19/2015</p>
  
  <p>Let me add that one of my trying implementations is Watershed here:(<a href="http://blog.csdn.net/fdl19881/article/details/6749976" rel="noreferrer">http://blog.csdn.net/fdl19881/article/details/6749976</a>).</p>
  
  <p><img src="https://i.stack.imgur.com/F6W2k.jpg" alt="enter image description here"></p>
  
  <p>It's not perfect but the result i want. In this implement, user needs to operate manually( draw the watershed lines ), so i'm looking for AUTOMATIC version of it. Sounds a little bit hard, but... i'll appreciate for some suggestion or piece of code to do it.</p>