Commit be52f394d63a69894e498994b2241551bdedc84b
1 parent
7dc7471a
improved File documentation
Showing
1 changed file
with
18 additions
and
9 deletions
openbr/openbr_plugin.h
| @@ -107,19 +107,28 @@ void reset_##NAME() { NAME = DEFAULT; } | @@ -107,19 +107,28 @@ void reset_##NAME() { NAME = DEFAULT; } | ||
| 107 | /*! | 107 | /*! |
| 108 | * \brief A file path with associated metadata. | 108 | * \brief A file path with associated metadata. |
| 109 | * | 109 | * |
| 110 | - * The br::File is one of the workhorse classes in OpenBR. | 110 | + * The File is one of two important data structures in OpenBR (the Template is the other). |
| 111 | * It is typically used to store the path to a file on disk with associated metadata. | 111 | * It is typically used to store the path to a file on disk with associated metadata. |
| 112 | - * The ability to associate a metadata map with the file helps keep the API simple and stable while providing customizable behavior when appropriate. | 112 | + * The ability to associate a key/value metadata table with the file helps keep the API simple while providing customizable behavior. |
| 113 | * | 113 | * |
| 114 | - * When querying the value of a metadata key, the value will first try to be resolved using the file's private metadata. | ||
| 115 | - * If the key does not exist in the local map then it will be resolved using the properities in the global br::Context. | ||
| 116 | - * This has the desirable effect that file metadata may optionally be set globally using br::Context::set to operate on all files. | 114 | + * When querying the value of a metadata key, the value will first try to be resolved against the file's private metadata table. |
| 115 | + * If the key does not exist in its local table then it will be resolved against the properities in the global Context. | ||
| 116 | + * By design file metadata may be set globally using Context::setProperty to operate on all files. | ||
| 117 | * | 117 | * |
| 118 | * Files have a simple grammar that allow them to be converted to and from strings. | 118 | * Files have a simple grammar that allow them to be converted to and from strings. |
| 119 | * If a string ends with a \c ] or \c ) then the text within the final \c [] or \c () are parsed as comma sperated metadata fields. | 119 | * If a string ends with a \c ] or \c ) then the text within the final \c [] or \c () are parsed as comma sperated metadata fields. |
| 120 | - * Fields within \c [] are expected to have the format <tt>[key1=value1, key2=value2, ..., keyN=valueN]</tt>. | ||
| 121 | - * Fields within \c () are expected to have the format <tt>(value1, value2, ..., valueN)</tt> with the keys determined from the order of \c Q_PROPERTY. | ||
| 122 | - * The rest of the string is assigned to #name. | 120 | + * By convention, fields within \c [] are expected to have the format <tt>[key1=value1, key2=value2, ..., keyN=valueN]</tt> where order is irrelevant. |
| 121 | + * Fields within \c () are expected to have the format <tt>(value1, value2, ..., valueN)</tt> where order matters and the key context dependent. | ||
| 122 | + * The left hand side of the string not parsed in a manner described above is assigned to #name. | ||
| 123 | + * | ||
| 124 | + * Values are not necessarily stored as strings in the metadata table. | ||
| 125 | + * The system will attempt to infer and convert them to their "native" type. | ||
| 126 | + * The conversion logic is as follows: | ||
| 127 | + * -# If the value starts with \c [ and ends with \c ] then it is treated as a comma separated list and represented with \c QVariantList. Each value in the list is parsed recursively. | ||
| 128 | + * -# If the value starts with \c ( and ends with \c ) and contains four comma separated elements, each convertable to a floating point number, then it is represented with \c QRectF. | ||
| 129 | + * -# If the value starts with \c ( and ends with \c ) and contains two comma separated elements, each convertable to a floating point number, then it is represented with \c QPointF. | ||
| 130 | + * -# If the value is convertable to a floating point number then it is represented with \c float. | ||
| 131 | + * -# Otherwise, it is represented with \c QString. | ||
| 123 | * | 132 | * |
| 124 | * The metadata keys \c Subject and \c Label have special significance in the system. | 133 | * The metadata keys \c Subject and \c Label have special significance in the system. |
| 125 | * \c Subject is a string specifying a unique identifier used to determine ground truth match/non-match. | 134 | * \c Subject is a string specifying a unique identifier used to determine ground truth match/non-match. |
| @@ -298,7 +307,7 @@ struct BR_EXPORT FileList : public QList<File> | @@ -298,7 +307,7 @@ struct BR_EXPORT FileList : public QList<File> | ||
| 298 | /*! | 307 | /*! |
| 299 | * \brief A list of matrices associated with a file. | 308 | * \brief A list of matrices associated with a file. |
| 300 | * | 309 | * |
| 301 | - * The br::Template is one of the workhorse classes in OpenBR. | 310 | + * The Template is one of two important data structures in OpenBR (the File is the other). |
| 302 | * A template represents a biometric at various stages of enrollment and can be modified br::Transform and compared to other templates with br::Distance. | 311 | * A template represents a biometric at various stages of enrollment and can be modified br::Transform and compared to other templates with br::Distance. |
| 303 | * | 312 | * |
| 304 | * While there exist many cases (ex. video enrollment, multiple face detects, per-patch subspace learning, ...) where the template will contain more than one matrix, | 313 | * While there exist many cases (ex. video enrollment, multiple face detects, per-patch subspace learning, ...) where the template will contain more than one matrix, |