Commit 4110cfe7e91de2b505013010b5f788ce88d93f38
Merge branch 'master' of https://github.com/biometrics/openbr into fromAlgorithm_updates
Showing
9 changed files
with
193 additions
and
16 deletions
openbr/gui/formcombowidget.h
openbr/gui/metadata.cpp
0 โ 100644
| 1 | +#include "metadata.h" | |
| 2 | + | |
| 3 | +using namespace br; | |
| 4 | + | |
| 5 | +Metadata::Metadata(QWidget *parent) : | |
| 6 | + QWidget(parent) | |
| 7 | +{ | |
| 8 | + name = new QLabel("Name: "); | |
| 9 | + gender = new QLabel("Gender: "); | |
| 10 | + age = new QLabel("Age: "); | |
| 11 | + race = new QLabel("Race: "); | |
| 12 | + height = new QLabel("Height: "); | |
| 13 | + weight = new QLabel("Weight: "); | |
| 14 | + | |
| 15 | + layout.addWidget(name); | |
| 16 | + layout.addWidget(gender); | |
| 17 | + layout.addWidget(age); | |
| 18 | + layout.addWidget(race); | |
| 19 | + layout.addWidget(height); | |
| 20 | + layout.addWidget(weight); | |
| 21 | + | |
| 22 | + setLayout(&layout); | |
| 23 | +} | |
| 24 | + | |
| 25 | +void Metadata::reset() | |
| 26 | +{ | |
| 27 | + name->setText("Name: "); | |
| 28 | + gender->setText("Gender: "); | |
| 29 | + age->setText("Age: "); | |
| 30 | + race->setText("Race: "); | |
| 31 | + height->setText("Height: "); | |
| 32 | + weight->setText("Weight: "); | |
| 33 | +} | |
| 34 | + | |
| 35 | +void Metadata::setMetadata(br::File file) | |
| 36 | +{ | |
| 37 | + if (file.isNull()) { | |
| 38 | + reset(); | |
| 39 | + } | |
| 40 | + else { | |
| 41 | + name->setText(file.get<QString>("LASTNAME", "N/A") + ", " + file.get<QString>("FIRSTNAME", "N/A")); | |
| 42 | + gender->setText("Gender: " + file.get<QString>("GENDER", "N/A")); | |
| 43 | + age->setText("Age: " + file.get<QString>("Age", "N/A")); | |
| 44 | + race->setText("Race: " + file.get<QString>("RACE", "N/A")); | |
| 45 | + height->setText("Height: " + file.get<QString>("HEIGHT", "N/A")); | |
| 46 | + weight->setText("Weight: " + file.get<QString>("WEIGHT", "N/A")); | |
| 47 | + } | |
| 48 | +} | ... | ... |
openbr/gui/metadata.h
0 โ 100755
| 1 | +#ifndef BR_METADATA_H | |
| 2 | +#define BR_METADATA_H | |
| 3 | + | |
| 4 | +#include <QToolBar> | |
| 5 | +#include <QHBoxLayout> | |
| 6 | +#include <QLabel> | |
| 7 | +#include <QGroupBox> | |
| 8 | + | |
| 9 | +#include <openbr/openbr_plugin.h> | |
| 10 | + | |
| 11 | +namespace br { | |
| 12 | + | |
| 13 | +class BR_EXPORT Metadata : public QWidget | |
| 14 | +{ | |
| 15 | + Q_OBJECT | |
| 16 | + | |
| 17 | + QVBoxLayout layout; | |
| 18 | + | |
| 19 | + QLabel *name; | |
| 20 | + QLabel *gender; | |
| 21 | + QLabel *race; | |
| 22 | + QLabel *age; | |
| 23 | + QLabel *weight; | |
| 24 | + QLabel *height; | |
| 25 | + | |
| 26 | +public: | |
| 27 | + explicit Metadata(QWidget *parent = 0); | |
| 28 | + | |
| 29 | +signals: | |
| 30 | + | |
| 31 | +public slots: | |
| 32 | + void reset(); | |
| 33 | + void setMetadata(br::File); | |
| 34 | + | |
| 35 | +}; | |
| 36 | + | |
| 37 | +} | |
| 38 | + | |
| 39 | +#endif // BR_METADATA_H | ... | ... |
openbr/gui/pageflipwidget.h
openbr/gui/rangewidget.h
openbr/gui/recognitionbar.h
| ... | ... | @@ -10,11 +10,11 @@ |
| 10 | 10 | #include <QToolButton> |
| 11 | 11 | #include <QCheckBox> |
| 12 | 12 | |
| 13 | -#include "formcombowidget.h" | |
| 14 | -#include "rangewidget.h" | |
| 15 | -#include "pageflipwidget.h" | |
| 16 | -#include "searchboxwidget.h" | |
| 17 | -#include "metadata.h" | |
| 13 | +#include <openbr/gui/formcombowidget.h> | |
| 14 | +#include <openbr/gui/rangewidget.h> | |
| 15 | +#include <openbr/gui/pageflipwidget.h> | |
| 16 | +#include <openbr/gui/searchboxwidget.h> | |
| 17 | +#include <openbr/gui/metadata.h> | |
| 18 | 18 | |
| 19 | 19 | #include <openbr/openbr_plugin.h> |
| 20 | 20 | |
| ... | ... | @@ -45,7 +45,6 @@ class BR_EXPORT RecognitionBar : public QToolBar |
| 45 | 45 | FormComboWidget *model; |
| 46 | 46 | |
| 47 | 47 | RangeWidget *rangeWidget; |
| 48 | - PageFlipWidget *pageFlipWidget; | |
| 49 | 48 | SearchBoxWidget *searchBox; |
| 50 | 49 | QPushButton *compareButton; |
| 51 | 50 | ... | ... |
openbr/gui/searchboxwidget.cpp
0 โ 100644
| 1 | +#include "searchboxwidget.h" | |
| 2 | + | |
| 3 | +using namespace br; | |
| 4 | + | |
| 5 | +SearchBoxWidget::SearchBoxWidget(QWidget *parent) : | |
| 6 | + QWidget(parent) | |
| 7 | +{ | |
| 8 | + model = new QStringListModel(this); | |
| 9 | + completer = new QCompleter(this); | |
| 10 | + completer->setCaseSensitivity(Qt::CaseInsensitive); | |
| 11 | + searchBar = new QLineEdit(this); | |
| 12 | + | |
| 13 | + layout = new QVBoxLayout(this); | |
| 14 | + layout->addWidget(searchBar); | |
| 15 | + | |
| 16 | + setLayout(layout); | |
| 17 | + | |
| 18 | + startIndex = 0; | |
| 19 | + | |
| 20 | + connect(searchBar, SIGNAL(returnPressed()), this, SLOT(setIndex())); | |
| 21 | +} | |
| 22 | + | |
| 23 | +void SearchBoxWidget::setFiles(br::FileList files) | |
| 24 | +{ | |
| 25 | + words.clear(); | |
| 26 | + | |
| 27 | + foreach (const br::File file, files) | |
| 28 | + words.push_back(file.get<QString>("LASTNAME","N/A") + ", " + file.get<QString>("FIRSTNAME", "N/A")); | |
| 29 | + | |
| 30 | + model->setStringList(words); | |
| 31 | + completer->setModel(model); | |
| 32 | + | |
| 33 | + searchBar->setCompleter(completer); | |
| 34 | +} | |
| 35 | + | |
| 36 | +void SearchBoxWidget::setIndex() | |
| 37 | +{ | |
| 38 | + if (searchBar->text().isEmpty()) return; | |
| 39 | + | |
| 40 | + // Get index of currently selected object, starting at the previous searches index | |
| 41 | + int index = words.indexOf(searchBar->text(), startIndex); | |
| 42 | + | |
| 43 | + // Start from beginning of list if nothing is found | |
| 44 | + if (index == -1) { | |
| 45 | + index = words.indexOf(searchBar->text(), 0); | |
| 46 | + startIndex = index+1; | |
| 47 | + } | |
| 48 | + else startIndex = index+1; | |
| 49 | + | |
| 50 | + if (index != -1) emit newIndex(index); | |
| 51 | +} | ... | ... |
openbr/gui/searchboxwidget.h
0 โ 100644
| 1 | +#ifndef BR_SEARCHBOXWIDGET_H | |
| 2 | +#define BR_SEARCHBOXWIDGET_H | |
| 3 | + | |
| 4 | +#include <QWidget> | |
| 5 | +#include <QLineEdit> | |
| 6 | +#include <QCompleter> | |
| 7 | +#include <QVBoxLayout> | |
| 8 | +#include <QStringListModel> | |
| 9 | + | |
| 10 | +#include <openbr/openbr_plugin.h> | |
| 11 | + | |
| 12 | +namespace br { | |
| 13 | + | |
| 14 | +class BR_EXPORT SearchBoxWidget : public QWidget | |
| 15 | +{ | |
| 16 | + Q_OBJECT | |
| 17 | + | |
| 18 | + QLineEdit *searchBar; | |
| 19 | + QCompleter *completer; | |
| 20 | + QStringListModel *model; | |
| 21 | + QVBoxLayout *layout; | |
| 22 | + | |
| 23 | + QStringList words; | |
| 24 | + int startIndex; | |
| 25 | + | |
| 26 | +public: | |
| 27 | + explicit SearchBoxWidget(QWidget *parent = 0); | |
| 28 | + | |
| 29 | +signals: | |
| 30 | + | |
| 31 | + void newIndex(int); | |
| 32 | + | |
| 33 | +public slots: | |
| 34 | + | |
| 35 | + void setFiles(br::FileList files); | |
| 36 | + void setIndex(); | |
| 37 | +}; | |
| 38 | + | |
| 39 | +} | |
| 40 | + | |
| 41 | +#endif // BR_SEARCHBOXWIDGET_H | ... | ... |
openbr/plugins/cascade.cpp
| ... | ... | @@ -376,20 +376,19 @@ class CascadeTransform : public MetaTransform |
| 376 | 376 | void project(const TemplateList &src, TemplateList &dst) const |
| 377 | 377 | { |
| 378 | 378 | CascadeClassifier *cascade = cascadeResource.acquire(); |
| 379 | - foreach (const Template &tmpl, src) { | |
| 380 | - const bool enrollAll = tmpl.file.getBool("enrollAll"); | |
| 379 | + foreach (const Template &t, src) { | |
| 380 | + const bool enrollAll = t.file.getBool("enrollAll"); | |
| 381 | 381 | |
| 382 | 382 | // Mirror the behavior of ExpandTransform in the special case |
| 383 | 383 | // of an empty template. |
| 384 | - if (tmpl.empty() && !enrollAll) { | |
| 385 | - dst.append(tmpl); | |
| 384 | + if (t.empty() && !enrollAll) { | |
| 385 | + dst.append(t); | |
| 386 | 386 | continue; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - Template t; | |
| 390 | - OpenCVUtils::cvtUChar(tmpl.m(), t.m()); | |
| 391 | 389 | for (int i=0; i<t.size(); i++) { |
| 392 | - const Mat &m = t[i]; | |
| 390 | + Mat m; | |
| 391 | + OpenCVUtils::cvtUChar(t[i], m); | |
| 393 | 392 | std::vector<Rect> rects; |
| 394 | 393 | std::vector<int> rejectLevels; |
| 395 | 394 | std::vector<double> levelWeights; | ... | ... |