Step 1: Read in the Color Image and Convert it to Gray scale
Step 2: Use the Gradient Magnitude as the Segmentation Function
Use the Sobel edge masks, imfilter, and some simple arithmetic to compute the gradient magnitude. The gradient is high at the borders of the objects and low (mostly) inside the objects.