Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How can I fix bug camera in Qt5.13.1?

How can I fix bug camera in Qt5.13.1?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
18 Posts 3 Posters 1.7k 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.
  • jsulmJ jsulm

    @neda

    auto lockTypesCamera = m_camera->supportedLocks();
    
    for (auto &lockType : lockTypesCamera) {
         qDebug() << static_cast<int>(lockType);
    }
    
    N Offline
    N Offline
    neda
    wrote on last edited by neda
    #5

    @jsulm said in How can I fix bug camera in Qt5.13.1?:

    auto lockTypesCamera = m_camera->supportedLocks();

    for (auto &lockType : lockTypesCamera) {
    qDebug() << static_cast<int>(lockType);
    }

    New error:

    
    error: invalid range expression of type 'QFlags<QCamera::LockType>'; no viable 'begin' function available
    
    auto lockTypesCamera = m_camera->supportedLocks();
    
        for (auto &lockType : lockTypesCamera) {
             qDebug() << static_cast<int>(lockType);
        }
    

    I try the following code, but it has error too.

    auto lockTypesCamera = m_camera->supportedLocks();
    foreach (auto &lockType, lockTypesCamera) {
            qDebug() << static_cast<int>(lockType);
        }
    
     error: C2039: 'const_iterator': is not a member of 'QFlags<QCamera::LockType>'
    
    jsulmJ 1 Reply Last reply
    0
    • N neda

      @jsulm said in How can I fix bug camera in Qt5.13.1?:

      auto lockTypesCamera = m_camera->supportedLocks();

      for (auto &lockType : lockTypesCamera) {
      qDebug() << static_cast<int>(lockType);
      }

      New error:

      
      error: invalid range expression of type 'QFlags<QCamera::LockType>'; no viable 'begin' function available
      
      auto lockTypesCamera = m_camera->supportedLocks();
      
          for (auto &lockType : lockTypesCamera) {
               qDebug() << static_cast<int>(lockType);
          }
      

      I try the following code, but it has error too.

      auto lockTypesCamera = m_camera->supportedLocks();
      foreach (auto &lockType, lockTypesCamera) {
              qDebug() << static_cast<int>(lockType);
          }
      
       error: C2039: 'const_iterator': is not a member of 'QFlags<QCamera::LockType>'
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @neda Well, it can't work like this as flags are bit-maps.

      auto lockTypesCamera = m_camera->supportedLocks();
      if (lockTypesCamera == QCamera::NoLock) {
          qDebug() << "NoLock";
      } else {
          if (lockTypesCamera | QCamera::LockExposure) {
              qDebug() << "LockExposure";
          }
          if lockTypesCamera | QCamera::LockWhiteBalance) {
              qDebug() << "LockWhiteBalance";
          }
          if (lockTypesCamera | QCamera::LockFocus) {
              qDebug() << "LockFocus";
          }
      }
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      N 1 Reply Last reply
      2
      • jsulmJ jsulm

        @neda Well, it can't work like this as flags are bit-maps.

        auto lockTypesCamera = m_camera->supportedLocks();
        if (lockTypesCamera == QCamera::NoLock) {
            qDebug() << "NoLock";
        } else {
            if (lockTypesCamera | QCamera::LockExposure) {
                qDebug() << "LockExposure";
            }
            if lockTypesCamera | QCamera::LockWhiteBalance) {
                qDebug() << "LockWhiteBalance";
            }
            if (lockTypesCamera | QCamera::LockFocus) {
                qDebug() << "LockFocus";
            }
        }
        
        N Offline
        N Offline
        neda
        wrote on last edited by neda
        #7

        @jsulm said in How can I fix bug camera in Qt5.13.1?:

        auto lockTypesCamera = m_camera->supportedLocks();
        if (lockTypesCamera == QCamera::NoLock) {
        qDebug() << "NoLock";
        } else {
        if (lockTypesCamera | QCamera::LockExposure) {
        qDebug() << "LockExposure";
        }
        if lockTypesCamera | QCamera::LockWhiteBalance) {
        qDebug() << "LockWhiteBalance";
        }
        if (lockTypesCamera | QCamera::LockFocus) {
        qDebug() << "LockFocus";
        }
        }

        Thanks
        It return "NoLock", but my camera has a windows application.
        That application can adjust exposure related settings.
        How can they change exposure related settings without change lock status?

        I want to change exposure related settings in my camera by the following codes, but all of them do not work:

        camera.searchAndLock()    
        camera.exposure.exposureCompensation = value
        camera.exposure.spotMeteringPoint.x=value
        camera.exposure.spotMeteringPoint.y=value
        camera.exposure.manualShutterSpeed = value
        camera.exposure.iso  = value
        camera.exposure.manualAperture=value
        
        jsulmJ 1 Reply Last reply
        0
        • N neda

          @jsulm said in How can I fix bug camera in Qt5.13.1?:

          auto lockTypesCamera = m_camera->supportedLocks();
          if (lockTypesCamera == QCamera::NoLock) {
          qDebug() << "NoLock";
          } else {
          if (lockTypesCamera | QCamera::LockExposure) {
          qDebug() << "LockExposure";
          }
          if lockTypesCamera | QCamera::LockWhiteBalance) {
          qDebug() << "LockWhiteBalance";
          }
          if (lockTypesCamera | QCamera::LockFocus) {
          qDebug() << "LockFocus";
          }
          }

          Thanks
          It return "NoLock", but my camera has a windows application.
          That application can adjust exposure related settings.
          How can they change exposure related settings without change lock status?

          I want to change exposure related settings in my camera by the following codes, but all of them do not work:

          camera.searchAndLock()    
          camera.exposure.exposureCompensation = value
          camera.exposure.spotMeteringPoint.x=value
          camera.exposure.spotMeteringPoint.y=value
          camera.exposure.manualShutterSpeed = value
          camera.exposure.iso  = value
          camera.exposure.manualAperture=value
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by jsulm
          #8

          @neda Can be that Qt does not support your camera properly.

          "How can they change exposure related settings without change lock status?" - I guess that app does not use Qt and communicates directly with the camera through a low level API.

          See https://doc.qt.io/qt-5/qtmultimedia-windows.html
          "Basic features such as displaying a viewfinder and capturing a still image are supported, however, majority of camera controls are not implemented."

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          N 2 Replies Last reply
          1
          • jsulmJ jsulm

            @neda Can be that Qt does not support your camera properly.

            "How can they change exposure related settings without change lock status?" - I guess that app does not use Qt and communicates directly with the camera through a low level API.

            See https://doc.qt.io/qt-5/qtmultimedia-windows.html
            "Basic features such as displaying a viewfinder and capturing a still image are supported, however, majority of camera controls are not implemented."

            N Offline
            N Offline
            neda
            wrote on last edited by
            #9

            @jsulm
            Thank you very much.

            1 Reply Last reply
            0
            • jsulmJ jsulm

              @neda Can be that Qt does not support your camera properly.

              "How can they change exposure related settings without change lock status?" - I guess that app does not use Qt and communicates directly with the camera through a low level API.

              See https://doc.qt.io/qt-5/qtmultimedia-windows.html
              "Basic features such as displaying a viewfinder and capturing a still image are supported, however, majority of camera controls are not implemented."

              N Offline
              N Offline
              neda
              wrote on last edited by neda
              #10

              @jsulm

              Thanks a lot
              And last question
              I should solve this problem, I have to write a program that works with this camera.
              Do I have to be disappointed with Qt?
              Do you suggest other language or editor?
              Which programming language or editor do you recommend?

              jsulmJ 1 Reply Last reply
              0
              • N neda

                @jsulm

                Thanks a lot
                And last question
                I should solve this problem, I have to write a program that works with this camera.
                Do I have to be disappointed with Qt?
                Do you suggest other language or editor?
                Which programming language or editor do you recommend?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by jsulm
                #11

                @neda said in How can I fix bug camera in Qt5.13.1?:

                Do I have to be disappointed with Qt?

                Well, it is like it is, Qt does not have support for everything.

                "Do you suggest other language or editor?" - this is not related to programming language and even less to an editor.
                You need to check what is available for your camera: does the manufacturer provide any SDK, client libraries, drivers, ...?
                If there is a SDK/client lib for C/C++ you can use it in your Qt app as any other C/C++ lib.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                N 2 Replies Last reply
                3
                • jsulmJ jsulm

                  @neda said in How can I fix bug camera in Qt5.13.1?:

                  Do I have to be disappointed with Qt?

                  Well, it is like it is, Qt does not have support for everything.

                  "Do you suggest other language or editor?" - this is not related to programming language and even less to an editor.
                  You need to check what is available for your camera: does the manufacturer provide any SDK, client libraries, drivers, ...?
                  If there is a SDK/client lib for C/C++ you can use it in your Qt app as any other C/C++ lib.

                  N Offline
                  N Offline
                  neda
                  wrote on last edited by
                  #12

                  @jsulm Thank you very much.

                  Pablo J. RoginaP 1 Reply Last reply
                  0
                  • N neda

                    @jsulm Thank you very much.

                    Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #13

                    @neda if you're done with the issue please don't forget to mark your post as solved. Thanks.

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    1
                    • jsulmJ jsulm

                      @neda said in How can I fix bug camera in Qt5.13.1?:

                      Do I have to be disappointed with Qt?

                      Well, it is like it is, Qt does not have support for everything.

                      "Do you suggest other language or editor?" - this is not related to programming language and even less to an editor.
                      You need to check what is available for your camera: does the manufacturer provide any SDK, client libraries, drivers, ...?
                      If there is a SDK/client lib for C/C++ you can use it in your Qt app as any other C/C++ lib.

                      N Offline
                      N Offline
                      neda
                      wrote on last edited by
                      #14

                      @jsulm

                      I found this project.
                      https://www.codeproject.com/Articles/125478/Versatile-WebCam-C-library?msg=4123457#xx4123457xx
                      I tested my camera with this project.
                      Every thing was ok and I can changed all settings of camera.
                      This project use WebCamLib – it is a C++ project with just two files (WebCamLib.h and WebCamLib.cpp) that queries a WebCam using DirectShow and returns results.
                      I think maybe I can use this library or even WebCamLib's source in my project rather start new project with c#, because I have to run my application by this camera.
                      Do you think is possible?
                      Would you please guide me that how can I use WebCamLib's source in my project ?

                      jsulmJ 1 Reply Last reply
                      0
                      • N neda

                        @jsulm

                        I found this project.
                        https://www.codeproject.com/Articles/125478/Versatile-WebCam-C-library?msg=4123457#xx4123457xx
                        I tested my camera with this project.
                        Every thing was ok and I can changed all settings of camera.
                        This project use WebCamLib – it is a C++ project with just two files (WebCamLib.h and WebCamLib.cpp) that queries a WebCam using DirectShow and returns results.
                        I think maybe I can use this library or even WebCamLib's source in my project rather start new project with c#, because I have to run my application by this camera.
                        Do you think is possible?
                        Would you please guide me that how can I use WebCamLib's source in my project ?

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #15

                        @neda said in How can I fix bug camera in Qt5.13.1?:

                        Do you think is possible?

                        It looks more like C# lib. Which exact C++ library do you mean?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        N 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @neda said in How can I fix bug camera in Qt5.13.1?:

                          Do you think is possible?

                          It looks more like C# lib. Which exact C++ library do you mean?

                          N Offline
                          N Offline
                          neda
                          wrote on last edited by
                          #16

                          @jsulm said in How can I fix bug camera in Qt5.13.1?:

                          It looks more like C# lib. Which exact C++ library do you mean?

                          WebCamLib - This is a C ++ project.
                          Is there a way on how to overwrite this project in Qt?

                          jsulmJ 1 Reply Last reply
                          0
                          • N neda

                            @jsulm said in How can I fix bug camera in Qt5.13.1?:

                            It looks more like C# lib. Which exact C++ library do you mean?

                            WebCamLib - This is a C ++ project.
                            Is there a way on how to overwrite this project in Qt?

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #17

                            @neda said in How can I fix bug camera in Qt5.13.1?:

                            Is there a way on how to overwrite this project in Qt?

                            If it is C++ you can use it as any other C++ code or library. Either add the source code to your project or build it as library and add library to your project.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • N neda

                              I wanna adjust exposure related settings in my camera. For example I try to use function "camera.searchAndLock()" but it doesn't work.

                              I tried to run camera example of Qt, but for the following code I have always "Unlocked" status.

                              switch (m_camera->lockStatus()) {
                                  case QCamera::Searching:
                                  case QCamera::Locked:
                                      m_camera->unlock();
                                      break;
                                  case QCamera::Unlocked:
                                      m_camera->searchAndLock();
                                  }
                              

                              I write the following QML codes, but the following code always return "unlocking focus".

                              if (camera.lockStatus == Camera.Unlocked) {
                                  camera.searchAndLock();
                                  console.log("searching focus...")                                
                                 }                                 
                                 else {                           
                                      camera.unlock();                        
                                      console.log("unlocking focus...")                            
                                   }
                              

                              I want to change exposure related settings in my camera by the following codes, but all of them do not work:

                              camera.searchAndLock()    
                              camera.exposure.exposureCompensation = value
                              camera.exposure.spotMeteringPoint.x=value
                              camera.exposure.spotMeteringPoint.y=value
                              camera.exposure.manualShutterSpeed = value
                              camera.exposure.iso  = value
                              camera.exposure.manualAperture=value
                              

                              I try to use "searchAndLock()" function for start focusing, exposure calculation, but after running this function status of my camera is still "Unlocked" rather "Searching".

                              What can I do with this bug? Which version of Qt I can install that doesn't has this bug?

                              I was success to fix bug of "SerialPort" by read this link:
                              https://stackoverflow.com/questions/58020663/how-to-make-qserialport-from-qt5-13-1-work

                              Is there a way for fix this bug by me?

                              Qt Version: Qt 5.13.1 (MSVC 2017, 32 bit),
                              Platform: Windows 10

                              Pablo J. RoginaP Offline
                              Pablo J. RoginaP Offline
                              Pablo J. Rogina
                              wrote on last edited by
                              #18

                              @neda said in How can I fix bug camera in Qt5.13.1?:

                              I wanna adjust exposure related settings in my camera. For example I try to use function "camera.searchAndLock()" but it doesn't work.

                              1. What hardware are you using (i.e. webcam attached to USB, Android phone camera, Raspberry Pi camera, etc.)?

                              2. Are you positive that the underlying hardware allows for all those settings (i.e. focus lock, exposure, manual shutter, etc.)?

                              3. Have you tried that same hardware with a different (non-Qt) application?

                              Upvote the answer(s) that helped you solve the issue
                              Use "Topic Tools" button to mark your post as Solved
                              Add screenshots via postimage.org
                              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                              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