I am currently using a cross-platform application (Android, iOS) using QML, and I need to perform the function of scanning a QR code. QR code readings use ZXing, and there are no problems, the problem is with the camera. I cannot extract video frames from QCamera .
There is a QVideoProbe module that should do this for me. However, it does not work, not on Win32, not on OSX. It just doesn't work on a desktop platform. I do not have my code on this computer, but it is exactly the same as in this example, I found on the forum
QCamera *camera = new QCamera; camera->setCaptureMode(QCamera::CaptureVideo); QCameraViewfinder *viewfinder = new QCameraViewfinder(); camera->setViewfinder(viewfinder); qDebug() << " start set source"; QVideoProbe *videoProbe = new QVideoProbe(this); if (videoProbe->setSource((QMediaObject *)camera)) { qDebug() << " set source succeed";
The forum guy has the same problem with me. Line:
videoProbe->setSource((QMediaObject *)camera)
will return false .
Reply on the forum:
Using (passing) the Camera element as sourceObj, what will happen?
It will also work.
That was in theory. In practice, it depends on the platform. QVideoProbe not available for all of them (or only for a media player or camera).
It should be in the document, but here is an overview of QVideoProbe support:
- Android: camera only
- Blackberry: no support
- iOS: no support
- Linux: media player only
- Mac: no support
- Windows: media player only
If you do not support it, this does not necessarily mean that it is impossible to do it on this platform, it may mean that it is not currently implemented.
So, Android is only a platform that supports Camera, then I am looking for support for Win32, I am ready to add support for win32, that the work will be very difficult, and I will integrate it into Qt Trunk.
In addition, I will add media player support for Android. These are the two features that I am looking for.
It seems that it is not implemented, and if it works, it will only work on Android, and I have to test it on a real phone (the simulator does not work).
I think that extracting the frame from the camera is a very simple function on any platform and language. There must be a way. Is there any solution?