A camera problem.
-
@jenya7 said in A camera problem.:
never get into ReadyForCaptureChanged
Sure? How did you verify that?
@jsulm said in A camera problem.:
@jenya7 said in A camera problem.:
never get into ReadyForCaptureChanged
Sure? How did you verify that?
I set a break point inside. I see it goes into takeImage but never gets to ReadyForCaptureChanged
Now I don't get any errors but it prints
Starting camera without viewfinder available
Is it OK? -
@jsulm said in A camera problem.:
@jenya7 said in A camera problem.:
never get into ReadyForCaptureChanged
Sure? How did you verify that?
I set a break point inside. I see it goes into takeImage but never gets to ReadyForCaptureChanged
Now I don't get any errors but it prints
Starting camera without viewfinder available
Is it OK? -
@jsulm said in A camera problem.:
@jenya7 said in A camera problem.:
never get into ReadyForCaptureChanged
Sure? How did you verify that?
I set a break point inside. I see it goes into takeImage but never gets to ReadyForCaptureChanged
Now I don't get any errors but it prints
Starting camera without viewfinder available
Is it OK? -
@jenya7
maybe its a typical object lifetime problem.where does your
Camera
instance exist/live ? -
@J-Hilk said in A camera problem.:
@jenya7
maybe its a typical object lifetime problem.where does your
Camera
instance exist/live ?It's a global object. I call it's methods from a command line parser object.
-
@jenya7
Just to make sure, what happens in your code after you call yourtakeImage()
? Do you allow the main event loop to run, or do you have other code which does not?@JonB said in A camera problem.:
@jenya7
Just to make sure, what happens in your code after you call yourtakeImage()
? Do you allow the main event loop to run, or do you have other code which does not?well..I guess it's running, cause my command lines parser reacts and process my commands.
-
@J-Hilk said in A camera problem.:
@jenya7 soooo, inside main() ?
actually for debug purposes I instantiated it in other module - command line parser, but it's static and never goes out of scope.
-
static
thats actually forbidden, no QObject based object must be created before the QCoreApplication instance. Static objects will be created before the QCoreApplication instance.
@J-Hilk said in A camera problem.:
static
thats actually forbidden, no QObject based object must be created before the QCoreApplication instance. Static objects will be created before the QCoreApplication instance.
I mean it it's created without static attribute, but i's not locally allocated.
-
@J-Hilk said in A camera problem.:
static
thats actually forbidden, no QObject based object must be created before the QCoreApplication instance. Static objects will be created before the QCoreApplication instance.
I mean it it's created without static attribute, but i's not locally allocated.
-
If I only could drill down to the cause of
"Image Capture Error: Camera not ready"
What makes it not ready for m_imageCapture...@jenya7
I know nothing about cameras and captures, so no idea about causes. I will say your definition ofvoid Camera::ReadyForCaptureChanged(bool ready)
is wrong, since it does not examine theready
parameter value. But if you say it's never hit that is moot. -
@jenya7
I know nothing about cameras and captures, so no idea about causes. I will say your definition ofvoid Camera::ReadyForCaptureChanged(bool ready)
is wrong, since it does not examine theready
parameter value. But if you say it's never hit that is moot.@JonB said in A camera problem.:
@jenya7
I know nothing about cameras and captures, so no idea about causes. I will say your definition ofvoid Camera::ReadyForCaptureChanged(bool ready)
is wrong, since it does not examine theready
parameter value. But if you say it's never hit that is moot.Yes. But it never hits if (ready) line.
void Camera::ReadyForCaptureChanged(bool ready) { if (ready) { m_isCapturingImage = true; m_imageCapture->capture(); m_camera->unlock(); } }
-
@JonB said in A camera problem.:
@jenya7
I know nothing about cameras and captures, so no idea about causes. I will say your definition ofvoid Camera::ReadyForCaptureChanged(bool ready)
is wrong, since it does not examine theready
parameter value. But if you say it's never hit that is moot.Yes. But it never hits if (ready) line.
void Camera::ReadyForCaptureChanged(bool ready) { if (ready) { m_isCapturingImage = true; m_imageCapture->capture(); m_camera->unlock(); } }
-
@JonB said in A camera problem.:
@jenya7
I know nothing about cameras and captures, so no idea about causes. I will say your definition ofvoid Camera::ReadyForCaptureChanged(bool ready)
is wrong, since it does not examine theready
parameter value. But if you say it's never hit that is moot.Yes. But it never hits if (ready) line.
void Camera::ReadyForCaptureChanged(bool ready) { if (ready) { m_isCapturingImage = true; m_imageCapture->capture(); m_camera->unlock(); } }
@jenya7
Yes, at least the code is right, but won't help if that never gets hit.
Bearing in mind I know nothing about cameras, why did you comment out them_camera->isCaptureModeSupported(...)
lines, what do these actually return? If they return false presumably that would explain why you never getQCameraImageCapture::readyForCaptureChanged
?Oh I see @J-Hilk has chimed in with some knowledge of this camera stuff....
-
@jenya7
do you call show() on your viewfinder instance ? It will probably never change its state, if the viewfinder is not "visible"@J-Hilk said in A camera problem.:
@jenya7
do you call show() on your viewfinder instance ? It will probably never change its state, if the viewfinder is not "visible"It can be an issue.
Although I create an object in mainwindow.cppQCameraViewfinder *v_finder; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { v_finder= new QCameraViewfinder(this); ui->setupUi(this); ui->textEditTerminalTx->installEventFilter(this); }
It's not physically allocated. The app wasn't suppose to have such widget.
So on v_finder->show() I get an exception.
Is it possible to emulate the viewfinder ? -
@J-Hilk said in A camera problem.:
@jenya7
do you call show() on your viewfinder instance ? It will probably never change its state, if the viewfinder is not "visible"It can be an issue.
Although I create an object in mainwindow.cppQCameraViewfinder *v_finder; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { v_finder= new QCameraViewfinder(this); ui->setupUi(this); ui->textEditTerminalTx->installEventFilter(this); }
It's not physically allocated. The app wasn't suppose to have such widget.
So on v_finder->show() I get an exception.
Is it possible to emulate the viewfinder ? -
@J-Hilk said in A camera problem.:
@jenya7
do you call show() on your viewfinder instance ? It will probably never change its state, if the viewfinder is not "visible"It can be an issue.
Although I create an object in mainwindow.cppQCameraViewfinder *v_finder; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { v_finder= new QCameraViewfinder(this); ui->setupUi(this); ui->textEditTerminalTx->installEventFilter(this); }
It's not physically allocated. The app wasn't suppose to have such widget.
So on v_finder->show() I get an exception.
Is it possible to emulate the viewfinder ?@jenya7 said in A camera problem.:
It's not physically allocated
It is, see the first line in the constructor
-
@J-Hilk said in A camera problem.:
@jenya7
do you call show() on your viewfinder instance ? It will probably never change its state, if the viewfinder is not "visible"It can be an issue.
Although I create an object in mainwindow.cppQCameraViewfinder *v_finder; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { v_finder= new QCameraViewfinder(this); ui->setupUi(this); ui->textEditTerminalTx->installEventFilter(this); }
It's not physically allocated. The app wasn't suppose to have such widget.
So on v_finder->show() I get an exception.
Is it possible to emulate the viewfinder ?@jenya7
What is "not physically allocated", and why do you get an exception on what?There is a basic example at https://doc.qt.io/qt-5/qcameraviewfinder.html
camera = new QCamera; viewfinder = new QCameraViewfinder(); viewfinder->show(); camera->setViewfinder(viewfinder); imageCapture = new QCameraImageCapture(camera); camera->setCaptureMode(QCamera::CaptureStillImage); camera->start();
Did you test whether just this code might work for you?
You also ought check those
m_camera->isCaptureModeSupported(...)
I mentioned, else you are whistling in the wind.... -
@jenya7
What is "not physically allocated", and why do you get an exception on what?There is a basic example at https://doc.qt.io/qt-5/qcameraviewfinder.html
camera = new QCamera; viewfinder = new QCameraViewfinder(); viewfinder->show(); camera->setViewfinder(viewfinder); imageCapture = new QCameraImageCapture(camera); camera->setCaptureMode(QCamera::CaptureStillImage); camera->start();
Did you test whether just this code might work for you?
You also ought check those
m_camera->isCaptureModeSupported(...)
I mentioned, else you are whistling in the wind.... -
@jenya7 said in A camera problem.:
It's not physically allocated
It is, see the first line in the constructor
@jsulm said in A camera problem.:
@jenya7 said in A camera problem.:
It's not physically allocated
It is, see the first line in the constructor
It doesn't work