Question about QCameraImageCapture
-
When I cameraImageCapture1->capture(); about two thousand times.
Program crashes every time.
I don't know how to solve.
Any help would be appreciated!
Sorry for my english.Information:
Qt 5.3.1
Ubuntu 12.04.4
Logitech C170 webcam
RAM:1G
HDD:1T@Dialog::Dialog(QWidget *parent) : QDialog(parent),ui(new Ui::Dialog)
{
ui->setupUi(this);timer1 = new QTimer(this); connect(timer1, SIGNAL(timeout()), this, SLOT(Ontimer1timeout())); timer1->start(10000); camera1 = new QCamera; cameraImageCapture1 = new QCameraImageCapture(camera1); QImageEncoderSettings imageEncoderSettings1; imageEncoderSettings1.setResolution(320,240); cameraImageCapture1->setEncodingSettings(imageEncoderSettings1); connect(cameraImageCapture1, SIGNAL(imageCaptured(int,QImage)), this, SLOT(OncameraImageCapture1imageCaptured(int,QImage)));
}
void Dialog::Ontimer1timeout()
{
if((CameraSw==1)&&(cameraImageCapture1->isReadyForCapture())) cameraImageCapture1->capture();
}void Dialog::OncameraImageCapture1imageCaptured(int,QImage image1)
{
ui->label->setPixmap(QPixmap::fromImage(image1));
}void Dialog::on_toolButton_clicked()
{
camera1->start();
CameraSw=1;
}void Dialog::on_toolButton_2_clicked()
{
camera1->stop();
CameraSw=0;
}
@ -
Hi,
What does a run using the debugger tells you ?
-
sorry.
Not program crashes but operating system crashes.
so without any error message.
The same problem in Raspberry Pi.
抱歉。
不是应用程式当机而是作业系统当机。
所以并没有产生任何错误讯息。
在树莓派中执行也有相同的错误。 -
Just to be sure I understand you correctly, you get your entire OS down by taking pictures ?
-
Yes,
After cameraImageCapture1->capture(); two thousand times. -
Did you check with a memory analyzer what as going on ?
-
I try analyzer.
like this:!http://sigmaccc.myweb.hinet.net/temp/20140901173.jpg(msg1)!
!http://sigmaccc.myweb.hinet.net/temp/20140901170.jpg(msg2)!I still don’t know how to solve.
Any help would be appreciated!
thanks a lot. -
Check with the top command the memory consumption of your application
-
I try top command.
like this:
!http://sigmaccc.myweb.hinet.net/temp/20140904175.jpg(msg1)!
!http://sigmaccc.myweb.hinet.net/temp/20140904176.jpg(msg2)!Seems to be a memory problem.
But,I don’t know why. -
I try
(1)void OncameraImageCapture1imageCaptured(int, const QImage &image1)
(2)echo 3 > /proc/sys/vm/drop_cachessync
(3)The other webcam(Logitech C270 Webcam)
but the problem persists.
-
Since Qt 5.4 Alpha has been release, can you try with to see if you still experience this ?
On a side note, 1Go of RAM ?
-
Yes,1 GB RAM.
I try Qt 5.4 Beta.
but the problem persists./opt/Qt5.4.0/Examples/Qt-5.4/multimediawidgets/camera
has the same problem too. -
Then you should take a look at the "bug report system":http://bugreports.qt-project.org to see if it's something known
-
I find this.
"QTBUG-41606...":https://bugreports.qt-project.org/browse/QTBUG-41606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
SGaist,thank you very much.