Get Camera's Resolutions
-
Hi guys !
I have a camera conected and I want to get its available resolutions. I can already display stream, and play with camera parameters like contrast, gamma, saturation, exposition etc.
I constructed a QCamera object like this :
QCamera m_camera = new QCamera;
Then i tried to do like this :
if(m_camera!=NULL) m_camera->start(); QCameraImageCapture * imageCapture = new QCameraImageCapture(m_camera); QImageEncoderSettings imageSettings; imageSettings.setResolution(3584, 2752); imageCapture->setEncodingSettings(imageSettings); QList<QSize> resolutions = imageCapture->supportedResolutions(); std::cout << "Ready to use ? " << imageCapture->isAvailable() << std::endl; qDebug() << "Resolutions List : " << resolutions;
The first line returns
true
, but the second returns an empty list.I have an empty list, moreover, when I verify, the resolution stay fixed to 896*688...
Do someone have an idea for my problem please ?
Have a nice day, you, who read my post ! :)
EDIT : if I use
qDebug() << imageSettings.resolution()
, that returns Qlist<3584, 2752> which is what I entered, but not what is displayed. -
I think this one may come in handy:
https://forum.qt.io/topic/41412/how-to-get-camera-supported-resolutions-using-qt5/3
As far as i understnad you have to callload()
function to get acces to resolutions. -
Hi @michelson ! Thanks for your answer!
I saw this topic, but i though that my
start()
is similar toload()
. I'll try theload()
so. -
Im sorry but I think its not your fault that the resolutions are not showing up on screen. Ive seen some more discutions about it and I guess someone has already reported this as a bug
https://bugreports.qt.io/browse/QTBUG-32743
I guess your only option now is to either use camera API or try to apply resolution fixed by yourself (if possible).
-
Hi @michelson !
Yes, i finally found this bug report too, but i forgot to post it yesterday. The table which Yoann Lopes gave (in your link) explains what is possible or not to do : http://wiki.qt.io/Qt_5.5.0_Multimedia_Backends.
Thanks for your help again ! I'll use my camera API then.
Have a nice day !