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. QCamera has strange blue tint
Forum Updated to NodeBB v4.3 + New Features

QCamera has strange blue tint

Scheduled Pinned Locked Moved Unsolved General and Desktop
qcamera
25 Posts 8 Posters 5.5k Views 2 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.
  • Kent-DorfmanK Offline
    Kent-DorfmanK Offline
    Kent-Dorfman
    wrote on last edited by Kent-Dorfman
    #12

    Try different values for QCameraImageProcessing::WhiteBalanceMode and see if they have any effect.

    In particular look at the definition for the white balance value you are currently using. It says "base value", which would probably infer that there is a list of vender values starting at 1000, where the required value is specific to the product being used.

    SolaVitaeS 1 Reply Last reply
    0
    • Kent-DorfmanK Kent-Dorfman

      Try different values for QCameraImageProcessing::WhiteBalanceMode and see if they have any effect.

      In particular look at the definition for the white balance value you are currently using. It says "base value", which would probably infer that there is a list of vender values starting at 1000, where the required value is specific to the product being used.

      SolaVitaeS Offline
      SolaVitaeS Offline
      SolaVitae
      wrote on last edited by
      #13

      @Kent-Dorfman
      ive tried all of them, with no change

      I've narrowed the issue down to it inverting the red/blue colors

      as seen in this image
      alt text

      The colors actually are Red - > Green - > Blue, but it inverts red and blue

      1 Reply Last reply
      2
      • mranger90M Offline
        mranger90M Offline
        mranger90
        wrote on last edited by
        #14

        Ok, that's pretty much what I expected. The output from the camera is probably RGB but a lot of windows drivers are expecting BGR. Or it's possible (but less likely) that your camera is putting out BGR and the driver expects RGB. You might be able to change this by examining the QImageEncoderSettings to see if there is a pixel format and changing it. Or you can try intercepting the buffers and building a QImage based on the correct orientation.

        SolaVitaeS 1 Reply Last reply
        1
        • mranger90M mranger90

          Ok, that's pretty much what I expected. The output from the camera is probably RGB but a lot of windows drivers are expecting BGR. Or it's possible (but less likely) that your camera is putting out BGR and the driver expects RGB. You might be able to change this by examining the QImageEncoderSettings to see if there is a pixel format and changing it. Or you can try intercepting the buffers and building a QImage based on the correct orientation.

          SolaVitaeS Offline
          SolaVitaeS Offline
          SolaVitae
          wrote on last edited by
          #15

          @mranger90

          Is there an easy way to do this? seems odd that it only occurs in QT, with both my actual webcam and a virtual one, but doesn't occur in an example using QML

          1 Reply Last reply
          0
          • mranger90M Offline
            mranger90M Offline
            mranger90
            wrote on last edited by mranger90
            #16

            You can check to see what the camera is supporting with

                QList<QVideoFrame::PixelFormat> formats = m_camera->supportedViewfinderPixelFormats();
                qDebug() << "supported formats " << formats;
            

            Then you might be able to do something like:

            viewFinderSettings.setPixelFormat(QVideoFrame::Format_RGB24);
            

            You might also want to check with some other application. As I recall, on windows the QCamera stuff is a rather thin layer over DirectShow so you might want to play with that to get a clear idea of whats coming off the camera.
            If worse comes to worst you may want to use something like OpenCV which will give you more control over the capture buffers and how to format them.

            SolaVitaeS 1 Reply Last reply
            1
            • mranger90M mranger90

              You can check to see what the camera is supporting with

                  QList<QVideoFrame::PixelFormat> formats = m_camera->supportedViewfinderPixelFormats();
                  qDebug() << "supported formats " << formats;
              

              Then you might be able to do something like:

              viewFinderSettings.setPixelFormat(QVideoFrame::Format_RGB24);
              

              You might also want to check with some other application. As I recall, on windows the QCamera stuff is a rather thin layer over DirectShow so you might want to play with that to get a clear idea of whats coming off the camera.
              If worse comes to worst you may want to use something like OpenCV which will give you more control over the capture buffers and how to format them.

              SolaVitaeS Offline
              SolaVitaeS Offline
              SolaVitae
              wrote on last edited by
              #17

              @mranger90

              The list returns (Format_RGB24, Format_YUV420P), its default set to the RGB24, and changing it to YUV420p does nothing.

              As for testing it elsewhere, it works flawlessly everywhere else. The default camera app on windows works, a webcam testing website works, skype works.

              1 Reply Last reply
              0
              • fcarneyF Offline
                fcarneyF Offline
                fcarney
                wrote on last edited by
                #18

                @SolaVitae,
                Just a shot in the dark. Have you tried explicitly setting the pixel format to QVideoFrame::Format_RGB24? Just in case some other app changed its mode?

                C++ is a perfectly valid school of magic.

                SolaVitaeS 1 Reply Last reply
                0
                • fcarneyF fcarney

                  @SolaVitae,
                  Just a shot in the dark. Have you tried explicitly setting the pixel format to QVideoFrame::Format_RGB24? Just in case some other app changed its mode?

                  SolaVitaeS Offline
                  SolaVitaeS Offline
                  SolaVitae
                  wrote on last edited by SolaVitae
                  #19

                  @fcarney
                  yes, it does not change anything

                  The issue does not occur on my laptop, or a friend's PC. So im guessing it has something to do with my pc. What it is I can't figure out, but I guess it's not that big of a deal if it's only on my PC. It will subconciously bother me to no ender, but oh well

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

                    Hi,

                    Since you are talking about a virtual camera, it might be generating BGR images. And since it's virtual you might be able to configure that.

                    In any case, you can use QImage::rgbSwapped to convert to the right order.

                    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
                    2
                    • V Offline
                      V Offline
                      VietTran
                      wrote on last edited by
                      #21

                      have you got solution for this problem?

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        Dan_Dew
                        wrote on last edited by Dan_Dew
                        #22

                        Same here. Maybe after Windows-Update (Win10).
                        Viewfinder and Image of QCamera in blue.
                        People look like smurfs.
                        Different webcams, same result.
                        QML-Camera is OK. Any other Cam-Apps in Windows (Skype,..) are OK.
                        I hope of a solution, most of my apps base on that.

                        Someone with more information? Thank You.

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

                          Hi,

                          From the description you are giving, there might be something like a switch from RGB to BGR.

                          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
                          • D Offline
                            D Offline
                            Dan_Dew
                            wrote on last edited by
                            #24

                            SGaist, thank you and yes, its a BGR/RGB problem. It seems to occur rare at this time.
                            When customers complains, I would improvise with a manual switch for swapping colors at the QImages.
                            Do you have an idea for doing that at the viewfinder?

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

                              I don't think there's an easy way to do that except by going lower level.

                              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