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
This commit is contained in:
matlabbe 2012-01-03 22:58:46 +00:00
parent 658cd6ebcb
commit 49d11d9212
2 changed files with 5 additions and 4 deletions

View File

@ -52,9 +52,10 @@ void Camera::takeImage()
Settings::getCamera_imageHeight().toInt() != img->height) Settings::getCamera_imageHeight().toInt() != img->height)
{ {
// declare a destination IplImage object with correct size, depth and channels // declare a destination IplImage object with correct size, depth and channels
cv::Mat imgMat(cvSize(Settings::getCamera_imageWidth().toInt(), Settings::getCamera_imageHeight().toInt()), cv::Mat headerImg = img;
img->depth, cv::Mat imgMat(Settings::getCamera_imageHeight().toInt(),
img->nChannels ); Settings::getCamera_imageWidth().toInt(),
headerImg.type());
//use cvResize to resize source to a destination image (linear interpolation) //use cvResize to resize source to a destination image (linear interpolation)
IplImage resampledImg = imgMat; IplImage resampledImg = imgMat;

View File

@ -78,7 +78,7 @@ MainWindow::MainWindow(Camera * camera, QWidget * parent) :
connect(ui_->actionLoad_objects, SIGNAL(triggered()), this, SLOT(loadObjects())); connect(ui_->actionLoad_objects, SIGNAL(triggered()), this, SLOT(loadObjects()));
connect(ui_->actionAbout, SIGNAL(triggered()), aboutDialog_ , SLOT(exec())); connect(ui_->actionAbout, SIGNAL(triggered()), aboutDialog_ , SLOT(exec()));
QTimer::singleShot(1000, this, SLOT(startProcessing())); QTimer::singleShot(10, this, SLOT(startProcessing()));
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()