MATLAB: Cut An Image

Image Processing Toolboximage segmentation

Hi All,
Is there a way by which we can separate an image like this?
I would like to get an output like below.
I tried morphological operation but i could not and I am not sure that it is a true way.
Thanks in advance.

Best Answer

clear; clc;
I = imread('tamp9f.png');
Icrop = imcrop(I);
bw = im2bw(Icrop);
imshow(bw); pause;
Ifill = imfill(bw,'holes');
imshow(Ifill); pause;
Iarea = bwareaopen(Ifill,10000);
imshow(Iarea); pause;
boundary = bwboundaries(Iarea);
b = boundary{1};
imshow(Ifill); hold on;
plot(b(:,2),b(:,1),'g','LineWidth',3);
The Result :