Re: how to calculate centroid for non-constant desity polygon
- From: ImageAnalyst <imageanalyst@xxxxxxxxxxxxxx>
- Date: Sat, 24 Jan 2009 15:05:18 -0800 (PST)
To do it numerically, first create your polygon in an array with the
exponential values for the elements. Then....
To find the x centroid, just use sum(v*x)/sum(x).
To find the y centroid, just use sum(v*y)/sum(y).
v is the exponential formula you gave. Calculate the sum over ALL
array elements, in both the x and y directions, to get either of the
centroids.
If you have the image processing toolkit, just threshold, use bwlabel
() and then use regionprops(). Be sure to pass in your original
image, as well as your thresholded image (which specifies which pixels
contain the polygon) into regionprops().
You can compare your numerical answer with the analytical answer which
you can probably find in a book on calculus or statistics. If you
need more accuracy, just make your array bigger.
Regards,
ImageAnalyst
.
- References:
- how to calculate centroid for non-constant desity polygon
- From: gtechnical
- Re: how to calculate centroid for non-constant desity polygon
- From: Matt
- Re: how to calculate centroid for non-constant desity polygon
- From: gtechnical
- how to calculate centroid for non-constant desity polygon
- Prev by Date: Re: Plot temperature in map?
- Next by Date: Is there any method similar to group by as in Access SQL
- Previous by thread: Re: how to calculate centroid for non-constant desity polygon
- Next by thread: Re: how to calculate centroid for non-constant desity polygon
- Index(es):
Relevant Pages
|