單獨運行攝像頭取景器,界面能夠正常顯示,也不會報錯;單曲執行捕獲,不顯示取景器預覽,也沒問題。但是當我開啟取景器預覽,并且捕獲圖片時,出現了“CameraBin error: "Internal data flow error."”報錯,每當出現該報錯,取景器顯示例外,也無法再次捕獲圖片。
if(camera == NULL){
camera=new QCamera(this);
connect(camera, SIGNAL(statusChanged(QCamera::Status)), this, SLOT(slotStateChanged(QCamera::Status)));
connect(camera, SIGNAL(error(QCamera::Error)), this, SLOT(slotCameraError(QCamera::Error)));
}
if(viewfinder == NULL){
viewfinder=new QCameraViewfinder(this);
ui->widget->layout()->addWidget(viewfinder);
camera->setViewfinder(viewfinder);
}
if(imageCapture == NULL){
imageCapture = new QCameraImageCapture(camera);
connect(imageCapture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(displayImage(int,QImage)));
connect(imageCapture, SIGNAL(error(int,QCameraImageCapture::Error,QString)), this, SLOT(slotError(int,QCameraImageCapture::Error,QString)));
}
imageCapture->setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
imageCapture->setBufferFormat(QVideoFrame::PixelFormat::Format_Jpeg);
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/106861.html
標籤:Qt
下一篇:Android 時間的轉化
