Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved QImage format for floating point image data

    General and Desktop
    3
    5
    869
    Loading More Posts
    • 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.
    • Perdrix
      Perdrix last edited by Perdrix

      My application currently holds the image data that it is processing in a number of templated "bitmap" classes (not related to Windows DIB).

      Specifically they are:

      Colour bitmaps:

      24 bit colour (3 planes RGB 8 bit)
      48 bit colour (3 planes RGB 16 bit)
      96 bit colour (3 planes RGB 32 bit)
      96 bit colour float (32 planes RGB 32 bit float)

      Monochrome bitmaps (one plane only)

      Single bit bitmap
      8 bit bitmap
      16 bit bitmap
      32 bit bitmap
      32 bit float bitmap

      My problem is that I can create a QImage whose pixel values are correct for the integer representations (by converting to an in storage DIB), but there doesn't appear to be any QImage variant that supports floating point image data.

      The above approach also may not work on MacOS and Linux (do they have DIB support like Windows?).

      Is this a problem I'm just going to have to "hack" my way around (e.g. scale the float bitmap pixel values to uint values and retain a pointer to the original data when I need the raw pixel value), or is there a better solution?

      Thanks a lot
      David

      JonB 1 Reply Last reply Reply Quote 0
      • Kent-Dorfman
        Kent-Dorfman last edited by

        Irrelevant of "modern video hardware", traditional video memory is most often planar, where each primary color gun gets a contiguous chunk of memory, and mapping of integral RGB values into that memory is far more efficient than doing floating point translations for each pixel. My sensibilities tell me that directly supporting floating point QImage would be grossly innefficient, and the docs ony reference formats of fixed bit widths for each color plane.

        1 Reply Last reply Reply Quote 1
        • Perdrix
          Perdrix last edited by

          What's this got to do with video? These are still images that I need to handle as float. You don't normally render a QImage to the computer display - you would normally interpose a Pixmap which can be 8bits or 16bits per plane.

          Kent-Dorfman 1 Reply Last reply Reply Quote 0
          • JonB
            JonB @Perdrix last edited by JonB

            @Perdrix said in QImage format for floating point image data:

            (e.g. scale the float bitmap pixel values to uint values and retain a pointer to the original data when I need the raw pixel value)

            So far as I know, that is what you will need to do. As you can see, QImage/QPixmap only deals with integer values.

            1 Reply Last reply Reply Quote 0
            • Kent-Dorfman
              Kent-Dorfman @Perdrix last edited by Kent-Dorfman

              @Perdrix said in QImage format for floating point image data:

              What's this got to do with video? These are still images that I need to handle as float. You don't normally render a QImage to the computer display - you would normally interpose a Pixmap which can be 8bits or 16bits per plane.

              It's still purely a matter of efficiency. If you need floating point color data then you should create a specialization of QImage where the constructor converts and stores floating point data in the recognized integer format, and if you want to export that data back out as floating point then it translates it back to export, with the understanding that you may lose fidelity. Any internal pixel operations on floating point are going to be innefficient and complex, and thus the reason it's not directly supported.

              1 Reply Last reply Reply Quote 1
              • First post
                Last post