Commit 9756e99f471fcb434e4ebcb61b7f4d3254ccca1e
1 parent
ebf40c5c
implemented FDDB file format
Showing
1 changed file
with
39 additions
and
0 deletions
openbr/plugins/gallery.cpp
| @@ -881,6 +881,45 @@ class statGallery : public Gallery | @@ -881,6 +881,45 @@ class statGallery : public Gallery | ||
| 881 | 881 | ||
| 882 | BR_REGISTER(Gallery, statGallery) | 882 | BR_REGISTER(Gallery, statGallery) |
| 883 | 883 | ||
| 884 | +/*! | ||
| 885 | + * \ingroup galleries | ||
| 886 | + * \brief Implements the FDDB detection format. | ||
| 887 | + * \author Josh Klontz \cite jklontz | ||
| 888 | + * | ||
| 889 | + * http://vis-www.cs.umass.edu/fddb/README.txt | ||
| 890 | + */ | ||
| 891 | +class FDDBGallery : public Gallery | ||
| 892 | +{ | ||
| 893 | + Q_OBJECT | ||
| 894 | + | ||
| 895 | + TemplateList readBlock(bool *done) | ||
| 896 | + { | ||
| 897 | + *done = true; | ||
| 898 | + QStringList lines = QtUtils::readLines(file); | ||
| 899 | + TemplateList templates; | ||
| 900 | + while (!lines.empty()) { | ||
| 901 | + const QString fileName = lines.takeFirst(); | ||
| 902 | + int numDetects = lines.takeFirst().toInt(); | ||
| 903 | + for (int i=0; i<numDetects; i++) { | ||
| 904 | + const QStringList detect = lines.takeFirst().split(' '); | ||
| 905 | + Template t(fileName); | ||
| 906 | + t.file.set("Face", QRectF(detect[0].toFloat(), detect[1].toFloat(), detect[2].toFloat(), detect[3].toFloat())); | ||
| 907 | + t.file.set("Confidence", detect[4].toFloat()); | ||
| 908 | + templates.append(t); | ||
| 909 | + } | ||
| 910 | + } | ||
| 911 | + return templates; | ||
| 912 | + } | ||
| 913 | + | ||
| 914 | + void write(const Template &t) | ||
| 915 | + { | ||
| 916 | + (void) t; | ||
| 917 | + qFatal("Not implemented."); | ||
| 918 | + } | ||
| 919 | +}; | ||
| 920 | + | ||
| 921 | +BR_REGISTER(Gallery, FDDBGallery) | ||
| 922 | + | ||
| 884 | } // namespace br | 923 | } // namespace br |
| 885 | 924 | ||
| 886 | #include "gallery.moc" | 925 | #include "gallery.moc" |