title: Python: Counting number of objects inside a section of an image and label it with a determined color
body: <p>I am stuck here trying to develop a solution for my college project for a given an already segmented image (example attached, but unfortunately the link isn't appearing because I'm still new here), the idea on it is to label each one of these segmented squares from the image and count the number of the objects inside each one of these squares and define a color depending the square value counted:</p>
  
  <p><a href="https://i.stack.imgur.com/EuH8n.jpg" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>I couldn't able to find anything here similar to this question according to my doubts anywhere in the net. Anyone has any idea or a way to do it? Thanks in advance!</p>