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. QCameraImageCapture save image to file

QCameraImageCapture save image to file

Scheduled Pinned Locked Moved Unsolved General and Desktop
qcamerafile
10 Posts 4 Posters 5.6k 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.
  • lelelL Offline
    lelelL Offline
    lelel
    wrote on last edited by
    #1

    Hi
    I use QCameraImageCapture

    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ...
        cameraImageCapture = new QCameraImageCapture(camera);
        cameraImageCapture->setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
        connect(cameraImageCapture,SIGNAL(imageCaptured(int,QImage)),this,SLOT(imageCapture(int,QImage)));
    }
    
    void MainWindow::on_buttonTakePhoto_clicked()
    {
        camera->start();
        camera->searchAndLock();
        cameraImageCapture->capture();
        camera->unlock();
        camera->stop();
    }
    

    This code save image to file, even though it is set differently.

    Where is problem?

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

      Hi and welcome to devnet,

      What is your problem in the first place ? The code looks it's working.

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

      lelelL 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        What is your problem in the first place ? The code looks it's working.

        lelelL Offline
        lelelL Offline
        lelel
        wrote on last edited by
        #3

        @SGaist Image is save on disk, even though I set capture destination to buffer.

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

          What version of Qt ? On what OS ? How did you diagnose 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
          • lelelL Offline
            lelelL Offline
            lelel
            wrote on last edited by
            #5

            Qt version is 5.6.0. Os is Xubuntu 16.04 lts.

            RatzzR 1 Reply Last reply
            0
            • lelelL lelel

              Qt version is 5.6.0. Os is Xubuntu 16.04 lts.

              RatzzR Offline
              RatzzR Offline
              Ratzz
              wrote on last edited by
              #6

              @lelel
              May be because doc says this?

              The CaptureDestinations type is a typedef for QFlags<CaptureDestination>. It stores an OR combination of CaptureDestination values.

              --Alles ist gut.

              lelelL 1 Reply Last reply
              0
              • RatzzR Ratzz

                @lelel
                May be because doc says this?

                The CaptureDestinations type is a typedef for QFlags<CaptureDestination>. It stores an OR combination of CaptureDestination values.
                lelelL Offline
                lelelL Offline
                lelel
                wrote on last edited by
                #7

                @Ratzz
                I set only CaptureToBuffer

                cameraImageCapture->setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
                qDebug() << cameraImageCapture->captureDestination();
                

                Output is :

                QFlags(0x2)
                

                In doc 0x2 is a value of QCameraImageCapture::CaptureToBuffer.

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

                  Did you check that the capture destination was supported ? You can do that using isCaptureDestinationSupported.

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

                  lelelL 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Did you check that the capture destination was supported ? You can do that using isCaptureDestinationSupported.

                    lelelL Offline
                    lelelL Offline
                    lelel
                    wrote on last edited by
                    #9

                    @SGaist

                    qDebug() << cameraImageCapture->isCaptureDestinationSupported(QCameraImageCapture::CaptureToFile);
                    qDebug() << cameraImageCapture->isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer);
                    

                    Output:

                    true
                    true
                    
                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      feng_wi
                      wrote on last edited by feng_wi
                      #10

                      I had the same problem. Qt version is 5.12.3. Os is ubuntu 18.04 lts. Files can only be deleted periodically...

                      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