Nearest Neighhbour help

Hi everyone,

I am using an array and performing Interpolation to create a new array which can store my new values after interpolation, But I dont know how to start with it..

My array is [ 12, 56, 78, 90, 100,

20, 21 , 43, 56, 100,

45, 78, 78, 78, 20 ,

60, 56, 80, 83, 20]

How do I perform interpolation to get a new array .

Thank you.

[383 byte] By [ephemerala] at [2007-10-3 2:47:46]
# 1
I'm not even sure you're using the word interpolation correctly, so I have no idea what you're asking!!!Interpolation means:1) to insert material into2) deals with curve fittingDo you mean either of those?Message was edited by: OMGstay
OMGstaya at 2007-7-14 20:36:33 > top of Java-index,Security,Cryptography...
# 2

Okay, since that seems to be a one-dimensional array, even though it's formatted incorrectly for an array literal, I'll assume that this is an one-dimensional interpolation.

First you need to create a blank array to store your values in, the same size that your result needs to be.

Imagine these two arrays as lengths of string or something to that effect. The values of the array elements are marked at even intervals along the strings.

Imagine that the two arrays are put next to each other so that they're parallel and their ends line up. Now, for each element in the destination array, you need to assign to it the value that's closest to it in the source array.

Well, that was my attempt at an explanation.

myjavasticka at 2007-7-14 20:36:33 > top of Java-index,Security,Cryptography...
# 3
Hey thank you very much for the explanation though my question was not that clear.I understood your explanation.
ephemerala at 2007-7-14 20:36:33 > top of Java-index,Security,Cryptography...
# 4
Actually my data is image which is two dimensional array , I am scaling the image and then interpolating the image to get the final one.SO can you help me with that .Regards,Ephemeral.
ephemerala at 2007-7-14 20:36:33 > top of Java-index,Security,Cryptography...
# 5

Well, okay, it'll be similar to the above explanation, except two-dimensional. So you have two coordinates instead of one.

An analogy would be two panes of glass, one on top of the other.

Same concept, really. Now that I think about it, it's really just repeating the above process twice, once for each coordinate.

myjavasticka at 2007-7-14 20:36:33 > top of Java-index,Security,Cryptography...