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. [SOLVED] How to access pixel values in 16bit Grayscale TIF?
QtWS25 Last Chance

[SOLVED] How to access pixel values in 16bit Grayscale TIF?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 6.0k 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.
  • P Offline
    P Offline
    pmh4514
    wrote on last edited by
    #1

    I have a 16bit grayscale TIF file which I load from disc into a QImage.

    Ultimately for display I will use QPixmap which is going to resample it to 8 bits, but first I want to calculate a histogram (and possibly adjust) before the 8bit downsample for display.

    This seems like it should be a simple question, but how do I access the 16bit grayscale pixel values (ie. the value between 0 and 65,536)? I know I can access myImg.pixel(x,y) for any coordinate, but that only returns a QRgb.

    Or am I misunderstanding QRgb?

    Thanks!

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

      Hi,

      AFAIK, QImage doesn't support 16bit images yet (might be in the future, if someone implements it)

      What you can do however is use a library like OpenCV for this kind of mathematics.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pmh4514
        wrote on last edited by
        #3

        ahh ok so the 8bit downsampling is happening the instant I load the QImage from disc? I'll try OpenCV, thanks

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pmh4514
          wrote on last edited by
          #4

          Yes, OpenCV worked much better. thanks!

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Tchernio
            wrote on last edited by
            #5

            I need to load and process 16bt tiff image with full scale using QImage. From what I read there are no any activities on that front.

            If this is going to happen in the distant future I probably would need to get OpenCV and using it instead Qt

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi and welcome to devnet,

              For 16bit tiff images processing you should rather use OpenCV

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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