Hi there.

I need to implement a filter that takes each white pixel in a binary image and look for the distance between the top and bottom closest background (black) pixels. If this distance is smaller than a threshold T all the pixels between this two background pixels should be set to 0 (background pixels).

I know I could iterate through all the image columns and pixels, but I think this would yield a poor performance. Is there any suggestion of how I could develop this filter in a more efficient way?

Thanks.