开发者

2d grid interpolation

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).

Do I understand correctly that, for example, an array of 3x3 (all known values)

A B C
D E F
G H I

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

where x marks unknown yet interpolated value, right?

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? Thank开发者_开发问答s in advance.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜