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, save capture to file issue
Forum Updated to NodeBB v4.3 + New Features

QCamera, save capture to file issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.9k 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.
  • K Offline
    K Offline
    killown
    wrote on last edited by killown
    #1

    I am trying to save a capture to any destination but doesn't save and gives no error
    could someone point me some way to save the image or I way to use CaptureToBuffer and load its content in a label?

    void camera::on_save_pushButton_clicked()
    {
    //works with QFileDialog
    /auto filename = QFileDialog::getSaveFileName(this, "Capturar", "/tmp",
    "Imagem (
    .jpg;.jpeg");
    if (filename.isNull()){
    return;
    }
    /
    mCameraImageCapture->setCaptureDestination(
    QCameraImageCapture::CaptureToFile);
    QImageEncoderSettings imageEncoderSettings;
    imageEncoderSettings.setCodec("image/jpeg");
    mCameraImageCapture->setEncodingSettings(imageEncoderSettings);
    mCamera->setCaptureMode(QCamera::CaptureStillImage);
    mCamera->start();
    mCamera->searchAndLock();

    // not working
    QString filename = QCoreApplication::applicationDirPath() + "/imagetest.jpg";
    mCameraImageCapture->capture(filename)

    mCamera->unlock();
    

    }

    jsulmJ 1 Reply Last reply
    0
    • K killown

      I am trying to save a capture to any destination but doesn't save and gives no error
      could someone point me some way to save the image or I way to use CaptureToBuffer and load its content in a label?

      void camera::on_save_pushButton_clicked()
      {
      //works with QFileDialog
      /auto filename = QFileDialog::getSaveFileName(this, "Capturar", "/tmp",
      "Imagem (
      .jpg;.jpeg");
      if (filename.isNull()){
      return;
      }
      /
      mCameraImageCapture->setCaptureDestination(
      QCameraImageCapture::CaptureToFile);
      QImageEncoderSettings imageEncoderSettings;
      imageEncoderSettings.setCodec("image/jpeg");
      mCameraImageCapture->setEncodingSettings(imageEncoderSettings);
      mCamera->setCaptureMode(QCamera::CaptureStillImage);
      mCamera->start();
      mCamera->searchAndLock();

      // not working
      QString filename = QCoreApplication::applicationDirPath() + "/imagetest.jpg";
      mCameraImageCapture->capture(filename)

      mCamera->unlock();
      

      }

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

      @killown You should connect a slot to http://doc.qt.io/qt-5/qcameraimagecapture.html#error and check whether this signal is emitted and if so what the error is (http://doc.qt.io/qt-5/qcameraimagecapture.html#errorString).

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

      K 1 Reply Last reply
      1
      • jsulmJ jsulm

        @killown You should connect a slot to http://doc.qt.io/qt-5/qcameraimagecapture.html#error and check whether this signal is emitted and if so what the error is (http://doc.qt.io/qt-5/qcameraimagecapture.html#errorString).

        K Offline
        K Offline
        killown
        wrote on last edited by
        #3

        @jsulm https://doc.qt.io/qt-5/qtmultimedia-multimediawidgets-camera-example.html I am using this example and it's working, thanks for reply!

        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