Added console mode to Find-Object (see "--help"):

> Find-Object.exe -console -objs "Path objects"

git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@278 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
matlabbe
2014-05-21 15:24:24 +00:00
parent 17873bacfa
commit b4d04c9460
5 changed files with 168 additions and 25 deletions
+9 -4
View File
@@ -135,10 +135,10 @@ bool Camera::start()
{
images_.append(path.toStdString() + UDirectory::separator() + *iter);
}
printf("Loaded %d filenames.\n", (int)images_.size());
printf("Camera: Reading %d images from directory \"%s\"...\n", (int)images_.size(), path.toStdString().c_str());
if(images_.isEmpty())
{
printf("WARNING: Directory \"%s\" is empty (no images matching the \"%s\" extensions). "
printf("[WARNING] Directory \"%s\" is empty (no images matching the \"%s\" extensions). "
"If you want to disable loading automatically this directory, "
"clear the Camera/mediaPath parameter. By default, webcam will be used instead of the directory.\n",
path.toStdString().c_str(),
@@ -151,7 +151,11 @@ bool Camera::start()
capture_.open(path.toStdString().c_str());
if(!capture_.isOpened())
{
printf("WARNING: Cannot open file \"%s\". If you want to disable loading automatically this video file, clear the Camera/mediaPath parameter. By default, webcam will be used instead of the file.\n", path.toStdString().c_str());
printf("[WARNING] Cannot open file \"%s\". If you want to disable loading automatically this video file, clear the Camera/mediaPath parameter. By default, webcam will be used instead of the file.\n", path.toStdString().c_str());
}
else
{
printf("Camera: Reading from video file \"%s\"...\n", path.toStdString().c_str());
}
}
if(!capture_.isOpened() && images_.empty())
@@ -163,11 +167,12 @@ bool Camera::start()
capture_.set(CV_CAP_PROP_FRAME_WIDTH, double(Settings::getCamera_2imageWidth()));
capture_.set(CV_CAP_PROP_FRAME_HEIGHT, double(Settings::getCamera_3imageHeight()));
}
printf("Camera: Reading from camera device %d...\n", Settings::getCamera_1deviceId());
}
}
if(!capture_.isOpened() && images_.empty())
{
printf("Failed to open a capture object!\n");
printf("[ERROR] Failed to open a capture object!\n");
return false;
}
+14 -1
View File
@@ -921,6 +921,7 @@ void MainWindow::updateData()
void MainWindow::startProcessing()
{
printf("Starting camera...\n");
bool updateStatusMessage = this->statusBar()->currentMessage().isEmpty();
if(updateStatusMessage)
{
@@ -966,7 +967,7 @@ void MainWindow::startProcessing()
}
else
{
printf("ERROR: Camera initialization failed! (with device %d)", Settings::getCamera_1deviceId());
printf("[ERROR] Camera initialization failed! (with device %d)\n", Settings::getCamera_1deviceId());
}
}
}
@@ -1656,6 +1657,18 @@ void MainWindow::update(const cv::Mat & image)
// Emit homographies
if(objectsDetected.size())
{
if(objectsDetected.size() > 1)
{
printf("(%s) %d objects detected!\n",
QTime::currentTime().toString("HH:mm:ss.zzz").toStdString().c_str(),
(int)objectsDetected.size());
}
else
{
printf("(%s) Object %d detected!\n",
QTime::currentTime().toString("HH:mm:ss.zzz").toStdString().c_str(),
(int)objectsDetected.begin().key());
}
emit objectsFound(objectsDetected);
}
ui_->label_objectsDetected->setNum(objectsDetected.size());