Edge Detection
Some interesting links on how to perform edge detection.
I will put some source here too when I get a chance
Labelling
First to detect the edges of something you must identify it, I did this using the well understood method of Connected Component Labelling
More to come...