Commit 08fb3495e388f33ae7264d61f4ffe1fcd444648d

Authored by Scott Klum
1 parent a91c55a5

Generalized verifydetection

openbr/plugins/metadata/verifydetection.cpp
@@ -21,29 +21,33 @@ namespace br @@ -21,29 +21,33 @@ namespace br
21 21
22 /*! 22 /*!
23 * \ingroup transforms 23 * \ingroup transforms
24 - * \brief Check if a the automated face detection contains the landmarks correpsonding 24 + * \brief Check if a the automated face detection contains the landmarks corresponding
25 * to the tempate metadata. If not, drop the template. This is meant for use 25 * to the tempate metadata. If not, drop the template. This is meant for use
26 - * during training, where the landmarks will be ground truth'd. If one wants to 26 + * during training, where the landmarks will be ground truth'd. If one wants to
27 * using a ground truth bounding box instead, then convert the BB to a landmark. 27 * using a ground truth bounding box instead, then convert the BB to a landmark.
28 - * \br_property int index Index of the landmark to be used. 28 + * \br_property int index Index of the landmark to be used.
  29 + * \br_property QString inputVariable Metadata key for the rect.
29 * \author Brendan Klare \cite bklare 30 * \author Brendan Klare \cite bklare
30 */ 31 */
31 class VerifyDetectionTransform : public UntrainableMetaTransform 32 class VerifyDetectionTransform : public UntrainableMetaTransform
32 { 33 {
33 Q_OBJECT 34 Q_OBJECT
34 Q_PROPERTY(int index READ get_index WRITE set_index RESET reset_index STORED false) 35 Q_PROPERTY(int index READ get_index WRITE set_index RESET reset_index STORED false)
  36 + Q_PROPERTY(QString inputVariable READ get_inputVariable WRITE set_inputVariable RESET reset_inputVariable STORED false)
35 BR_PROPERTY(int, index, 14) 37 BR_PROPERTY(int, index, 14)
  38 + BR_PROPERTY(QString, inputVariable, "Face")
36 39
37 - void project(const Template &, Template &dst) const 40 + void project(const Template &src, Template &dst) const
38 { 41 {
39 - qWarning("Single template project not supported by VerifyDetectionTransform.");  
40 - dst.file.fte = true; 42 + TemplateList temp;
  43 + project(TemplateList() << src, temp);
  44 + if (!temp.isEmpty()) dst = temp.first();
41 } 45 }
42 46
43 void project(const TemplateList &src, TemplateList &dst) const 47 void project(const TemplateList &src, TemplateList &dst) const
44 { 48 {
45 - for (int i = 0; i < src.size(); i++)  
46 - if (src[i].file.get<QRectF>("FrontalFace").contains(src[i].file.points()[index])) 49 + for (int i = 0; i < src.size(); i++)
  50 + if (src[i].file.get<QRectF>(inputVariable).contains(src[i].file.points()[index]))
47 dst.append(src[i]); 51 dst.append(src[i]);
48 } 52 }
49 }; 53 };