I have two webcams, but QCameraInfo::availableCameras returns empty array

▼魔方 西西 提交于 2021-02-10 16:15:23

问题


According to the documentation, QCameraInfo::availableCameras should return list of available cameras. There's no catch to it according to the docs.

But still, I have two webcams and the array of available cameras is returned empty. What can I do? Is this even in the scope of programming, or does this mean Qt only supports limited subset of webcams?

The OS I'm using right now is Windows 7x64.


回答1:


I have this Problem too.Then I read about the example. I found that once you have declared QCamera object.it will return the right info. Like this :`

QCamera *cam = new QCamera;
qDebug()<<QCameraInfo::availableCameras().count();`

I have one camera,so it returns 1 at last;




回答2:


Try to copy the mediaservice plugin folder into your application dir (where the exe resides).

At least that solved this specific problem for me.




回答3:


You need to resolve your dependencies (like Thomas D. mentioned). (take a look at http://doc.qt.io/qt-5/windows-deployment.html )

From yourpathof\Qt\...subdir...\bin

execute

windeployqt.exe --debug YOURPATH\Debug

or

windeployqt.exe YOURPATH\Debug


来源:https://stackoverflow.com/questions/42567750/i-have-two-webcams-but-qcamerainfoavailablecameras-returns-empty-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!