What is the meaning of a centroid of an RGB file as opposed the centroid of a grayImage file

3 views (last 30 days)
I run the script:
>> grayImage = imread('gray.image.jpg');
stats = regionprops(true(size(grayImage)), grayImage, 'WeightedCentroid');
stats = regionprops(true(size(grayImage)), grayImage, 'WeightedCentroid');
centroid = stats.WeightedCentroid
and get two numbers representing the x and y coordinates of the center of mass
However, when I replace gray-image.jpg with RGB.jpg (i.e. gray-image.jpg that is actually a RBG file I gets three values. The first two are close to the values the grayImage and the third is much smaller
for example instead of 247.2652 313.9184. I get 246.0814 315.0654 1.9728
what is the meaning of 1.9728?
  2 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 21 Mar 2016
1.9728 is the centroid along the third dimension. For this purpose remember that the third dimension only happens to be 3 units long.
An interpretation of it would be that the balance is just a hint more to the red channel than to the blue channel, but it's pretty darn close to being at the green channel.
This does not tell you anything about the dispersion of color. The same result could come about on an image that was nearly all pure green with a small number of red pixels, compared to an image that is nearly all gray (which balances red green and blue) with the blue being slightly under-represented in the light, compared to an image that is nearly completely magenta (equal red and blue with no green) with a slight excess of red. All it tells you is that the balance is very nearly in the middle, slightly heavier to one side.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by