Change Viewfinder Resolution in qt C++
-
wrote on 13 Oct 2016, 06:49 last edited by
Hey Guys!!!! Once again in trouble. I am trying to change viewfinder resolution at run time but unfortunately, application is closing..
Let me explain you in detail:-- Initially i am setting my viewfinder resolution to the last supported viewfinder resolutions (say 1280 x 720) and then with the help of combo box i am selecting another resolution (say 640 x 480)
- After selecting another resolution, my program is finishing unexpectedly.
Anybody with the solution please.. Regrets for silly mistakes.
Here is the sample snippet....mCameraViewFinder = new QCameraViewfinder; mCameraImageCapture = new QCameraImageCapture(mCamera,this); mCamera->start(); QList<QSize> res = mCamera->supportedViewfinderResolutions(); QSize selectedRes; if(!res.isEmpty()) { selectedRes = res.takeLast(); } else { qDebug()<<"Empty Resolution!!!"; } viewfindersettings.setResolution(selectedRes); //Here current resolution is 1280*720 mCamera->setViewfinderSettings(viewfindersettings); //After selecting resolution from combo box viewfindersettings.setResolution(n,n1); //Here n and n1 are 640 and 480 respectively mCamera->setViewfinderSettings(viewfindersettings); mCamera->setViewfinder(ui->viewfinder); mCamera->start();
Need some help...
-
Hi,
What does a run through the debugger tell you ?
-
wrote on 14 Oct 2016, 06:38 last edited by
It is pointing to this error:-
mCamera->setViewfinderSettings(viewfindersettings);
Giving me Segmentation fault. And the value in (this) is 0x0 of type camera*
-
Do you mean that mCamera is a null pointer ?
-
wrote on 14 Oct 2016, 07:59 last edited by
No. I have initialized.
-
Can you post an image of the stack trace ?
See the guide here for posting picture as the upload is currently broken.
-
wrote on 15 Oct 2016, 05:50 last edited byThis post is deleted!
-
wrote on 15 Oct 2016, 05:56 last edited by p3c0
-
@Praveen-k Use some other site where login is not required.
https://postimage.org
http://tinypic.com -
wrote on 15 Oct 2016, 06:05 last edited by Praveen k
I tried as @SGaist guided for posting pictures on forum. But unfortunately itz not posting. So here you can get it
https://postimg.org/image/x3po0e1lf -
The
camera
object itself seems to be null. Are you sure it's initialized correctly ? -
wrote on 17 Oct 2016, 05:35 last edited by
Ok. if i have not initialized it, can you help me on how to initialize it?
I have done the initialization as below:mCamera = new QCamera(this); mCameraViewFinder = new QCameraViewfinder(this); mCameraImageCapture = new QCameraImageCapture(mCamera,this); mCamera->start();
-
It's not your
mCamera
object that is null, it's yourcamera
object. -
wrote on 17 Oct 2016, 07:13 last edited by
How can i initialize it? Plz help me
-
It's your own custom class, how can I know where you use it or how you use it ?
-
wrote on 17 Oct 2016, 07:26 last edited by Praveen k
Sorry.. I got it. Thanks for the solution man. Silly mistake from my side..
But after initializing new camera is starting. Wat if, i want the previous one -
Then don't create a new QCamera each time you change the resolution.
1/17