From 49d11d92123e12559bb79afc49e6563fd7e4af38 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Tue, 3 Jan 2012 22:58:46 +0000 Subject: [PATCH] Fixed a crash when the image width/height parameters of the camera are modified while the camera is running. git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@58 620bd6b2-0a58-f614-fd9a-1bd335dccda9 --- src/Camera.cpp | 7 ++++--- src/MainWindow.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Camera.cpp b/src/Camera.cpp index 24b62f92..1f9f0faf 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -52,9 +52,10 @@ void Camera::takeImage() Settings::getCamera_imageHeight().toInt() != img->height) { // declare a destination IplImage object with correct size, depth and channels - cv::Mat imgMat(cvSize(Settings::getCamera_imageWidth().toInt(), Settings::getCamera_imageHeight().toInt()), - img->depth, - img->nChannels ); + cv::Mat headerImg = img; + cv::Mat imgMat(Settings::getCamera_imageHeight().toInt(), + Settings::getCamera_imageWidth().toInt(), + headerImg.type()); //use cvResize to resize source to a destination image (linear interpolation) IplImage resampledImg = imgMat; diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index c67b6560..fc163ac6 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -78,7 +78,7 @@ MainWindow::MainWindow(Camera * camera, QWidget * parent) : connect(ui_->actionLoad_objects, SIGNAL(triggered()), this, SLOT(loadObjects())); connect(ui_->actionAbout, SIGNAL(triggered()), aboutDialog_ , SLOT(exec())); - QTimer::singleShot(1000, this, SLOT(startProcessing())); + QTimer::singleShot(10, this, SLOT(startProcessing())); } MainWindow::~MainWindow()