title: C++ and OpenCV: clustering white pixels algorithm
body: <p>I have a binary image (black and white pixels), and I'd like to cluster the white pixels into groups (objects), depending on the distance to each other, and retrieve the centroid of each cluster.</p>
  
  <p>This is an example image in which I have to work on:</p>
  
  <p><img src="https://i.stack.imgur.com/2L3xn.png" alt="Image"></p>
  
  <p>(frame on purple)</p>
  
  <p>I'd like to check if a clustering approach would provide the results I am looking for, which means that I'm trying to avoid implementing an algorithm myself before knowing it will be worth it. <br>Does OpenCV have a method to do what I need?</p>