original_grayscale = numpy.asarray(some_PIL_image.convert('L'), dtype=float)
blurred_grayscale = scipy.ndimage.filters.gaussian_filter(original_grayscale,
    blur_parameter)
difference_image = original_grayscale - multiplier * blurred_grayscale
image_to_be_labeled = ((difference_image > threshold) * 255).astype('uint8')
Counting particles using image processing in python