Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Convert and resize matrix to image

Convert and resize matrix to image

Scheduled Pinned Locked Moved Solved General and Desktop
interpolationresize
3 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ankit.Jain
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      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

      A 1 Reply Last reply
      1
      • mrjjM mrjj

        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

        A Offline
        A Offline
        Ankit.Jain
        wrote on last edited by Ankit.Jain
        #3

        @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):
        0_1518061962924_fbc31252-f65a-4d03-aad5-40f6f369fafc-image.png

        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):
        0_1518062175313_88caa6b0-f765-4bab-952a-1530216f95bc-image.png

        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:
        0_1518073252613_7eaa025a-b967-4d3b-a345-796f7b517ec4-image.png

        Seems the most promising one yet

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved