title: Count the number of atoms in a cluster
body: <p>I'm trying to make a network that identifies missing atoms from an image, and is then able to count them. </p>
  
  <p>So far, I have created a CNN that is able to output an image like below that solely highlights such atoms <a href="https://i.stack.imgur.com/IDX4I.png" rel="nofollow noreferrer">1</a>, and I have found an OpenCV library tat I think would be able to count all the individual white spots (<a href="https://www.geeksforgeeks.org/white-and-black-dot-detection-using-opencv-python/" rel="nofollow noreferrer">https://www.geeksforgeeks.org/white-and-black-dot-detection-using-opencv-python/</a>).</p>
  
  <p>However I would like to be able to count the missing atoms for a given structre: eg I've circled in red the clusters of dots that I would like my network to identify and count as a structure with 8 atoms for example. I have thought the easiest method might be to:</p>
  
  <ul>
  <li>Apply bounding boxes based on segmentation, crop the image and count the atoms per box,which would provide a labelled image, however a big issue would be the inclusion of additional, non-connected atoms in the box</li>
  </ul>
  
  <p>If this approach was taken, how would I be able to create more specific-shaped boxes? I could try coloring each circle based on the area, and ignoring the other color when cropped to the bounding box size?</p>
  
  <p>Personally I think the question I'm struggling with is how do I segment this image and process each cluster, or is there a smoother technique that I could use or integrate into my ML model?</p>
  
  <p><a href="https://i.stack.imgur.com/IDX4I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IDX4I.png" alt="enter image description here"></a></p>