Does anyone have any code or know where to find any code for doing connected component labeling on binary images?

I'm using the CImage class to load the image and using the GetBits() function to get a pointer to the image array. I need to be able to take that image and put it into a connected component labeling function and receive a labeled image.

Thanks