timholy / Grid.jl

Interpolation and related operations on grids
MIT License
47 stars 26 forks source link

extend interpolation to multichannel images? #54

Closed twadleigh closed 5 years ago

twadleigh commented 9 years ago

It appears that InterpGrid is currently limited to supporting interpolations on Arrays of FloatingPoints. How difficult would it be to extend it to support, e.g., RGBs of FloatingPoints?

From a mathematical perspective, at least, I would think it should be natural to extend interpolation to any type that acts like a vector space over a "field" of FloatingPoints.

If it is anything more than trivial to implement, I'll just implement my own for now, since my current need would be satisfied by bilinear interpolation, but this would certainly represent a longer-term nice-to-have.

timholy commented 9 years ago

It wouldn't be that hard, but Grid is a bit of a mess when it comes to declaring the output type. I think you could implement your case easily (probably just by removing some type declarations), but one would want to think about what happens when the user supplies an integer array as input. All this is fixable---maybe even without very much effort---but for myself I'm not 100% certain it's worth it given that there's a more carefully-planned successor to Grid coming: https://github.com/tlycken/Interpolations.jl. Of course, if you decide to fix the problem in Grid I'd be happy to merge it.

Also, FYI there's a non-exported bilinear-interpolation resize function in Images.

twadleigh commented 9 years ago

Thanks for the reminder about Interpolations.jl. I forgot that I had seen traffic about it on the mailing lists or wherever. I'll keep resize in mind, too, as a backup.

moon6pence commented 9 years ago

Similar issue for me, I need interpolations on Arrays of Complex.

I'll try to dig up the internals or simply just try Interpolations.jl.