Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QCamera capture 8bit gray scale and convert to rgb
Qt 6.12 LTS is out! See what's new in the release blog

QCamera capture 8bit gray scale and convert to rgb

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
14 Posts 3 Posters 7.8k Views 1 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    How is that sensor seen by the system ?
    What version of Qt are you using ?
    What platform are you running on ?

    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
    • L Offline
      L Offline
      Lorenc
      wrote on last edited by
      #3

      The sensor is seen as /dev/video0.
      I am using Qt for device creation v 5.8.
      I am building on linux platform for IMX.6 Q SabreSD.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mvuori
        wrote on last edited by
        #4

        Just some thoughts:

        • If you wish to minimise CPU usage, why do the capture at such high resolution? For supported resolutions, check QCameraImageCapture::supportedResolutions()
        • There might not be no need to convert the image to RGB for display -- Qt should handle grayscale just well
        • Scaling using any scaling functions may be more innefient than creating an empty target image and picking every Nth pixel for it from the source (JPEG buffer converted into QImage -- see QImage::loadFromData()) and calculating for the pixel either grayscale RGB value or indexed grayscale value from the source buffer
        1 Reply Last reply
        0
        • L Offline
          L Offline
          Lorenc
          wrote on last edited by
          #5

          Thanks for your prompt reply.
          I can't change the resolution at which the sensor is capturing. It is a special sensor and I can't configure for lower resolution.
          I have a test app that does the scaling by doing just that copy/scale (copying only the needed pixels to destination image buffer). The problem is that this is very slow process. It takes 0.6 seconds per frame. This doesn't work for my application this is the reason I was wondering if the scale and image conversion could be done by gpu. I can copy the frame from the camera to a buffer in memory but then I need to somehow hand over the buffer to the gpu and do the scaling/conversion there.

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

            So something like creating a texture from the image and then process it ?

            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
            • L Offline
              L Offline
              Lorenc
              wrote on last edited by
              #7

              yes exactly.

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

                Something like QOpenGLTexture ?

                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
                • L Offline
                  L Offline
                  Lorenc
                  wrote on last edited by
                  #9

                  @SGaist
                  How can I use a that texture class. The camera app seems to handle everything under covers.

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

                    Before going further, what will you be using to display the image ? QtWidgets ? QtQuick ?

                    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
                    • L Offline
                      L Offline
                      Lorenc
                      wrote on last edited by
                      #11

                      QtQuick 2.4 is imported by the qml. I must be using QtQuick. I am new to Qt.

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

                        Then, IIRC, your image is already a texture or something similar if you are using QtQuick with the VideoOutput element.

                        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
                        • L Offline
                          L Offline
                          Lorenc
                          wrote on last edited by
                          #13

                          I found this article: http://blog.qt.io/blog/2015/03/20/introducing-video-filters-in-qt-multimedia/
                          on video filters. I will give this a try.
                          I have another question though since I need to differentiate between preview and capture formats.
                          The sensor generates 8 bit gray for preview and then I need to switch to 16bit gray for capture.
                          How can this be done by the camera. I don't see an api to specify capture mode or preview mode. I could be wrong though.

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

                            Does your camera provide an API for that ?

                            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
                            • Unsolved