# Convert and resize matrix to image

• Hi,

I am currently have a requirement to display data from a database (signal strength) as a heatmap. The problem I am facing is that the data is too sparse [it's uniformly distributed over a 2D space though].

On plotting the data as blocks, the image comes out as having jagged edges. I tried blurring out the edges [I failed miserably], I tried increasing my corpus by averaging the data [there was something wrong with my approach as the result still had some blocky-ness].

I was suggested to make a small image and resize it with some interpolation[Cubic and Sal] technique.

I think I should be able to manage making the db data into an image using :
https://stackoverflow.com/questions/1982878/how-to-display-image-from-array-of-colors-data-in-qt

The problem comes for interpolation while resizing. I didn't find anything which would allow me to do the same as a library. I was wondering if I missed something or if there could be any other way for getting a good result. A link to any example which could give me a lead would be highly appreciated.

Thanks

• Hi
Can you show the source image ?
Im wondering if some gaussian blur would make it look better.
Its easy to test with photoshop if you can provide a test image. ( blocky one)

If not possible you could test with something like
https://github.com/Frodox/gaussian-blur-qt-example
or
https://stackoverflow.com/questions/3903223/qt4-how-to-blur-qpixmap-image

• @mrjj Sorry for not mentioning this before, I already tried a Gaussian Blur, it didn't help.
The data is have is in the form: (xCood, yCood, zCood, value)
For the first phase I am ignoring zCood.
The problem comes with the sample data granuality as data is something like:
(0,0), (0,100)..............(0,1500)
(100, 0).(100,100)........(100,1500)
.....
.....
(1500, 0).(1500,100)........(1500,1500)

I have a canvas of 1500x1500

The image before gaussian (The border is part of a layer above the image, so they aren't going anywhere soon):

After Gaussian Blurring (and some some interpolation on my part)(the data is a little different in both cases and I have done this in a separate application):

As you can see, the output still has some boxiness to it. Also, doing it like this is just removing the sharpness of the image [it is eventually meant to be used to visualize input data not be a sunset image. Not to mention I am going too far with the blurring here making it really heavy for a repaint].

EDIT:

Forgot to mention, I am using a continuous hue change here w.r.t value. But it seems that the proposal is for limited number of colors making the output even more blocky and blurring even more useless.

EDIT 2:

I eventually used the 2D shader for openGL.
Latest output:

Seems the most promising one yet