Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Calculate the co-ordinates of the Largest Connected Component from Binary Image

Subject: Calculate the co-ordinates of the Largest Connected Component from Binary Image

From: Nehal

Date: 23 Oct, 2010 15:07:04

Message: 1 of 6

My original image is: http://img232.imageshack.us/i/originalimagew.png/
I have converted this image into Binary with some threshold value. The converted image is: http://img517.imageshack.us/i/binaryimage.png/
But in the binary image, some of the skin color was also converted as white with the white colored glove (red marked): http://img176.imageshack.us/i/binaryimagecopy.png/

Now I want to crop the gloved hand only with the gloved part using the "Larges Connected Component" method. I want the axis of the larges connected component so that I can use it to crop the image. The cropped image will be something like this: http://img257.imageshack.us/img257/1690/croppedimage.png
(I have done it in Photoshop, but I want it to be done in Matlab)
I just need the co-ordinates of the image.

Can anyone help me..?

Subject: Calculate the co-ordinates of the Largest Connected Component

From: ImageAnalyst

Date: 23 Oct, 2010 15:40:05

Message: 2 of 6

(Untested code) goes something like this:
Just get the areas:
areas = [blobMeasurements.Area];
Sort them
[sortedAreas, sortedIndexes] = sort(areas);
% Extract the largest bounding box:
largestBB = blobMeasurements(sortedIndexes(1)).BoundingBox;
Then use imcrop()

Subject: Calculate the co-ordinates of the Largest Connected Component

From: Nehal

Date: 23 Oct, 2010 16:08:05

Message: 3 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <630eca0f-5d42-487d-93d6-9863c102f686@e14g2000yqe.googlegroups.com>...
> (Untested code) goes something like this:
> Just get the areas:
> areas = [blobMeasurements.Area];
> Sort them
> [sortedAreas, sortedIndexes] = sort(areas);
> % Extract the largest bounding box:
> largestBB = blobMeasurements(sortedIndexes(1)).BoundingBox;
> Then use imcrop()

could you please post with some more details..? I am not getting anything..

Subject: Calculate the co-ordinates of the Largest Connected Component

From: Nehal

Date: 25 Oct, 2010 07:35:05

Message: 4 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <630eca0f-5d42-487d-93d6-9863c102f686@e14g2000yqe.googlegroups.com>...
> (Untested code) goes something like this:
> Just get the areas:
> areas = [blobMeasurements.Area];
> Sort them
> [sortedAreas, sortedIndexes] = sort(areas);
> % Extract the largest bounding box:
> largestBB = blobMeasurements(sortedIndexes(1)).BoundingBox;
> Then use imcrop()

could I get some more help please..? a lot of work has already been done related to "Largest Connected Component"

Subject: Calculate the co-ordinates of the Largest Connected Component

From: Image Analyst

Date: 25 Oct, 2010 10:25:07

Message: 5 of 6

"Nehal " <arnab620@yahoo.com> wrote in message <ia3bv9$ij2$1@fred.mathworks.com>...
> could I get some more help please..? a lot of work has already been done related to "Largest Connected Component"
----------------------------------------------------------------
I have no idea what work you're talking about. And I gave you the code already that should pretty much run. If you want a more complete example, look at my image segmentation demo:
http://www.mathworks.com/matlabcentral/fileexchange/25157

Subject: Calculate the co-ordinates of the Largest Connected Component

From: Nehal

Date: 25 Oct, 2010 16:12:04

Message: 6 of 6

"Image Analyst" <imageanalyst@mailinator.com> wrote in message <ia3lu3$hi$1@fred.mathworks.com>...
> "Nehal " <arnab620@yahoo.com> wrote in message <ia3bv9$ij2$1@fred.mathworks.com>...
> > could I get some more help please..? a lot of work has already been done related to "Largest Connected Component"
> ----------------------------------------------------------------
> I have no idea what work you're talking about. And I gave you the code already that should pretty much run. If you want a more complete example, look at my image segmentation demo:
> http://www.mathworks.com/matlabcentral/fileexchange/25157

oh.. that example would really help me.. thank you very much.. :)

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us