Close

made it even faster. has option for not float version.

A project log for interpolation low ram method to double resolution

this is a crude but functional method of resolution doubling, when reading of data is slow from sensor, and ram is not really available.

jamesdanielvjamesdanielv 09/08/2019 at 15:040 Comments

again this is not my best method of interpolation. however it is the one i am using that has a good caching algorithm for pulling data from slow ram or functions, upsampling values and returning results all with only needing 1 call per sample to ram or function. this method drastically reduces math overhead.

also i have a version i just included here

https://cdn.hackaday.io/files/1674667164865344/ZZZ_doubleResolution(Nonfloat).h

it does interpolation using unsigned integers. this allows for faster >> in place of division or fractional multiplication. to keep information resolution of values i add 1/2 resolution total before then doing an equivalent of divide. this allows for information to carry into the interpolation result.

sub sample between x1 and x2

(x1+x2+1)>>1 this divides by two, but if both of the values are odd numbers, the information is included in output result because of the addition. otherwise information would be lost. so this method of adding a 1 is better for interpolation. if more detail is needed then the information from ram, can be multiplied by 8 before conversion to an unit16_t. 

the memory is read from a function called Readmlx90640To(){} it can be modified to whatever your project uses, or you can make a function named the same and then leave it as written here.

for example my Readmlx90640To function is this:

return  MLX90640_CalculateToRawPerPixel(value);
}

it is a time consuming function that returns calibrated data from a thermopile sensor. each result takes a long time to process. so we only want to get data 1 time only. 

Discussions