Added Camera::finished() signal

git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@368 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
matlabbe
2014-08-03 22:40:37 +00:00
parent 970b9e95aa
commit cd8368f0de
4 changed files with 9 additions and 6 deletions
+2 -1
View File
@@ -128,7 +128,8 @@ void Camera::takeImage()
else
{
// In case of a directory of images or a video
Q_EMIT imageReceived(cv::Mat()); // empty image to notify that there are no more images
this->stop();
Q_EMIT finished(); // notify that there are no more images
}
}
else
+5 -5
View File
@@ -221,6 +221,7 @@ MainWindow::MainWindow(FindObject * findObject, Camera * camera, QWidget * paren
MainWindow::~MainWindow()
{
disconnect(camera_, SIGNAL(imageReceived(const cv::Mat &)), this, SLOT(update(const cv::Mat &)));
disconnect(camera_, SIGNAL(finished()), this, SLOT(stopProcessing()));
camera_->stop();
qDeleteAll(objWidgets_);
objWidgets_.clear();
@@ -496,6 +497,7 @@ void MainWindow::showHideControls()
void MainWindow::addObjectFromScene()
{
disconnect(camera_, SIGNAL(imageReceived(const cv::Mat &)), this, SLOT(update(const cv::Mat &)));
disconnect(camera_, SIGNAL(finished()), this, SLOT(stopProcessing()));
AddObjectDialog * dialog;
bool resumeCamera = camera_->isRunning();
if(camera_->isRunning() || sceneImage_.empty())
@@ -529,6 +531,7 @@ void MainWindow::addObjectFromScene()
else
{
connect(camera_, SIGNAL(imageReceived(const cv::Mat &)), this, SLOT(update(const cv::Mat &)), Qt::UniqueConnection);
connect(camera_, SIGNAL(finished()), this, SLOT(stopProcessing()), Qt::UniqueConnection);
if(!sceneImage_.empty())
{
this->update(sceneImage_);
@@ -779,6 +782,7 @@ void MainWindow::startProcessing()
if(camera_->start())
{
connect(camera_, SIGNAL(imageReceived(const cv::Mat &)), this, SLOT(update(const cv::Mat &)), Qt::UniqueConnection);
connect(camera_, SIGNAL(finished()), this, SLOT(stopProcessing()), Qt::UniqueConnection);
ui_->actionStop_camera->setEnabled(true);
ui_->actionPause_camera->setEnabled(true);
ui_->actionStart_camera->setEnabled(false);
@@ -835,6 +839,7 @@ void MainWindow::stopProcessing()
if(camera_)
{
disconnect(camera_, SIGNAL(imageReceived(const cv::Mat &)), this, SLOT(update(const cv::Mat &)));
disconnect(camera_, SIGNAL(finished()), this, SLOT(stopProcessing()));
camera_->stop();
}
ui_->actionStop_camera->setEnabled(false);
@@ -901,11 +906,6 @@ void MainWindow::update(const cv::Mat & image)
if(image.empty())
{
UWARN("The image received is empty...");
if(!Settings::getCamera_6useTcpCamera())
{
UINFO("Stopping the camera...");
this->stopProcessing();
}
return;
}
sceneImage_ = image.clone();