You can see that 256*256 = 65536. So to scale your values, first multiply the index by 256, to get the new locations for the actual values you are certain about.
So your value at position 3 in the first array ends at position 768 in the second array. This leaves rather large gaps between the values, however. How to fill them depends on how much computational power you want to spend, and what appearance you want the output to have.
I'll give an example with smaller sets below:
first array (size 4) -> resulting array (size 8)
We multiply the indices by 2
array= 0.5 -> 0*2 -> newarray= 0.5
array= 0.3 -> 1*2 -> newarray= 0.3
array= 0.7 -> 2*2 -> newarray= 0.7
array= 0.1 -> 3*2 -> newarray= 0.1
We know the positions of the original values, but we have gaps for the values newarray[1,3,5,7]. The quickest method would be to use the value of the previous element in the array. So newarray=0.5, newarray=0.3 and in general newarray[x]=newarray[x-1], when x is odd.
You can also do linear interpolation, where the value at each point is the midpoint of the values at each side. So for x=odd, newarray[x]=(newarray[x-1]+newarray[x+1])/2.
Depending on how smooth you want the output to look, you can go with quadratic or higher order interpolations. You should look up interpolation of you're not sure how to do it.
mahendragrMember Since 06 Jan 2010
Offline Last Active Sep 08 2011 02:27 AM
- Group Members
- Active Posts 25
- Profile Views 961
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
mahendragr hasn't added any contacts yet.