Why don't you just use label2
? That's already a matrix with each individual component given a different value. Then apply one of the built in colormaps, or produce a colormap which forces the background (zero) values to be white or black as you prefer.
imshow(label2,[])
colormap(lines)