Algorithms for realtime component labelling of images