Hi all,

I have done few lines of codes to get the largest connected components of this image which appears to be lips. The image is "label
Code:
[L,n] = bwlabel(I2,4);
figure(4)
imshow(L)

graindata = regionprops(L,'basic'); %graindata = area,centroid, bounding box of L
f = graindata.Area
cc=max([graindata.Area]); %cc= sum of pixel
biggrain = find([graindata.Area]==cc);
hold on

    [r,c] = find(L==biggrain);
    rbar = mean(r);
    cbar = mean(c);
    plot(cbar,rbar, 'Marker', 'o', 'MarkerEdgeColor', 'k', 'MarkerFaceColor', 'k', 'Markersize', 10)
    plot(cbar, rbar, 'Marker', '*', 'MarkerEdgeColor', 'w')
I have found the largest connected component.
How can I progam to eliminate or turn other components to black "0" background except the biggest component?

Anyone please help. Thank you.

Best regards,
Tommy