We help IT Professionals succeed at work.

How to shrink a matrix

qocarlos
qocarlos asked
on
Hi,

I'm writting an application that display 3D-images (surfaces) of a function plot (z=f(x,y)) using OpenGL rendering context. The function values are contained in a 2D matrix and what I want to do is to reduce the size of the matrix before rendering in the context because if the matrix is 1024x1024 the graph takes too much time to be displayed.
I'm considering about filtering the original 1024x1024 matrix in order to
get a smaller one (e.g. 124x124) but keeping a reasonable resolution (it's
not adequate to take 1 point and skip 9, it's necessary some sort of
interpolation). I would like to know if you are aware of any algorithm to do this.


Thanks in advance,

Carlos
Comment
Watch Question

There are many interpolation methods. Which one you use depends on the type of graph you're trying to draw.

If the graph is fairly smooth (i.e. no "spikes") you can use a simple linear interpolation with a few points. If not, you will have to analyze a lot of the graphs and try to get a "best fit" interpolation.

This is a spesialized field and you'll need quite a bit of mathematical background to achieve that. I can't even pretend to remember how to do it, did some courses waayyy back in uni. I'm sure a search on google for "iterpolation methods" or similar should give you a starting point.

The problem, as always, is that what you gain in performance you will lose on accuracy. There is now way around that - the best you can do is strike a happy balance between the two.

Commented:
You may want to consider some sort of multiresolution model.

When viewing the whole plot, you could have a sampled or interpolated grid, with the caveats mentioned by LoungeLizard.  Then as you zoom in to a section, do local evaluations to get more detail as needed.

This is a nice method as you can adjust how much detail you need against how much the system can handle.  However, deciding how much local evaluation to do with a multiresolution model is still an open research question, but since your context is fairly narrow, you should be able to get something reasonable by guessing a bit.

Commented:
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest refund the points and delete this question since nobody had a satisfyng answer for you.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner

Commented:
Sorry

...I will suggest refund the points and PAQ at 0 points since nobody had a satisfyng answer for you.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner

Per recommendation, points refunded and question closed
Netminder
CS Moderator

Explore More ContentExplore courses, solutions, and other research materials related to this topic.