diff --git a/openbr/plugins/gallery.cpp b/openbr/plugins/gallery.cpp index 85a307b..6c53efd 100644 --- a/openbr/plugins/gallery.cpp +++ b/openbr/plugins/gallery.cpp @@ -870,6 +870,50 @@ class FDDBGallery : public Gallery BR_REGISTER(Gallery, FDDBGallery) +/*! + * \ingroup galleries + * \brief Text format for associating anonymous landmarks with images. + * \author Josh Klontz \cite jklontz + * + * \code + * file_name:x1,y1,x2,y2,...,xn,yn + * file_name:x1,y1,x2,y2,...,xn,yn + * ... + * file_name:x1,y1,x2,y2,...,xn,yn + * \endcode + */ +class landmarksGallery : public Gallery +{ + Q_OBJECT + + TemplateList readBlock(bool *done) + { + *done = true; + TemplateList templates; + foreach (const QString &line, QtUtils::readLines(file)) { + const QStringList words = line.split(':'); + if (words.size() != 2) qFatal("Expected exactly one ':' in: %s.", qPrintable(line)); + File file(words[0]); + const QList vals = QtUtils::toFloats(words[1].split(',')); + if (vals.size() % 2 != 0) qFatal("Expected an even number of comma-separated values."); + QList points; points.reserve(vals.size()/2); + for (int i=0; i