diff --git a/openbr/plugins/gallery.cpp b/openbr/plugins/gallery.cpp index 7861fd1..1c0eb26 100644 --- a/openbr/plugins/gallery.cpp +++ b/openbr/plugins/gallery.cpp @@ -1588,6 +1588,79 @@ class landmarksGallery : public Gallery BR_REGISTER(Gallery, landmarksGallery) +/*! + * \ingroup galleries + * \brief MUCT format for specifying a shape for a file + * \author Scott Klum + * + * http://www.milbo.org/muct/ + */ +class shapeGallery : public Gallery +{ + Q_OBJECT + + QMap attributes; + + TemplateList readBlock(bool *done) + { + *done = true; + TemplateList templates; + QStringList lines = QtUtils::readLines(file); + for (int i=0; i= 2147483648) /* Don't use face detection results for now */ { + i+=2; continue; + } else if (ok && attributes.contains(attributeKey)) { + file.set(attributes[attributeKey],true); + } + + // Next line should be "{ numLandmarks dimensions" + // We don't current support more than two dimensions for landmarks + values = lines[++i].split(' '); + int numLandmarks = values.at(1).toInt(&ok); + if (ok) { + QList points; points.reserve(numLandmarks); + for (int j=0; j vals = QtUtils::toFloats(lines[++i].split(' ')); + points.append(QPointF(vals[0], vals[1])); + } + file.setPoints(points); + } + templates.append(file); + } + return templates; + } + + void write(const Template &t) + { + (void) t; + qFatal("Not implemented."); + } + + void init() + { + // attribute codes + attributes[4] = "Glasses"; + attributes[8] = "Beard"; + attributes[16] = "Mustache"; + attributes[256] = "BadImg"; + attributes[512] = "Cropped"; + attributes[2048] = "BadEye"; + } +}; + +BR_REGISTER(Gallery, shapeGallery) + #ifdef CVMATIO using namespace cv;