I have an array, whose size is 256. This array has elements which are in 0 to 1 range. Now, i need an array whose size should be 65536, where each element should be interpolated or scaled from the original array of 256 values. I asked in another thread, but i wasnt clear enough 🙁
Some kind of mapping where, lets say, 10 values from the original image should match to more number values in the bigger array. Is it doable?
EDIT : lets say i have an array which is 256 floats, each float is in 0 to 1 range. Now, i need a new array, which should be 65536 floats again each float in 0 to 1 range. These new float values should be interpolated or scaled from original 256 floats.
Disclaimer: My C++ isn’t so great these days. This will look something more like Java. I’m assuming you weren’t planning on copying and pasting anyway: knowing the algorithm is much more important then the implementation language.
The following algorithm does NOT make 65536 entries for a 256 entry input. Instead, it makes 65281. The reason for this is you need to scale FROM something TO something else. Consider a fence with 256 posts. You’ll only have 255 sections of fence. Each scaling corresponds to a section of fence. For simple math, I make the number of samples between each original sample equal to the number of original samples. So if you put a 4 entry input, you’ll get a 13 entry output. A 100 entry input will make a 9901 entry output.
Enjoy!