First check how much time it takes to label a random (1024, 1024) binary image. $ python -mtimeit -s 'import numpy as np; from skimage.measure import label, regionprops; np.random.seed(0); im = ...