title: Area of multiple blobs in a binary image python
body: <p>noob here.</p>
  
  <p>I have a (kind of) binary image that contains a known number of blobs that vary in shape and size. The pixel values in each blob equivalent to the blob index. I would like to process (using moments) only the largest 5 blobs. </p>
  
  <p>At the moment I am iterating through every connected pixel incrementing a variable to get the area of each blob (see code below). I then process only the largest blobs as required, however this pixel iteration method is very slow in python.</p>
  
  <pre><code> for i in range(1, objectCount):
              zm=0.0
              for h in range(im.height):
                  for w in range(im.width):
                      pixVal = cv.Get2D(im, h, w)
                      if (pixVal[0] == i):
                          zm=zm+1
              objectArea.append([int(zm)])
  </code></pre>
  
  <p>Is there a faster way to do this?</p>