title: Computing rectangle around pixel coordinates
body: <p>I have a Qvector containing pixel coordinates of an image. The main goal would be to group those pixels regarding their distance to each other and getting a rectangle out of those groups of pixels. Every pixel in the vector are not close to each other and that is the reason why I would like to group them. </p>
  
  <p>I am using openCv and Qt. I would like to avoid the blobDetector from OpenCV which is quite slow and do this by my own if that is possible.</p>
  
  <p>Does anybody have an idea how to manage this ?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Let's say the white dots are pixel close to each other. The main objective would be to detect that these pixels are close to each other and be able to get a rectangle of those pixels. Is this possible ?</p>
  
  <p><a href="https://i.stack.imgur.com/zt0My.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zt0My.png" alt="enter image description here"></a></p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>After getting the clusters I tried to get the bounding rectangles around those clusters with the following code. I might not be using this function the correct way. </p>
  
  <pre><code>cv::partition(cvCoordsTable, testVector, Dist(eqludianThreshold));
  std::vector&lt;cv::Rect&gt; rectTable;
  
  for(int in = 0; in &lt; testVector.size(); in++)
  {
      rectTable.push_back(cv::boundingRect(cvCoordsTable.at(in)));
  }
  </code></pre>
  
  <p>Thank you for your help</p>