How to fing COG?

1 Ansicht (letzte 30 Tage)
Jim
Jim am 23 Mai 2012
Hi,
How to find the center of gravity of image along the x direction of the line?
Thanks in advance

Akzeptierte Antwort

Image Analyst
Image Analyst am 23 Mai 2012
It's just the usual formula, the sum(x .* intensity) / sum(intensity). It's like the intensity cancels out and you're left with the weighted x value.
  2 Kommentare
Jim
Jim am 24 Mai 2012
How can I do it to all the rows in a image and save it
Image Analyst
Image Analyst am 24 Mai 2012
oneRowIntensity = image2D(theRowYouWant, :);
x = 1:size(image2D, 1);
Then use the formula I gave you, and save it using save() or imwrite() or into a variable. Put that into a loop if you want to do it for all the rows that you want to do it over.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by