Results 1 to 6 of 6

Thread: Display my data array as an image

  1. #1
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    39
    Thanks
    15
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Display my data array as an image

    Hi all,

    I will try an explain what I am after so that it is clear.

    I have an array of floats that I have read from my binary data file and they are stored in the following manner array[x][y][z] which is a multidimensional QVector.

    z in this case represents a spectral band so the entire array is a number of [x][y] images for each band [z]

    My question is how do I display one of these image planes? e.g. array[x][y][0] for example

    Cheers
    Oz

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Display my data array as an image

    Make a pixmap with dimensions x,y.

    Define a sensible colormap.

    Transform your array values into color and save in correct pixmap pixel.

    See qcolormap and qpixmap

    Edit: looks like qcolormap isn't quite what I thougt, so you might have to make your own map for that step.
    Last edited by amleto; 4th December 2012 at 07:15.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. The following user says thank you to amleto for this useful post:

    OzQTNoob (4th December 2012)

  4. #3
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    39
    Thanks
    15
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Display my data array as an image

    Thanks for that I will give it a go and see how I go.

    Cheers
    Oz

    turns out Im still to much of a noob to figure it out. Read many web articles, still confused. A simple example might help me
    Last edited by OzQTNoob; 4th December 2012 at 08:04.

  5. #4
    Join Date
    Nov 2006
    Location
    indonesia
    Posts
    55
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Display my data array as an image

    Hi,
    I look this website create a simple demo like your problem.
    You need to create a colormap and convert your data to colormap. Please check at this site.

    http://toto-share.com/2012/12/qt-imagesc-simple-code/

    Best regards,

    myta212

  6. #5
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    39
    Thanks
    15
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Display my data array as an image

    I will check out your link.

    cheers
    Oz

  7. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Display my data array as an image

    The Qwt package ( http://qwt.sf.net ) offers a plot item called spectrogram that might be what you are looking for.

    Uwe

  8. The following user says thank you to Uwe for this useful post:

    OzQTNoob (4th December 2012)

Similar Threads

  1. Replies: 0
    Last Post: 26th July 2012, 09:32
  2. How to Display/Paint raw image data.
    By vinaykusta in forum Qt Programming
    Replies: 5
    Last Post: 12th October 2011, 14:01
  3. Display an image from a unsigned char array
    By Percy in forum Qt Programming
    Replies: 1
    Last Post: 1st December 2009, 20:16
  4. Using a 2d data array to create an image
    By dbrmik in forum Newbie
    Replies: 20
    Last Post: 28th October 2008, 17:22
  5. Replies: 2
    Last Post: 29th September 2008, 00:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.