[R] Centre of gravity of a mountain
Ab Hu
master.rstat at yahoo.com
Wed Nov 10 07:06:50 CET 2010
Peter Langfelder wrote:
>
> Sorry, I'm not sure what you want to do in points 2-4. Shrink the
> mountain vertically or horizontally? You can for example look up image
> resizing algorithms if you want to shrink the area under the mountain
> but keep the shape of the mountain (approximately) the same. For
> cross correlation, simply do cor( c(mountainMatrix1),
> c(mountainMatrix2)). The c() function takes values in a matrix and
> "straightens" them out into a single vector.
>
> Peter
>
Sorry, I was not clear.
Step2: I want to shrink (by half) the mountain along XY (i.e. ignore height)
based on the centroid value i find in step 1. Yes, I am looking for
algorithms similar to image resizing, more specifically i want to use
bilinear interpolation while resizing where neighboring 4 pixels are
averaged.
So, based on that concept, every value should be averaged with neighboring 4
values in the matrix.
Is there any package in R which uses such algorithm?
Step3: After step2, the relevant values of the mountain will be constrained
to 11x11, however i want the final matrix size to remain 21x21 with zeros
coerced where necessary.
Step4: Yes, since i will be generating several such maps I want to use cross
correlation to compare them for similarity. More specifically i need
Pearson's correlation, seems like cor will do it.
Thanks for the corrected z-coordinate formula. I needed just the X and Y
coordinates to get the centroid because I want to shrink my mountain only
along those dimensions.
--
View this message in context: http://r.789695.n4.nabble.com/Centre-of-gravity-of-a-mountain-tp3032319p3035549.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list