title: Reg: Copy blob based on the area of the blob size
body: <p><strong>Objective:</strong> Copy the bigger blobs in another mask image</p>
  
  <p>I have a threshold image with blobs as shown:</p>
  
  <p><a href="https://i.stack.imgur.com/i24Wl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i24Wl.jpg" alt="enter image description here"></a></p>
  
  <p>How could I copy the bigger blobs into a mask image and leave out the one-pixel blobs?</p>
  
  <p><a href="https://i.stack.imgur.com/onIbJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/onIbJ.png" alt="enter image description here"></a></p>
  
  <p>My code (but I am not getting the desired result):</p>
  
  <pre><code>import numpy as np
  import cv2
  
  ref_img = cv2.imread('threshold.jpg', 0)
  thresh = np.copy(ref_img)
  cnts,_ = cv2.findContours(ref_img, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
  mask = np.zeros(ref_img.shape, dtype="uint8")
  for c in cnts:
     (x,y),radius = cv2.minEnclosingCircle(c)
     area = cv2.contourArea(c)
     if int(area) &lt; 1:
        cv2.circle(mask, (int(x), int(y)), int(radius), (255, 255, 255), -1)
  
  cv2.imshow('img', mask)
  cv2.waitKey(0)
  </code></pre>
  
  <p><strong>Note:</strong> Using OpenCV 2.4.x</p>