Qt小部件中的摄像头访问

Camera access in Qt widget

本文关键字:摄像头 访问 小部 Qt      更新时间:2023-10-16

我无法在我的Qt小部件应用程序中访问android相机。。我尝试了QCamera API,它在调试中返回错误,如下所示

D libCamera.so:../Camera/main.cpp:13(int main(int,char**((:hi W链接器:/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqgif.so:不支持的标志DT_flags_1=0x81 W链接器:/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqicns.so:不支持的标志DT_flags_1=0x81 W链接器:/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqico.so:不支持的标志DT_flags_1=0x81 W链接器:/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqjpeg.so:不支持的标志DT_flags_1=0x81 W链接器:/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqtga.so:不支持的标志DT_flags_1=0x81 W链接器:/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqtiff.so:不支持的标志DT_flags_1=0x81 W链接器:/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqwbmp.so:不支持的标志DT_flags_1=0x81 W链接器:/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqwebp.so:不支持的标志DT_flags_1=0x81 W libCamera.so:(null(:0((null((:视频表面与支持的任何格式都不兼容camera V BoostFrame:BoostFrame((:mPerf=com.qualcomm.qti.Performance@42a0529D摄像头:应用程序传递了NULLsurface D Camera:app传递了NULL surface W libCamera.so:(NULL(:0((null(:视频表面与任何格式都不兼容摄像头支持D摄像头:应用程序通过NULL曲面D摄像头:应用程序通过了NULL表面

"org.qtproject.example"去世了。

先生,当我在android设备中运行应用程序时,我的设备摄像头应该被访问/打开

这是我的相机.cpp代码--->

如果有任何更正,请告诉我?

包括"camera.h">

包括"ui_camera.h">

相机::相机(QWidget*父级(:QMainWindow(父窗口(,ui(新ui::相机({ui->setupUi(this(;

camera = new QCamera;
viewfinder = new QCameraViewfinder;
camera->setViewfinder(viewfinder);
viewfinder->show();
camera->start(); // to start the viewfinder
imageCapture = new QCameraImageCapture(camera);
camera->setCaptureMode(QCamera::CaptureStillImage);
camera->start(); // Viewfinder frames start flowing
camera->searchAndLock();
imageCapture->capture();
camera->unlock();

}