Unsolved QCameraImageCapture save image to file
-
Hi
I use QCameraImageCaptureMainWindow::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?
-
Hi and welcome to devnet,
What is your problem in the first place ? The code looks it's working.
-
@SGaist Image is save on disk, even though I set capture destination to buffer.
-
What version of Qt ? On what OS ? How did you diagnose that ?
-
Qt version is 5.6.0. Os is Xubuntu 16.04 lts.
-
-
@Ratzz
I set only CaptureToBuffercameraImageCapture->setCaptureDestination(QCameraImageCapture::CaptureToBuffer); qDebug() << cameraImageCapture->captureDestination();
Output is :
QFlags(0x2)
In doc 0x2 is a value of QCameraImageCapture::CaptureToBuffer.
-
Did you check that the capture destination was supported ? You can do that using isCaptureDestinationSupported.
-
qDebug() << cameraImageCapture->isCaptureDestinationSupported(QCameraImageCapture::CaptureToFile); qDebug() << cameraImageCapture->isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer);
Output:
true true