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. Showing 16 bit grayscale image on QImage (Format_Grayscale16)
Forum Updated to NodeBB v4.3 + New Features

Showing 16 bit grayscale image on QImage (Format_Grayscale16)

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.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.
  • M Offline
    M Offline
    masa4
    wrote on last edited by
    #1

    I have 16 bit grayscale image as opencv Mat object. I am trying to create a QImage with it and it works ok at qt 6.4. But I need to be able to compile same project at Qt 5.5 version. Format_Grayscale16 property included at Qt 5.13. My code right now:

    QImage qimg(img.data, img.cols, img.rows, img.step, QImage::Format_Grayscale16);
    

    So this gives error when trying to build at Qt 5.5 version.
    Are there any options for me at this point?

    Christian EhrlicherC 1 Reply Last reply
    0
    • M masa4

      I have 16 bit grayscale image as opencv Mat object. I am trying to create a QImage with it and it works ok at qt 6.4. But I need to be able to compile same project at Qt 5.5 version. Format_Grayscale16 property included at Qt 5.13. My code right now:

      QImage qimg(img.data, img.cols, img.rows, img.step, QImage::Format_Grayscale16);
      

      So this gives error when trying to build at Qt 5.5 version.
      Are there any options for me at this point?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @masa4 said in Showing 16 bit grayscale image on QImage (Format_Grayscale16):

      Are there any options for me at this point?

      Upgrade to 5.13 or convert the image to a image format supported by Qt 5.5

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      M 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        @masa4 said in Showing 16 bit grayscale image on QImage (Format_Grayscale16):

        Are there any options for me at this point?

        Upgrade to 5.13 or convert the image to a image format supported by Qt 5.5

        M Offline
        M Offline
        masa4
        wrote on last edited by
        #3

        @Christian-Ehrlicher If I use 8 bit format i think i will lose quality of image, right? Are there any option to show the image as 16 bit? with qimage or with any other classes?

        Christian EhrlicherC 1 Reply Last reply
        0
        • M masa4

          @Christian-Ehrlicher If I use 8 bit format i think i will lose quality of image, right? Are there any option to show the image as 16 bit? with qimage or with any other classes?

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @masa4 said in Showing 16 bit grayscale image on QImage (Format_Grayscale16):

          Are there any option to show the image as 16 bit?

          Use a newer Qt version. I mean - what do you expect? Your Qt version does not provide a q6 bit grayscale so you have to work around it by the two options I gave to you.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          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