How can I get a video stream from a usb camera?
-
if (QCameraInfo::availableCameras().count() > 0) return true; else return false;
I've tried this code.
But the camera search failed.The camera is successfully connected to the computer and works well with other programs.
How do I get a video stream from qt?:: develop environment
OS : Windows 7 -
Hi and welcome to devnet forum
The QCamera detailed documentation says right as first sentence:
The QCamera class provides interface for system camera devices.Therefore, I would expect that the class can handle only cameras integrated directly in the system (possibly laptop built-in cameras and smartphone cameras).
Most likely, you need to find the description of the camera itself and handle the whole interface through usb/serial port.
-
Thanks for the answer!
I understood your words.
I thought there was a class that qt supports. ^^
If I use opencv to import the camera stream, will not it cause problems with cross-platform deployment?
I'm worried about conflicts with different libraries in Android, Windows, and iOS.
windows = opencv
android = opencv (error!)I do not understand how qt supports cross-platform.
-
@Laco You are on the right track QCamera does indeed support usb camera. I have tested it on linux with gstreamer backend and it works.
And from Qt 5.7 Multimedia Backends one can see that on windows DirectShow is responsible for QCamera backend. So you are probably missing DirectShow dependencies you should look into it. And are you sure you don't get any errors when running your application?
There also could be driver issue for your usb camera, have you tried other web cams?
Also you could try running your application in administration mode.