title: opencv euclidean clustering vs findContours
body: <p>I have the following image mask:</p>
  
  <p><a href="https://i.stack.imgur.com/Y2m1S.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/Y2m1S.gif" alt="mask"></a></p>
  
  <p>I want to apply something similar to <code>cv::findContours</code>, but that algorithm only joins connected points in the same groups. I want to do this with some tolerance, i.e., I want to add the pixels near each other within a given radius tolerance: this is similar to Euclidean distance hierarchical clustering. </p>
  
  <p>Is this implemented in OpenCV? Or is there any fast approach for implementing this?</p>
  
  <p>What I want is something similar to this,</p>
  
  <p><a href="http://www.pointclouds.org/documentation/tutorials/cluster_extraction.php" rel="noreferrer">http://www.pointclouds.org/documentation/tutorials/cluster_extraction.php</a></p>
  
  <p>applied to the white pixels of this mask.</p>
  
  <p>Thank you.</p>