Example #1
0
def main():
    parser = argparse.ArgumentParser(description='Test blob functionality')
    parser.add_argument('--file', '-f', dest='file', default='test_images/balls.png', help='file to test', type=str)
    args = parser.parse_args()
    
    image = cv2.imread(args.file)
    blobs = Blob.find_blobs(image)
    for blob in blobs:
        blob.draw_outline(image, color=(0, 255, 0))
        blob.draw_fill(image, color=(255,0,0))
        print blob

    cv.NamedWindow('a_window', cv.CV_WINDOW_AUTOSIZE)
    cv2.imshow('a_window', image)
    cv.WaitKey(10000)
Example #2
0
 def find_blobs(self, image):
     blobs = Blob.find_blobs(self.mask_image(image))
     self.blobs = [blob for blob in blobs if blob.area < self.area*self.MAX_BLOB_RATIO]
     return self.blobs