Why am I getting different results when I ask to find the centroid of an image

2 views (last 30 days)
I have been using the following commands to find the centroid of a gray scale image derived from a color image in photoshop by changing the mode to gray scale:
grayImage = imread('2014-0825.jpg');
stats = regionprops(true(size(grayImage)), grayImage, 'WeightedCentroid');
centroid = stats.WeightedCentroid
previously I would get two numbers indicating the x and y pixels of the centroid Now using new images I get the results
centroid =
1.0e+03 *
1.2958 1.3177
What is this?

Answers (1)

Image Analyst
Image Analyst on 13 Nov 2015
You always (since R2008a) would get a 2 element array with the (x,y) or (column, row) of the weighted centroid. Nothing has changed. What two different results are you getting?
  22 Comments
Image Analyst
Image Analyst on 21 Jan 2016
David's "Answer" moved here since it's not an answer to the original question:
Thanks that does it. answer comes out on the Workspace.
Image Analyst
Image Analyst on 21 Jan 2016
You're welcome David. Can you go ahead and mark the Answer as "Accepted" then? Thanks in advance.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!