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:
Centroid of an image file

Subject: Centroid of an image file

From: Sunayana C

Date: 28 May, 2013 18:37:19

Message: 1 of 2

Hello every one...

I need to find the centroid of an image file...However I don't have the image tool box and hence converted my images in .bmp format to .mat format using octave....Now I need to find the centroid of this .mat file how should I do it ??

Subject: Centroid of an image file

From: Image Analyst

Date: 30 May, 2013 01:10:08

Message: 2 of 2

"Sunayana C" wrote in message <ko2tgv$o75$1@newscl01ah.mathworks.com>...
> Hello every one...
>
> I need to find the centroid of an image file...However I don't have the image tool box and hence converted my images in .bmp format to .mat format using octave....Now I need to find the centroid of this .mat file how should I do it ??
====================================================
See my image segmentation tutorial. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

Basically you can set up a binary image the same size as your image and then call regionprops:

binaryImage = true(size(grayImage));
measurements = regionprops(binaryImage, grayImage, 'WeightedCentroid');
centroids = [measurements.WeightedCentroid];

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