here are the commands that makes your work easy...
As "Superbest" said fill the image with command
%% Example%%
img = imread('coins.png');
BW4 = im2bw(img );
BW5 = imfill(BW4,'holes');
imshow(BW4), figure, imshow(BW5);
Now use command bwlabeln(), to find out the number of clusters or shapes.
%% Example%%
L = bwlabel(BW5);
figure,imshow(L,[]);
L will give you number of shapes with same number to all the pixels belongs to same shape.
L containing labels for the connected components in BW. BW can have any dimension; L is the same size as BW. The elements of L are integer values greater than or equal to 0. The pixels labeled 0 are the background. The pixels labeled 1 make up one object, the pixels labeled 2 make up a second object, and so on.
Suppose you have two shapes or regions then to find the original color or gray scale values od as follows.
%% Example%%
cods = find(L==1);
Shape1(1:size(img,1),1:size(img,2))=0;
Shape1(cods) = img(cods);
%% Now shape1 is same size as img, but will have gray scale values at region1 locations only,you will get RGB valuse in shape1 image.. repeate it for as many shapes as you have in your image.
Have a happy coding...