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. Need help with QCameraImageCature

Need help with QCameraImageCature

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

    Hallo

    I try to capture some images with QCameraImageCapture.
    It works, but how can i change QCameraImageCapture readytocapture?

    QObject::connect(m_cap, &QCameraImageCapture::imageCaptured, [=] (int id, QImage img) {
            Q_UNUSED(id);
            processImage(addPixmap(QPixmap::fromImage(img)));
            m_camera->unlock();
        });
    
        QObject::connect(m_cap, &QCameraImageCapture::readyForCaptureChanged, [=] (bool state) {
            qInfo() << "Image state: " << state;
            if(state == true) {
                m_camera->searchAndLock();
                m_cap->capture();
                m_camera->unlock();
            }
        });
    

    This works only for one time after start. How can i change this to run into a loop?

    lg Chris

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

      Hi,

      You can use a QTimer to call your capturing method at regular interval.

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

      C 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        You can use a QTimer to call your capturing method at regular interval.

        C Offline
        C Offline
        ckvsoft
        wrote on last edited by
        #3

        @SGaist
        I try it that way. :) But is it right that the readyForCaptureChanged signal fired once?
        When do readyForCaptureChange will fired? Only after camera start and capture become ready?

        Now i capture after every imageCaptured and check if its ok. Is that also a right way?

            QObject::connect(m_cap, &QCameraImageCapture::imageCaptured, [=] (int id, QImage img) {
                Q_UNUSED(id);
                QString x = qzx->decodeImage(img);
                // m_scene->addPixmap(QPixmap::fromImage(img));
                if (x.isEmpty()) {
                    if (m_cap->isReadyForCapture()) {
                        m_camera->searchAndLock();
                        m_cap->capture();
                        m_camera->unlock();
                    }
                }
                else {
                    ui->textEdit->setText(x);
                    m_scene->addPixmap(QPixmap::fromImage(qzx->encodeData(x)));
                    emit finishedCapture();
                }
            });
        

        It works fine under Linux, but not under Windows. Do you know wich dlls i need?

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

          AFAIK, it's normal. It should represent the state of readiness to capture from the camera. Therefore, as long as "nothing changes", the state will not change.

          The backends are different between platforms. So some might react a bit differently.

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

          C 1 Reply Last reply
          0
          • SGaistS SGaist

            AFAIK, it's normal. It should represent the state of readiness to capture from the camera. Therefore, as long as "nothing changes", the state will not change.

            The backends are different between platforms. So some might react a bit differently.

            C Offline
            C Offline
            ckvsoft
            wrote on last edited by
            #5

            @SGaist
            Thanks.
            Nie i install QTCreator die Windows. I can see that the app crash at QCameraInfo::deviceList without any Message . So i remove the line.
            Now it start and the camera light goes on. But the viewfinder will be black.
            Is there a better way to use a camera with QT wich worked in Linux, Mac and Windows?

            LG chris

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

              What version of Qt are you using ?
              What camera is that ?

              We have to determine what is going on on your machine.

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

              C 1 Reply Last reply
              0
              • SGaistS SGaist

                What version of Qt are you using ?
                What camera is that ?

                We have to determine what is going on on your machine.

                C Offline
                C Offline
                ckvsoft
                wrote on last edited by
                #7

                @SGaist
                Currently Test
                with QT5.11 Linux worked
                With QT5.12 Windows 10 black viewfinder real Hardware and Box. Both the same black viewfinder.

                Camera USB 2.0 Generic one in My Linux Laptop MSI i7 here also run Windows 10 in the VBox
                One in my Windows 10 Laptop HP

                I dont know what Hardware the use.
                The oldest QT is 5.6 from ubuntu 16.04. Not testet now.

                LG chris

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

                  Does 5.11 work on Windows ?

                  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