2D网格插值 [英] 2d grid interpolation
问题描述
我有N×M个插值的二维数组AXB,其中A> N和B> M的这点是建立一个数组(热图)的一个简单的色彩codeD映像的任务。
I have a task of interpolating a 2d array of NxM to AxB, where A > N and B > M. The point of it is building a simple color coded image of an array (heat map).
我是否理解正确的话,例如,3x3的阵列(所有已知值)
Do I understand correctly that, for example, an array of 3x3 (all known values)
A B C
D E F
G H I
应插在,比如说,6x6的以这种方式
Should be interpolated in, say, 6x6 in this manner
A x B x x C
x x x x x x
D x E x x F
x x x x x x
x x x x x x
G x H x x I
其中x标志着未知尚未插值,对吧?
where x marks unknown yet interpolated value, right?
这个问题能在两个嵌套的循环呢?我发现双线性插值公式的,但有一些麻烦,它适应(I,J)的结果数组循环。有何意见?先谢谢了。
Can this be done in two nested for loops? I found bilinear interpolation formula, but having some trouble with adapting it to (i, j) of resulted array loop. Any advices? Thanks in advance.
推荐答案
您可以使用像.NET,Qt的或SDL的库去做,这是一个常见的应用任务。
You could use a library like .NET, Qt or SDL to do it, it's a common application task.
。 插值通常意味着你只插两个值之间 - 一旦你有一个形象,这就是所谓的过滤
If you want to implement it yourself, read about Bilinear filtering rather than bilinear interpolation. "Interpolation" generally means you interpolate just between two values - once you have an image, it's called filtering.
考虑更好看的过滤器,如双三次了。
Consider nicer looking filters such as bicubic, too.
这篇关于2D网格插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!