Commit 777c5ca5be41328721416156ae72122ec61ed321
Merge the docs branch into master and some cleanup
Showing
342 changed files
with
27891 additions
and
4440 deletions
Too many changes.
To preserve performance only 100 of 342 files are displayed.
CMakeLists.txt
| @@ -169,16 +169,6 @@ foreach(DIR ${BR_THIRDPARTY_APPS_DIR}) | @@ -169,16 +169,6 @@ foreach(DIR ${BR_THIRDPARTY_APPS_DIR}) | ||
| 169 | add_subdirectory(${DIR} 3rdparty_apps/${FNAME}) | 169 | add_subdirectory(${DIR} 3rdparty_apps/${FNAME}) |
| 170 | endforeach() | 170 | endforeach() |
| 171 | 171 | ||
| 172 | -# Build the documentation? | ||
| 173 | -option(BR_BUILD_DOCUMENTATION "Build Documentation (Requires doxygen and latex)") | ||
| 174 | -if(${BR_BUILD_DOCUMENTATION}) | ||
| 175 | - find_package(Doxygen REQUIRED) | ||
| 176 | - configure_file(${BR_SHARE_DIR}/Doxyfile.in Doxyfile) | ||
| 177 | - add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) | ||
| 178 | - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/share/openbr/MBGC_file_overview.pdf ${CMAKE_CURRENT_BINARY_DIR}/html/MBGC_file_overview.pdf COPYONLY) | ||
| 179 | - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION .) | ||
| 180 | -endif() | ||
| 181 | - | ||
| 182 | # Install | 172 | # Install |
| 183 | install(FILES CHANGELOG.md LICENSE.txt README.md DESTINATION share/openbr) | 173 | install(FILES CHANGELOG.md LICENSE.txt README.md DESTINATION share/openbr) |
| 184 | install(DIRECTORY share DESTINATION .) | 174 | install(DIRECTORY share DESTINATION .) |
app/br/br.cpp
| @@ -257,19 +257,22 @@ private: | @@ -257,19 +257,22 @@ private: | ||
| 257 | "-train <gallery> ... <gallery> [{model}]\n" | 257 | "-train <gallery> ... <gallery> [{model}]\n" |
| 258 | "-enroll <input_gallery> ... <input_gallery> {output_gallery}\n" | 258 | "-enroll <input_gallery> ... <input_gallery> {output_gallery}\n" |
| 259 | "-compare <target_gallery> <query_gallery> [{output}]\n" | 259 | "-compare <target_gallery> <query_gallery> [{output}]\n" |
| 260 | + "-pairwiseCompare <target_gallery> <query_gallery> [{output}]\n" | ||
| 260 | "-eval <simmat> [<mask>] [{csv}] [{matches}]\n" | 261 | "-eval <simmat> [<mask>] [{csv}] [{matches}]\n" |
| 262 | + "-inplaceEval <simmat> <target> <query> [{csv}]\n" | ||
| 261 | "-plot <file> ... <file> {destination}\n" | 263 | "-plot <file> ... <file> {destination}\n" |
| 262 | "\n" | 264 | "\n" |
| 263 | "==== Other Commands ====\n" | 265 | "==== Other Commands ====\n" |
| 264 | "-fuse <simmat> ... <simmat> (None|MinMax|ZScore|WScore) (Min|Max|Sum[W1:W2:...:Wn]|Replace|Difference|None) {simmat}\n" | 266 | "-fuse <simmat> ... <simmat> (None|MinMax|ZScore|WScore) (Min|Max|Sum[W1:W2:...:Wn]|Replace|Difference|None) {simmat}\n" |
| 265 | "-cluster <simmat> ... <simmat> <aggressiveness> {csv}\n" | 267 | "-cluster <simmat> ... <simmat> <aggressiveness> {csv}\n" |
| 266 | "-makeMask <target_gallery> <query_gallery> {mask}\n" | 268 | "-makeMask <target_gallery> <query_gallery> {mask}\n" |
| 269 | + "-makePairwiseMask <target_gallery> <query_gallery> {mask}\n" | ||
| 267 | "-combineMasks <mask> ... <mask> {mask} (And|Or)\n" | 270 | "-combineMasks <mask> ... <mask> {mask} (And|Or)\n" |
| 268 | "-cat <gallery> ... <gallery> {gallery}\n" | 271 | "-cat <gallery> ... <gallery> {gallery}\n" |
| 269 | "-convert (Format|Gallery|Output) <input_file> {output_file}\n" | 272 | "-convert (Format|Gallery|Output) <input_file> {output_file}\n" |
| 270 | "-evalClassification <predicted_gallery> <truth_gallery> <predicted property name> <ground truth proprty name>\n" | 273 | "-evalClassification <predicted_gallery> <truth_gallery> <predicted property name> <ground truth proprty name>\n" |
| 271 | "-evalClustering <clusters> <gallery>\n" | 274 | "-evalClustering <clusters> <gallery>\n" |
| 272 | - "-evalDetection <predicted_gallery> <truth_gallery> [{csv}] [{normalize}] [{minSize}]\n" | 275 | + "-evalDetection <predicted_gallery> <truth_gallery> [{csv}] [{normalize}] [{minSize}] [{maxSize}]\n" |
| 273 | "-evalLandmarking <predicted_gallery> <truth_gallery> [{csv} [<normalization_index_a> <normalization_index_b>] [sample_index] [total_examples]]\n" | 276 | "-evalLandmarking <predicted_gallery> <truth_gallery> [{csv} [<normalization_index_a> <normalization_index_b>] [sample_index] [total_examples]]\n" |
| 274 | "-evalRegression <predicted_gallery> <truth_gallery> <predicted property name> <ground truth property name>\n" | 277 | "-evalRegression <predicted_gallery> <truth_gallery> <predicted property name> <ground truth property name>\n" |
| 275 | "-assertEval <simmat> <mask> <accuracy>\n" | 278 | "-assertEval <simmat> <mask> <accuracy>\n" |
| @@ -277,6 +280,7 @@ private: | @@ -277,6 +280,7 @@ private: | ||
| 277 | "-plotLandmarking <file> ... <file> {destination}\n" | 280 | "-plotLandmarking <file> ... <file> {destination}\n" |
| 278 | "-plotMetadata <file> ... <file> <columns>\n" | 281 | "-plotMetadata <file> ... <file> <columns>\n" |
| 279 | "-project <input_gallery> {output_gallery}\n" | 282 | "-project <input_gallery> {output_gallery}\n" |
| 283 | + "-deduplicate <input_gallery> <output_gallery> <threshold>" | ||
| 280 | "-getHeader <matrix>\n" | 284 | "-getHeader <matrix>\n" |
| 281 | "-setHeader {<matrix>} <target_gallery> <query_gallery>\n" | 285 | "-setHeader {<matrix>} <target_gallery> <query_gallery>\n" |
| 282 | "-<key> <value>\n" | 286 | "-<key> <value>\n" |
| @@ -288,6 +292,7 @@ private: | @@ -288,6 +292,7 @@ private: | ||
| 288 | "-about\n" | 292 | "-about\n" |
| 289 | "-version\n" | 293 | "-version\n" |
| 290 | "-daemon\n" | 294 | "-daemon\n" |
| 295 | + "-slave\n" | ||
| 291 | "-exit\n"); | 296 | "-exit\n"); |
| 292 | } | 297 | } |
| 293 | }; | 298 | }; |
docs/DOCS.md
0 → 100644
| 1 | +# OpenBR Documentation Guide | ||
| 2 | + | ||
| 3 | +This is a quick guide for generating the OpenBR documentation on your local machine. The documentation is available online at www.openbiometrics.org. | ||
| 4 | + | ||
| 5 | +OpenBR's documentation is built with MkDocs. Please see their website for additional information at www.mkdocs.org. Installing mkdocs with pip is super easy- | ||
| 6 | + | ||
| 7 | + $ pip install mkdocs | ||
| 8 | + | ||
| 9 | +Please note that you need Python 2.7 and above already installed. Once mkdocs is installed you can run build_docs.sh to build static html pages at openbr/docs/site. However, for viewing we recommend serving the docs to your browser using a simple http server. Run | ||
| 10 | + | ||
| 11 | + $ mkdocs serve | ||
| 12 | + | ||
| 13 | +from openbr/docs and then go to http://127.0.0.1:8000 in your internet browser of choice to view the docs locally. |
docs/build_docs.sh
0 → 100644
docs/docs/api_docs.md
0 → 100644
| 1 | +# API Documentation | ||
| 2 | + | ||
| 3 | +OpenBR offers four APIs for your convenience: | ||
| 4 | + | ||
| 5 | +* [C API](api_docs/c_api.md) | ||
| 6 | +* [Command Line API](api_docs/cl_api.md) | ||
| 7 | +* [Python API](api_docs/python_api.md) | ||
| 8 | +* [C++ Plugin API](api_docs/cpp_api.md) | ||
| 9 | + | ||
| 10 | +Please see the detailed documentation for each to learn more. |
docs/docs/api_docs/c_api.md
0 → 100644
| 1 | +# C API | ||
| 2 | + | ||
| 3 | +The C API is a high-level API for running algorithms and evaluating results. | ||
| 4 | + | ||
| 5 | +In order to provide a high-level interface that is usable from the command line and callable from other programming languages, the API is designed to operate at the "file system" level. | ||
| 6 | +In other words, arguments to many functions are file paths that specify either a source of input or a desired output. | ||
| 7 | +File extensions are relied upon to determine *how* files should be interpreted in the context of the function being called. | ||
| 8 | +The [C++ Plugin API](cpp_api.md) should be used if more fine-grained control is required. | ||
| 9 | + | ||
| 10 | +## Important API Considerations | ||
| 11 | + | ||
| 12 | +Name | Consideration | ||
| 13 | +--- | --- | ||
| 14 | +<a class="table-anchor" id="memory"></a>Memory | Memory for <tt>const char*</tt> return values is managed internally and guaranteed until the next call to the function | ||
| 15 | +<a class="table-anchor" id="input-string-buffers"></a>Input String Buffers | Users should input a char * buffer and the size of that buffer. String data will be copied into the buffer, if the buffer is too small, only part of the string will be copied. Returns the buffer size required to contain the complete string. | ||
| 16 | + | ||
| 17 | + | ||
| 18 | +## Using the API | ||
| 19 | + | ||
| 20 | +To use the API in your project include the following file: | ||
| 21 | + | ||
| 22 | + #include <openbr/openbr.h> | ||
| 23 | + | ||
| 24 | +[CMake](http://www.cmake.org/) developers may wish to the cmake configuration file found at: | ||
| 25 | + | ||
| 26 | + share/openbr/cmake/OpenBRConfig.cmake | ||
| 27 | + | ||
| 28 | +Please see the [tutorials](../tutorials.md) section for examples. |
docs/docs/api_docs/c_api/functions.md
0 → 100644
| 1 | +## br_about | ||
| 2 | + | ||
| 3 | +Calls [Context](../cpp_api/context/context.md)::[about](../cpp_api/context/statics.md#about). | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + const char *br_about() | ||
| 8 | + | ||
| 9 | +* **parameters:** None | ||
| 10 | +* **output:** (const char *) Returns a string describing OpenBR | ||
| 11 | +* **see:** [br_version](#br_version) | ||
| 12 | + | ||
| 13 | +--- | ||
| 14 | + | ||
| 15 | +## br_cat | ||
| 16 | + | ||
| 17 | +Concatenates a list of galleries into 1 gallery. | ||
| 18 | + | ||
| 19 | +* **function definition:** | ||
| 20 | + | ||
| 21 | + void br_cat(int num_input_galleries, const char *input_galleries[], const char *output_gallery) | ||
| 22 | + | ||
| 23 | +* **parameters:** | ||
| 24 | + | ||
| 25 | + Parameter | Type | Description | ||
| 26 | + --- | --- | --- | ||
| 27 | + num_input_galleries | int | Size of input_galleries | ||
| 28 | + input_galleries[] | const char * | List of galleries | ||
| 29 | + output_gallery | const char * | Pointer to store concatenated gallery | ||
| 30 | + | ||
| 31 | +* **output:** void | ||
| 32 | +* **see:** [Cat](../cpp_api/apifunctions.md#cat) | ||
| 33 | + | ||
| 34 | +--- | ||
| 35 | + | ||
| 36 | +## br_deduplicate | ||
| 37 | + | ||
| 38 | +Removes duplicate [templates](../cpp_api/template/template.md) in a [gallery](../cpp_api/gallery/gallery.md). If a galley contains n duplicates, the first n-1 duplicates in the gallery will be removed and the nth will be kept. Users are encouraged to use binary gallery formats as the entire gallery is read into memory in one call to [Gallery](../cpp_api/gallery/gallery.md)::[read](../cpp_api/gallery/functions.md#read). | ||
| 39 | + | ||
| 40 | +* **function definition:** | ||
| 41 | + | ||
| 42 | + void br_deduplicate(const char *input_gallery, const char *output_gallery, const char *threshold) | ||
| 43 | + | ||
| 44 | +* **parameters:** | ||
| 45 | + | ||
| 46 | + Parameter | Type | Description | ||
| 47 | + --- | --- | --- | ||
| 48 | + input_gallery | const char * | Gallery to be deduplicated | ||
| 49 | + output_gallery | const char * | Deduplicated gallery | ||
| 50 | + threshold | const char * | Comparisons with a match score >= this value are designated to be duplicates. | ||
| 51 | + | ||
| 52 | +* **output:** (void) | ||
| 53 | + | ||
| 54 | +--- | ||
| 55 | + | ||
| 56 | +## br_cluster | ||
| 57 | + | ||
| 58 | +Clusters one or more similarity matrices into a list of subjects. A [similarity matrix](../../tutorials.md#the-evaluation-harness) is a type of [Output](../cpp_api/output/output.md). The current clustering algorithm is a simplified implementation of the algorithm proposed by Zhu et al[^1]. | ||
| 59 | + | ||
| 60 | +* **function definition:** | ||
| 61 | + | ||
| 62 | + void br_cluster(int num_simmats, const char *simmats[], float aggressiveness, const char *csv) | ||
| 63 | + | ||
| 64 | +* **parameters:** | ||
| 65 | + | ||
| 66 | + Parameter | Type | Description | ||
| 67 | + --- | --- | --- | ||
| 68 | + num_simmats | int | Size of **simmats** | ||
| 69 | + simmats[] | const char * | Array of [simmat](../../tutorials.md#the-evaluation-harness) composing one large self-similarity matrix arranged in row major order. | ||
| 70 | + aggressiveness | float | The higher the aggressiveness the larger the clusters. Suggested range is [0,10] | ||
| 71 | + csv | const char * | The cluster results file to generate. Results are stored one row per cluster and use gallery indices. | ||
| 72 | + | ||
| 73 | +* **output:** (void) | ||
| 74 | + | ||
| 75 | +--- | ||
| 76 | + | ||
| 77 | +## br_combine_masks | ||
| 78 | + | ||
| 79 | +Combines several equal-sized mask matrices. A comparison may not be simultaneously indentified as both a genuine and an imposter by different input masks. | ||
| 80 | + | ||
| 81 | +* **function definition:** | ||
| 82 | + | ||
| 83 | + void br_combine_masks(int num_input_masks, const char *input_masks[], const char *output_mask, const char *method) | ||
| 84 | + | ||
| 85 | +* **parameters:** | ||
| 86 | + | ||
| 87 | + Parameter | Type | Description | ||
| 88 | + --- | --- | --- | ||
| 89 | + num_input_masks | int | Size of **input_masks** | ||
| 90 | + input_masks[] | const char * | Array of [mask matrices](../../tutorials.md#the-evaluation-harness) to combine. All matrices must have the same dimensions. | ||
| 91 | + output_mask | const char * | The file to contain the resulting [mask matrix](../../tutorials.md#the-evaluation-harness) | ||
| 92 | + method | const char * | Possible values are: <ul><li>And - Ignore comparison if *any* input masks ignore.</li> <li>Or - Ignore comparison if *all* input masks ignore.</li></ul> | ||
| 93 | + | ||
| 94 | +* **see:** [br_make_mask](#br_make_mask) | ||
| 95 | + | ||
| 96 | +--- | ||
| 97 | + | ||
| 98 | +## br_compare | ||
| 99 | + | ||
| 100 | +Compares each [Template](../cpp_api/template/template.md) in the query [Gallery](../cpp_api/gallery/gallery.md) to each [Template](../cpp_api/template/template.md) in the target [Gallery](../cpp_api/gallery/gallery.md). | ||
| 101 | + | ||
| 102 | +* **function definition:** | ||
| 103 | + | ||
| 104 | + void br_compare(const char *target_gallery, const char *query_gallery, const char *output = "") | ||
| 105 | + | ||
| 106 | +* **parameters:** | ||
| 107 | + | ||
| 108 | + Parameter | Type | Description | ||
| 109 | + --- | --- | --- | ||
| 110 | + target_gallery | const char * | target_gallery The [Gallery](../cpp_api/gallery/gallery.md) file whose templates make up the columns of the output. | ||
| 111 | + query_gallery | const char * | The [Gallery](../cpp_api/gallery/gallery.md) file whose templates make up the rows of the output. A value of '.' reuses the target gallery as the query gallery. | ||
| 112 | + output | const char * | (Optional) The [Output](../cpp_api/output/output.md) file to contain the results of comparing the templates. The default behavior is to print scores to the terminal. | ||
| 113 | + | ||
| 114 | +* **output:** (void) | ||
| 115 | +* **see:** br_enroll | ||
| 116 | + | ||
| 117 | +--- | ||
| 118 | + | ||
| 119 | +## br_compare_n | ||
| 120 | + | ||
| 121 | +Convenience function for comparing to multiple targets. | ||
| 122 | + | ||
| 123 | +* **function definition:** | ||
| 124 | + | ||
| 125 | + void br_compare_n(int num_targets, const char *target_galleries[], const char *query_gallery, const char *output) | ||
| 126 | + | ||
| 127 | +* **parameters:** | ||
| 128 | + | ||
| 129 | + Parameter | Type | Description | ||
| 130 | + --- | --- | --- | ||
| 131 | + num_targets | int | Size of **target_galleries** | ||
| 132 | + target_galleries[] | const char * | Target galleries to compare against | ||
| 133 | + query_gallery | const char * | query gallery for comparison. | ||
| 134 | + output | const char * | (Optional) [Output](../cpp_api/output/output.md) file to contain the results of comparing the templates. The default behavior is to print scores to the terminal. | ||
| 135 | + | ||
| 136 | +* **output:** (void) | ||
| 137 | +* **see:** br_compare | ||
| 138 | + | ||
| 139 | +--- | ||
| 140 | + | ||
| 141 | +## br_pairwise_compare | ||
| 142 | + | ||
| 143 | +DOCUMENT ME! | ||
| 144 | + | ||
| 145 | +* **function definition:** | ||
| 146 | + | ||
| 147 | + void br_pairwise_compare(const char *target_gallery, const char *query_gallery, const char *output = "") | ||
| 148 | + | ||
| 149 | +* **parameters:** | ||
| 150 | + | ||
| 151 | + Parameter | Type | Description | ||
| 152 | + --- | --- | --- | ||
| 153 | + target_gallery | const char * | DOCUMENT ME | ||
| 154 | + query_gallery | const char * | DOCUMENT ME | ||
| 155 | + output | const char * | DOCUMENT ME | ||
| 156 | + | ||
| 157 | +* **output:** (void) | ||
| 158 | + | ||
| 159 | +--- | ||
| 160 | + | ||
| 161 | +## br_convert | ||
| 162 | + | ||
| 163 | +Convert a file to a different type. Files can only be converted to types within the same group. For example [formats](../cpp_api/format/format.md) can only be converted to other [formats](../cpp_api/format/format.md). | ||
| 164 | + | ||
| 165 | +* **function definition:** | ||
| 166 | + | ||
| 167 | + void br_convert(const char *file_type, const char *input_file, const char *output_file) | ||
| 168 | + | ||
| 169 | +* **parameters:** | ||
| 170 | + | ||
| 171 | + Parameter | Type | Description | ||
| 172 | + --- | --- | --- | ||
| 173 | + file_type | const char * | Type of file to convert. Options are [Format](../cpp_api/format/format.md), [Gallery](../cpp_api/gallery/gallery.md) or [Output](../cpp_api/output/output.md). | ||
| 174 | + input_file | const char * | File to convert. | ||
| 175 | + output_file | const char * | Output file. Type is determined by the file extension. | ||
| 176 | + | ||
| 177 | +* **output:** (void) | ||
| 178 | + | ||
| 179 | +--- | ||
| 180 | + | ||
| 181 | +## br_enroll | ||
| 182 | + | ||
| 183 | +Constructs [Template(s)](../cpp_api/template/template.md) from an input. | ||
| 184 | + | ||
| 185 | +* **function definition:** | ||
| 186 | + | ||
| 187 | + void br_enroll(const char *input, const char *gallery = "") | ||
| 188 | + | ||
| 189 | +* **parameters:** | ||
| 190 | + | ||
| 191 | + Parameter | Type | Description | ||
| 192 | + --- | --- | --- | ||
| 193 | + input | const char * | The [format](../cpp_api/format/format.md) or [gallery](../cpp_api/gallery/gallery.md) to enroll. | ||
| 194 | + gallery | const char * | (Optional) The [Gallery](../cpp_api/gallery/gallery.md) file to contain the enrolled templates. By default the gallery will be held in memory and *input* can used as a gallery in [br_compare](#br_compare) | ||
| 195 | + | ||
| 196 | +* **output:** (void) | ||
| 197 | +* **see:** [br_enroll_n](#br_enroll_n) | ||
| 198 | + | ||
| 199 | +--- | ||
| 200 | + | ||
| 201 | +## br_enroll_n | ||
| 202 | + | ||
| 203 | +Convenience function for enrolling multiple inputs. | ||
| 204 | + | ||
| 205 | +* **function definition:** | ||
| 206 | + | ||
| 207 | + void br_enroll_n(int num_inputs, const char *inputs[], const char *gallery = "") | ||
| 208 | + | ||
| 209 | +* **parameters:** | ||
| 210 | + | ||
| 211 | + Parameter | Type | Description | ||
| 212 | + --- | --- | --- | ||
| 213 | + num_inputs | int | Size of **inputs**. | ||
| 214 | + inputs[] | const char * | Array of inputs to enroll. | ||
| 215 | + gallery | const char * | (Optional) The [Gallery](../cpp_api/gallery/gallery.md) file to contain the enroll templates. | ||
| 216 | + | ||
| 217 | +* **output:** (void) | ||
| 218 | +* **see:** [br_enroll](#br_enroll) | ||
| 219 | + | ||
| 220 | +--- | ||
| 221 | + | ||
| 222 | +## br_project | ||
| 223 | + | ||
| 224 | +A naive alternative to [br_enroll](#br_enroll). | ||
| 225 | + | ||
| 226 | +* **function definition:** | ||
| 227 | + | ||
| 228 | + void br_project(const char *input, const char *output) | ||
| 229 | + | ||
| 230 | +* **parameters:** | ||
| 231 | + | ||
| 232 | + Parameter | Type | Description | ||
| 233 | + --- | --- | --- | ||
| 234 | + input | const char * | The [format](../cpp_api/format/format.md) or [gallery](../cpp_api/gallery/gallery.md) to enroll. | ||
| 235 | + output | const char * | The [Gallery](../cpp_api/gallery/gallery.md) file to contain the enrolled templates. By default the gallery will be held in memory and *input* can used as a gallery in [br_compare](#br_compare) | ||
| 236 | + | ||
| 237 | +* **output:** (void) | ||
| 238 | +* **see:** [br_enroll](#br_enroll) | ||
| 239 | + | ||
| 240 | +--- | ||
| 241 | + | ||
| 242 | +## br_eval | ||
| 243 | + | ||
| 244 | +Creates a **.csv** file containing performance metrics from evaluating the similarity matrix using the mask matrix. | ||
| 245 | + | ||
| 246 | +* **function defintion:** | ||
| 247 | + | ||
| 248 | + float br_eval(const char *simmat, const char *mask, const char *csv = "", int matches = 0) | ||
| 249 | + | ||
| 250 | +* **parameters:** | ||
| 251 | + | ||
| 252 | + Parameter | Type | Description | ||
| 253 | + --- | --- | --- | ||
| 254 | + simmat | const char * | The [simmat](../../tutorials.md#the-evaluation-harness) to use | ||
| 255 | + mask | const char * | The [mask](../../tutorials.md#the-evaluation-harness) to use. | ||
| 256 | + csv | const char * | (Optional) The **.csv** file to contain performance metrics. | ||
| 257 | + matches | int | (Optional) An integer number of matches to output around the EER. Default is 0. | ||
| 258 | + | ||
| 259 | +* **output:** (float) Returns the true accept rate (TAR) at a false accept rate (FAR) of one in one thousand | ||
| 260 | +* **see:** [br_plot](#br_plot) | ||
| 261 | + | ||
| 262 | +--- | ||
| 263 | + | ||
| 264 | +## br_assert_eval | ||
| 265 | + | ||
| 266 | +Evaluates the similarity matrix using the mask matrix. Function aborts if TAR @ FAR = 0.001 does not meet an expected performance value. | ||
| 267 | + | ||
| 268 | +* **function definition:** | ||
| 269 | + | ||
| 270 | + void br_assert_eval(const char *simmat, const char *mask, const float accuracy) | ||
| 271 | + | ||
| 272 | +* **parameters:** | ||
| 273 | + | ||
| 274 | + Parameter | Type | Description | ||
| 275 | + --- | --- | --- | ||
| 276 | + simmat | const char * | The [simmat](../../tutorials.md#the-evaluation-harness) to use | ||
| 277 | + mask | const char * | The [mask](../../tutorials.md#the-evaluation-harness) | ||
| 278 | + accuracy | const float | Desired true accept rate at false accept rate of one in one thousand. | ||
| 279 | + | ||
| 280 | +* **output:** (void) | ||
| 281 | + | ||
| 282 | +--- | ||
| 283 | + | ||
| 284 | +## br_inplace_eval | ||
| 285 | + | ||
| 286 | +Creates a **.csv** file containing performance metrics from evaluating the similarity matrix using galleries containing ground truth labels. | ||
| 287 | + | ||
| 288 | +* **function definition:** | ||
| 289 | + | ||
| 290 | + float br_inplace_eval(const char * simmat, const char *target, const char *query, const char *csv = "") | ||
| 291 | + | ||
| 292 | +* **parameters:** | ||
| 293 | + | ||
| 294 | + Parameter | Type | Description | ||
| 295 | + --- | --- | --- | ||
| 296 | + simmat | const char * | The [simmat](../../tutorials.md#the-evaluation-harness) | ||
| 297 | + target | const char * | The name of a gallery containing metadata for the target set. | ||
| 298 | + query | const char * | The name of a gallery containing metadata for the query set. | ||
| 299 | + csv | const char * | (Optional) The **.csv** file to contain performance metrics. | ||
| 300 | + | ||
| 301 | +* **output:** (float) Returns the true accept rate (TAR) at a false accept rate (FAR) of one in one thousand | ||
| 302 | +* **see:** [br_plot](#br_plot) | ||
| 303 | + | ||
| 304 | +--- | ||
| 305 | + | ||
| 306 | +## br_eval_classification | ||
| 307 | + | ||
| 308 | +Evaluates and prints classification accuracy to terminal. | ||
| 309 | + | ||
| 310 | +* **function definition:** | ||
| 311 | + | ||
| 312 | + void br_eval_classification(const char *predicted_gallery, const char *truth_gallery, const char *predicted_property = "", const char *truth_property = "") | ||
| 313 | + | ||
| 314 | +* **parameters:** | ||
| 315 | + | ||
| 316 | + Parameter | Type | Description | ||
| 317 | + --- | --- | --- | ||
| 318 | + predicted_gallery | const char * | The predicted [Gallery](../cpp_api/gallery/gallery.md). | ||
| 319 | + truth_gallery | const char * | The ground truth [Gallery](../cpp_api/gallery/gallery.md). | ||
| 320 | + predicted_property | const char * | (Optional) Which metadata key to use from the **predicted_gallery**. | ||
| 321 | + truth_property | const char * | (Optional) Which metadata key to use from the **truth_gallery**. | ||
| 322 | + | ||
| 323 | +* **output:** (void) | ||
| 324 | + | ||
| 325 | +--- | ||
| 326 | + | ||
| 327 | +## br_eval_clustering | ||
| 328 | + | ||
| 329 | +Evaluates and prints clustering accuracy to the terminal. | ||
| 330 | + | ||
| 331 | +* **function definition:** | ||
| 332 | + | ||
| 333 | + void br_eval_clustering(const char *csv, const char *gallery, const char * truth_property) | ||
| 334 | + | ||
| 335 | +* **parameters:** | ||
| 336 | + | ||
| 337 | +Parameter | Type | Description | ||
| 338 | +--- | --- | --- | ||
| 339 | +csv | const char * | The cluster results file. | ||
| 340 | +gallery | const char * | The [Gallery](../cpp_api/gallery/gallery.md) used to generate the [simmat](../../tutorials.md#the-evaluation-harness) that was clustered. | ||
| 341 | +truth_property | const char * | (Optional) which metadata key to use from **gallery**, defaults to Label | ||
| 342 | + | ||
| 343 | +* **output:** (void) | ||
| 344 | + | ||
| 345 | +--- | ||
| 346 | + | ||
| 347 | +## br_eval_detection | ||
| 348 | + | ||
| 349 | +Evaluates and prints detection accuracy to terminal. | ||
| 350 | + | ||
| 351 | +* **function definition:** | ||
| 352 | + | ||
| 353 | + float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv = "", bool normalize = false, int minSize = 0, int maxSize = 0) | ||
| 354 | + | ||
| 355 | +* **parameters:** | ||
| 356 | + | ||
| 357 | + Parameter | Type | Description | ||
| 358 | + --- | --- | --- | ||
| 359 | + predicted_gallery | const char * | The predicted [Gallery](../cpp_api/gallery/gallery.md). | ||
| 360 | + truth_gallery | const char * | The ground truth [Gallery](../cpp_api/gallery/gallery.md). | ||
| 361 | + csv | const char * | (Optional) The **.csv** file to contain performance metrics. | ||
| 362 | + normalize | bool | (Optional) Flag to normalize predicted bounding boxes for improved detection. Defaults to false. | ||
| 363 | + minSize | int | (Optional) Minimum size of faces to be considered in the evaluation. Size is applied to predicted and ground truth galleries. Defaults to -1 (no minimum size). | ||
| 364 | + maxSize | int | (Optional) Maximum size if faces to be considered in the evaluation. Size is applied to predicted and ground truth galleries. Defaults to -1 (no maximum size). | ||
| 365 | + | ||
| 366 | +* **output:** (float) Returns the true accept rate (TAR) at a false accept rate (FAR) of one in one thousand | ||
| 367 | + | ||
| 368 | +--- | ||
| 369 | + | ||
| 370 | +## br_eval_landmarking | ||
| 371 | + | ||
| 372 | +Evaluates and prints landmarking accuracy to terminal. | ||
| 373 | + | ||
| 374 | +* **function definition:** | ||
| 375 | + | ||
| 376 | + float br_eval_landmarking(const char *predicted_gallery, const char *truth_gallery, const char *csv = "", int normalization_index_a = 0, int normalization_index_b = 1, int sample_index = 0, int total_examples = 5) | ||
| 377 | + | ||
| 378 | +* **parameters:** | ||
| 379 | + | ||
| 380 | + Parameter | Type | Description | ||
| 381 | + --- | --- | --- | ||
| 382 | + predicted_gallery | const char * | The predicted [Gallery](../cpp_api/gallery/gallery.md). | ||
| 383 | + truth_gallery | const char * | The ground truth [Gallery](../cpp_api/gallery/gallery.md). | ||
| 384 | + csv | const char * | (Optional) The **.csv** file to contain performance metrics. | ||
| 385 | + normalization_index_a | int | (Optional) The first index in the list of points to use for normalization. Default is 0. | ||
| 386 | + normalization_index_b | int | (Optional) The second index in the list of points to use for normalization. Default is 1. | ||
| 387 | + sample_index | int | (Optional) The index for sample landmark image in ground truth gallery. Default = 0. | ||
| 388 | + total_examples | int | (Optional) The number of accurate and inaccurate examples to display. Default is 5. | ||
| 389 | + | ||
| 390 | +* **output:** (float) Returns the true accept rate (TAR) at a false accept rate (FAR) of one in one thousand | ||
| 391 | + | ||
| 392 | +--- | ||
| 393 | + | ||
| 394 | +## br_eval_regression | ||
| 395 | + | ||
| 396 | +Evaluates regression accuracy to disk. | ||
| 397 | + | ||
| 398 | +* **function definition:** | ||
| 399 | + | ||
| 400 | + void br_eval_regression(const char *predicted_gallery, const char *truth_gallery, const char *predicted_property = "", const char *truth_property = "") | ||
| 401 | + | ||
| 402 | +* **parameters:** | ||
| 403 | + | ||
| 404 | + Parameter | Type | Description | ||
| 405 | + --- | --- | --- | ||
| 406 | + predicted_gallery | const char * | The predicted [Gallery](../cpp_api/gallery/gallery.md) | ||
| 407 | + truth_gallery | const char * | The ground truth [Gallery](../cpp_api/gallery/gallery.md) | ||
| 408 | + predicted_property | const char * | (Optional) Which metadata key to use from **predicted_gallery**. | ||
| 409 | + truth_property | const char * | (Optional) Which metadata key to use from **truth_gallery**. | ||
| 410 | + | ||
| 411 | +* **output:** (void) | ||
| 412 | + | ||
| 413 | +--- | ||
| 414 | + | ||
| 415 | +## br_fuse | ||
| 416 | + | ||
| 417 | +Perform score level fusion on similarity matrices. | ||
| 418 | + | ||
| 419 | +* **function definition:** | ||
| 420 | + | ||
| 421 | + void br_fuse(int num_input_simmats, const char *input_simmats[], const char *normalization, const char *fusion, const char *output_simmat) | ||
| 422 | + | ||
| 423 | +* **parameters:** | ||
| 424 | + | ||
| 425 | + Parameter | Type | Description | ||
| 426 | + --- | --- | --- | ||
| 427 | + num_input_simmats | int | Size of **input_simmats**. | ||
| 428 | + input_simmats[] | const char * | Array of [simmats](../../tutorials.md#the-evaluation-harness). All simmats must have the same dimensions. | ||
| 429 | + normalization | const char * | Valid options are: <ul> <li>None - No score normalization.</li> <li>MinMax - Scores normalized to [0,1].</li> <li>ZScore - Scores normalized to a standard normal curve.</li> </ul> | ||
| 430 | + fusion | const char * | Valid options are: <ul> <li>Min - Uses the minimum score.</li> <li>Max - Uses the maximum score.</li> <li>Sum - Sums the scores. Sums can also be weighted: <tt>SumW1:W2:...:Wn</tt>.</li> <li>Replace - Replaces scores in the first matrix with scores in the second matrix when the mask is set.</li> </ul> | ||
| 431 | + output_simmat | const char * | [Simmat](../../tutorials.md#the-evaluation-harness) to contain the fused scores. | ||
| 432 | + | ||
| 433 | +* **output:** (void) | ||
| 434 | + | ||
| 435 | +--- | ||
| 436 | + | ||
| 437 | +## br_initialize | ||
| 438 | + | ||
| 439 | +Initializes the [Context](../cpp_api/context/context.md). Required at the beginning of any OpenBR program. | ||
| 440 | + | ||
| 441 | +* **function definition:** | ||
| 442 | + | ||
| 443 | + void br_initialize(int &argc, char *argv[], const char *sdk_path = "", bool use_gui = false) | ||
| 444 | + | ||
| 445 | +* **parameters:** | ||
| 446 | + | ||
| 447 | + Parameter | Type | Description | ||
| 448 | + --- | --- | --- | ||
| 449 | + argc | int | Number of command line arguments. | ||
| 450 | + argv[] | char * | Array of command line arguments. | ||
| 451 | + sdk_path | const char * | (Optional) Path to the OpenBR sdk. If no path is provided OpenBR will try and find the sdk automatically. | ||
| 452 | + use_gui | bool | (Optional) Enable OpenBR to use make GUI windows. Default is false. | ||
| 453 | + | ||
| 454 | +* **output:** (void) | ||
| 455 | +* **see:** [br_finalize](#br_finalize) | ||
| 456 | + | ||
| 457 | +--- | ||
| 458 | + | ||
| 459 | +## br_initialize_default | ||
| 460 | + | ||
| 461 | +Initializes the [Context](../cpp_api/context/context.md) with default arguments. | ||
| 462 | + | ||
| 463 | +* **function definition:** | ||
| 464 | + | ||
| 465 | + void br_initialize_default() | ||
| 466 | + | ||
| 467 | +* **parameters:** None | ||
| 468 | +* **output:** (void) | ||
| 469 | +* **see:** [br_finalize](#br_finalize) | ||
| 470 | + | ||
| 471 | +--- | ||
| 472 | + | ||
| 473 | +## br_finalize | ||
| 474 | + | ||
| 475 | +Finalizes the context. Required at the end of any OpenBR program. | ||
| 476 | + | ||
| 477 | +* **function definition:** | ||
| 478 | + | ||
| 479 | + void br_finalize() | ||
| 480 | + | ||
| 481 | +* **parameters:** None | ||
| 482 | +* **output:** (void) | ||
| 483 | +* **see:** [br_initialize](#br_initialize) | ||
| 484 | + | ||
| 485 | +--- | ||
| 486 | + | ||
| 487 | +## br_is_classifier | ||
| 488 | + | ||
| 489 | +Checks if the provided algorithm is a classifier. Wrapper of [IsClassifier](../cpp_api/apifunctions.md#isclassifier). | ||
| 490 | + | ||
| 491 | +* **function definition:** | ||
| 492 | + | ||
| 493 | + bool br_is_classifier(const char *algorithm) | ||
| 494 | + | ||
| 495 | +* **parameters:** | ||
| 496 | + | ||
| 497 | + Parameter | Type | Description | ||
| 498 | + --- | --- | --- | ||
| 499 | + algorithm | const char * | Algorithm to check. | ||
| 500 | + | ||
| 501 | +* **output:** (bool) Returns true if the algorithm is a classifier (does not have an associated distance) | ||
| 502 | +* **see:** [IsClassifier](../cpp_api/apifunctions.md#isclassifier) | ||
| 503 | + | ||
| 504 | +--- | ||
| 505 | + | ||
| 506 | +## br_make_mask | ||
| 507 | + | ||
| 508 | +Constructs a [mask](../../tutorials.md#the-evaluation-harness) from target and query inputs. | ||
| 509 | + | ||
| 510 | +* **function definition:** | ||
| 511 | + | ||
| 512 | + void br_make_mask(const char *target_input, const char *query_input, const char *mask) | ||
| 513 | + | ||
| 514 | +* **parameters:** | ||
| 515 | + | ||
| 516 | + Parameter | Type | Description | ||
| 517 | + --- | --- | --- | ||
| 518 | + target_input | const char * | The target [Gallery](../cpp_api/gallery/gallery.md) | ||
| 519 | + query_input | const char * | The query [Gallery](../cpp_api/gallery/gallery.md) | ||
| 520 | + mask | const char * | The file to contain the resulting [mask](../../tutorials.md#the-evaluation-harness). | ||
| 521 | + | ||
| 522 | +* **output:** (void) | ||
| 523 | +* **see:** [br_combine_masks](#br_combine_masks) | ||
| 524 | + | ||
| 525 | +--- | ||
| 526 | + | ||
| 527 | +## br_make_pairwise_mask | ||
| 528 | + | ||
| 529 | +Constructs a [mask](../../tutorials.md#the-evaluation-harness) from target and query inputs considering the target and input sets to be definite pairwise comparisons. | ||
| 530 | + | ||
| 531 | +* **function definition:** | ||
| 532 | + | ||
| 533 | + void br_make_pairwise_mask(const char *target_input, const char *query_input, const char *mask) | ||
| 534 | + | ||
| 535 | +* **parameters:** | ||
| 536 | + | ||
| 537 | +Parameter | Type | Description | ||
| 538 | +--- | --- | --- | ||
| 539 | +target_input | const char * | The target [Gallery](../cpp_api/gallery/gallery.md) | ||
| 540 | +query_input | const char * | The query [Gallery](../cpp_api/gallery/gallery.md) | ||
| 541 | +mask | const char * | The file to contain the resulting [mask](../../tutorials.md#the-evaluation-harness). | ||
| 542 | + | ||
| 543 | +* **output:** (void) | ||
| 544 | +* **see:** [br_combine_masks](#br_combine_masks) | ||
| 545 | + | ||
| 546 | +--- | ||
| 547 | + | ||
| 548 | +## br_most_recent_message | ||
| 549 | + | ||
| 550 | +Returns the most recent line sent to stderr. For information on input string buffers please look [here](../c_api.md#input-string-buffers) | ||
| 551 | + | ||
| 552 | +* **function definition:** | ||
| 553 | + | ||
| 554 | + int br_most_recent_message(char * buffer, int buffer_length) | ||
| 555 | + | ||
| 556 | +* **parameters:** | ||
| 557 | + | ||
| 558 | + Parameter | Type | Description | ||
| 559 | + --- | --- | --- | ||
| 560 | + buffer | char * | Buffer to store the last line in. | ||
| 561 | + buffer_length | int | Length of the buffer. | ||
| 562 | + | ||
| 563 | +* **output:** (int) Returns the required size of the input buffer for the most recent message to fit completely | ||
| 564 | +* **see:** [br_progress](#br_progress), [br_time_remaining](#br_time_remaining) | ||
| 565 | + | ||
| 566 | +--- | ||
| 567 | + | ||
| 568 | +## br_objects | ||
| 569 | + | ||
| 570 | +Returns names and parameters for the requested objects. Each object is newline seperated. Arguments are seperated from the object name with a tab. This function uses [QRegExp][QRegExp] syntax. | ||
| 571 | + | ||
| 572 | +* **function definition:** | ||
| 573 | + | ||
| 574 | + int br_objects(char * buffer, int buffer_length, const char *abstractions = ".*", const char *implementations = ".*", bool parameters = true) | ||
| 575 | + | ||
| 576 | +* **parameters:** | ||
| 577 | + | ||
| 578 | + Parameter | Type | Description | ||
| 579 | + --- | --- | --- | ||
| 580 | + buffer | char * | Output buffer for results. | ||
| 581 | + buffer_length | int | Length of output buffer. | ||
| 582 | + abstractions | const char * | (Optional) Regular expression of the abstractions to search. Default is ".\*". | ||
| 583 | + implementations | const char * | (Optional) Regular expression of the implementations to search. Default is ".\*". | ||
| 584 | + parameters | bool | (Optional) Include parameters after object name. Default is true. | ||
| 585 | + | ||
| 586 | +* **output:** (int) Returns the required size of the input buffer for the returned objects to fit completely | ||
| 587 | + | ||
| 588 | +--- | ||
| 589 | + | ||
| 590 | +## br_plot | ||
| 591 | + | ||
| 592 | +Renders recognition performance figures for a set of **.csv** files created by [br_eval](#br_eval). | ||
| 593 | + | ||
| 594 | +In order of their output, the figures are: | ||
| 595 | +1. Metadata table | ||
| 596 | +2. Receiver Operating Characteristic (ROC) | ||
| 597 | +3. Detection Error Tradeoff (DET) | ||
| 598 | +4. Score Distribution (SD) histogram | ||
| 599 | +5. True Accept Rate Bar Chart (BC) | ||
| 600 | +6. Cumulative Match Characteristic (CMC) | ||
| 601 | +7. Error Rate (ERR) curve | ||
| 602 | + | ||
| 603 | +Two files will be created: | ||
| 604 | + * **destination.R** which is the auto-generated R script used to render the figures. | ||
| 605 | + * **destination.pdf** which has all of the figures in one file multi-page file. | ||
| 606 | + | ||
| 607 | +OpenBR uses file and folder names to automatically determine the plot legend. | ||
| 608 | +For example, let's consider the case where three algorithms (<tt>A</tt>, <tt>B</tt>, & <tt>C</tt>) were each evaluated on two datasets (<tt>Y</tt> & <tt>Z</tt>). | ||
| 609 | +The suggested way to plot these experiments on the same graph is to create a folder named <tt>Algorithm_Dataset</tt> that contains the six <tt>.csv</tt> files produced by br_eval <tt>A_Y.csv</tt>, <tt>A_Z.csv</tt>, <tt>B_Y.csv</tt>, <tt>B_Z.csv</tt>, <tt>C_Y.csv</tt>, & <tt>C_Z.csv</tt>. | ||
| 610 | +The '<tt>_</tt>' character plays a special role in determining the legend title(s) and value(s). | ||
| 611 | +In this case, <tt>A</tt>, <tt>B</tt>, & <tt>C</tt> will be identified as different values of type <tt>Algorithm</tt>, and each will be assigned its own color; <tt>Y</tt> & <tt>Z</tt> will be identified as different values of type Dataset, and each will be assigned its own line style. | ||
| 612 | +Matches around the EER will be displayed if the matches parameter is set in [br_eval](#br_eval). | ||
| 613 | + | ||
| 614 | +This function requires a current [R][R] installation with the following packages: | ||
| 615 | + | ||
| 616 | + install.packages(c("ggplot2", "gplots", "reshape", "scales", "jpg", "png")) | ||
| 617 | + | ||
| 618 | +* **function definiton:** | ||
| 619 | + | ||
| 620 | + bool br_plot(int num_files, const char *files[], const char *destination, bool show = false) | ||
| 621 | + | ||
| 622 | +* **parameters:** | ||
| 623 | + | ||
| 624 | + Parameter | Type | Description | ||
| 625 | + --- | --- | --- | ||
| 626 | + num_files | int | Number of **.csv** files. | ||
| 627 | + files[] | const char * | **.csv** files created using [br_eval](#br_eval). | ||
| 628 | + destination | const char * | Basename for the resulting figures. | ||
| 629 | + show | bool | Open **destination.pdf** using the system's default PDF viewer. Default is false. | ||
| 630 | + | ||
| 631 | +* **output:** (bool) Returns true on success. Returns false on a failure to compile the figures due to a missing, out of date, or incomplete <tt>R</tt> installation. | ||
| 632 | +* **see:** [br_eval](#br_eval) | ||
| 633 | + | ||
| 634 | +--- | ||
| 635 | + | ||
| 636 | +## br_plot_detection | ||
| 637 | + | ||
| 638 | +Renders detection performance figures for a set of **.csv** files created by [br_eval_detection](#br_eval_detection). | ||
| 639 | + | ||
| 640 | +In order of their output, the figures are: | ||
| 641 | +1. Discrete Receiver Operating Characteristic (DiscreteROC) | ||
| 642 | +2. Continuous Receiver Operating Characteristic (ContinuousROC) | ||
| 643 | +3. Discrete Precision Recall (DiscretePR) | ||
| 644 | +4. Continuous Precision Recall (ContinuousPR) | ||
| 645 | +5. Bounding Box Overlap Histogram (Overlap) | ||
| 646 | +6. Average Overlap Table (AverageOverlap) | ||
| 647 | +7. Average Overlap Heatmap (AverageOverlap) | ||
| 648 | + | ||
| 649 | +Detection accuracy is measured with *overlap fraction = bounding box intersection / union*. | ||
| 650 | +When computing *discrete* curves, an overlap >= 0.5 is considered a true positive, otherwise it is considered a false negative. | ||
| 651 | +When computing *continuous* curves, true positives and false negatives are measured fractionally as *overlap* and *1-overlap* respectively. | ||
| 652 | + | ||
| 653 | +This function requires a current [R](http://www.r-project.org/) installation with the following packages: | ||
| 654 | + | ||
| 655 | + install.packages(c("ggplot2", "gplots", "reshape", "scales", "jpg", "png")) | ||
| 656 | + | ||
| 657 | +* **function definition:** | ||
| 658 | + | ||
| 659 | + bool br_plot_detection(int num_files, const char *files[], const char *destination, bool show = false) | ||
| 660 | + | ||
| 661 | +* **parameters:** | ||
| 662 | + | ||
| 663 | + Parameter | Type | Description | ||
| 664 | + --- | --- | --- | ||
| 665 | + num_files | int | Number of **.csv** files. | ||
| 666 | + files[] | const char * | **.csv** files created using [br_eval_detection](#br_eval_detection). | ||
| 667 | + destination | const char * | Basename for the resulting figures. | ||
| 668 | + show | bool | Open **destination.pdf** using the system's default PDF viewer. Default is false. | ||
| 669 | + | ||
| 670 | +* **output:** (bool) Returns true on success. Returns false on a failure to compile the figures due to a missing, out of date, or incomplete <tt>R</tt> installation. | ||
| 671 | +* **see:** [br_eval_detection](#br_eval_detection), [br_plot](#br_plot) | ||
| 672 | + | ||
| 673 | +--- | ||
| 674 | + | ||
| 675 | +## br_plot_landmarking | ||
| 676 | + | ||
| 677 | +Renders landmarking performance figures for a set of **.csv** files created by [br_eval_landmarking](#br_eval_landmarking). | ||
| 678 | + | ||
| 679 | +In order of their output, the figures are: | ||
| 680 | +1. Cumulative landmarks less than normalized error (CD) | ||
| 681 | +2. Normalized error box and whisker plots (Box) | ||
| 682 | +3. Normalized error violin plots (Violin) | ||
| 683 | + | ||
| 684 | +Landmarking error is normalized against the distance between two predifined points, usually inter-ocular distance (IOD). | ||
| 685 | + | ||
| 686 | +* **function definition:** | ||
| 687 | + | ||
| 688 | + bool br_plot_landmarking(int num_files, const char *files[], const char *destination, bool show = false) | ||
| 689 | + | ||
| 690 | +* **parameters:** | ||
| 691 | + | ||
| 692 | + Parameter | Type | Description | ||
| 693 | + --- | --- | --- | ||
| 694 | + num_files | int | Number of **.csv** files. | ||
| 695 | + files[] | const char * | **.csv** files created using [br_eval_landmarking](#br_eval_landmarking). | ||
| 696 | + destination | const char * | Basename for the resulting figures. | ||
| 697 | + show | bool | Open **destination.pdf** using the system's default PDF viewer. Default is false. | ||
| 698 | + | ||
| 699 | +* **output:** (bool) Returns true on success. Returns false on a failure to compile the figures due to a missing, out of date, or incomplete <tt>R</tt> installation. | ||
| 700 | +* **see:** [br_eval_landmarking](#br_eval_landmarking), [br_plot](#br_plot) | ||
| 701 | + | ||
| 702 | +--- | ||
| 703 | + | ||
| 704 | +## br_plot_metadata | ||
| 705 | + | ||
| 706 | +Renders metadata figures for a set of **.csv** files with specified columns. | ||
| 707 | + | ||
| 708 | +* **function definition:** | ||
| 709 | + | ||
| 710 | + bool br_plot_metadata(int num_files, const char *files[], const char *columns, bool show = false) | ||
| 711 | + | ||
| 712 | +* **parameters:** | ||
| 713 | + | ||
| 714 | + Parameter | Type | Description | ||
| 715 | + --- | --- | --- | ||
| 716 | + num_files | int | Number of **.csv** files. | ||
| 717 | + files[] | const char * | **.csv** files created by enrolling templates to **.csv** metadata files. | ||
| 718 | + columns | const char * | ';' seperated list of columns to plot. | ||
| 719 | + show | bool | Open **PlotMetadata.pdf** using the system's default PDF viewer. | ||
| 720 | + | ||
| 721 | +* **output:** (bool) Returns true on success. Returns false on a failure to compile the figures due to a missing, out of date, or incomplete <tt>R</tt> installation. | ||
| 722 | +* **see:** [br_plot](#br_plot) | ||
| 723 | + | ||
| 724 | +--- | ||
| 725 | + | ||
| 726 | +## br_progress | ||
| 727 | + | ||
| 728 | +Returns current progress from [Context](../cpp_api/context/context.md)::[progress](../cpp_api/context/functions.md#progress). | ||
| 729 | + | ||
| 730 | +* **function definition:** | ||
| 731 | + | ||
| 732 | + float br_progress() | ||
| 733 | + | ||
| 734 | +* **parameters:** None | ||
| 735 | + | ||
| 736 | +* **output:** (float) Returns the completion percentage of the running process | ||
| 737 | +* **see:** [br_most_recent_message](#br_most_recent_message), [br_time_remaining](#br_time_remaining) | ||
| 738 | + | ||
| 739 | +--- | ||
| 740 | + | ||
| 741 | +## br_read_pipe | ||
| 742 | + | ||
| 743 | +Read and parse arguments from a named pipe. Used by the [command line api](../cl_api.md) to implement **-daemon**, generally not useful otherwise. Guaranteed to return at least one argument. For information on managed returned values see [here](../c_api.md#memory) | ||
| 744 | + | ||
| 745 | +* **function defintion:** | ||
| 746 | + | ||
| 747 | + void br_read_pipe(const char *pipe, int *argc, char ***argv) | ||
| 748 | + | ||
| 749 | +* **parameters:** | ||
| 750 | + | ||
| 751 | + Parameter | Type | Description | ||
| 752 | + --- | --- | --- | ||
| 753 | + pipe | const char * | Pipe name | ||
| 754 | + argc | int * | Argument count | ||
| 755 | + argv | char *** | Argument list | ||
| 756 | + | ||
| 757 | +* **output:** (void) | ||
| 758 | + | ||
| 759 | +--- | ||
| 760 | + | ||
| 761 | +## br_scratch_path | ||
| 762 | + | ||
| 763 | +Fills the buffer with the value of [Context](../cpp_api/context/context.md)::[scratchPath](../cpp_api/context/statics.md#scratchpath). For information on input string buffers see [here](../c_api.md#input-string-buffers). | ||
| 764 | + | ||
| 765 | +* **function defintion:** | ||
| 766 | + | ||
| 767 | + int br_scratch_path(char * buffer, int buffer_length) | ||
| 768 | + | ||
| 769 | +* **parameters:** | ||
| 770 | + | ||
| 771 | + Parameter | Type | Description | ||
| 772 | + --- | --- | --- | ||
| 773 | + buffer | char * | Buffer for scratch path | ||
| 774 | + buffer_length | int | Length of buffer. | ||
| 775 | + | ||
| 776 | +* **output:** (int) Returns the required size of the input buffer for the most recent message to fit completely | ||
| 777 | +* **see:** [br_version](#br_version) | ||
| 778 | + | ||
| 779 | +--- | ||
| 780 | + | ||
| 781 | +## br_sdk_path | ||
| 782 | + | ||
| 783 | +Returns the full path to the root of the SDK. | ||
| 784 | + | ||
| 785 | +* **function definition:** | ||
| 786 | + | ||
| 787 | + const char *br_sdk_path() | ||
| 788 | + | ||
| 789 | +* **parameters:** None | ||
| 790 | +* **output:** (const char *) Returns the full path to the root of the SDK | ||
| 791 | +* **see:** [br_initialize](#br_initialize) | ||
| 792 | + | ||
| 793 | +--- | ||
| 794 | + | ||
| 795 | +## br_get_header | ||
| 796 | + | ||
| 797 | +Retrieve the target and query inputs in the [BEE matrix](../../tutorials.md#the-evaluation-harness) header. For information on managed return values see [here](../c_api.md#memory). | ||
| 798 | + | ||
| 799 | +* **function definition:** | ||
| 800 | + | ||
| 801 | + void br_get_header(const char *matrix, const char **target_gallery, const char **query_gallery) | ||
| 802 | + | ||
| 803 | +* **parameters:** | ||
| 804 | + | ||
| 805 | + Parameter | Type | Description | ||
| 806 | + --- | --- | --- | ||
| 807 | + matrix | const char * | The [BEE matrix](../../tutorials.md#the-evaluation-harness) file to modify | ||
| 808 | + target_gallery | const char ** | The matrix target | ||
| 809 | + query_gallery | const char ** | The matrix query | ||
| 810 | + | ||
| 811 | +* **output:** (void) | ||
| 812 | +* **set:** [br_set_header](#br_set_header) | ||
| 813 | + | ||
| 814 | +--- | ||
| 815 | + | ||
| 816 | +## br_set_header | ||
| 817 | + | ||
| 818 | +Update the target and query inputs in the [BEE matrix](../../tutorials.md#the-evaluation-harness) header. | ||
| 819 | + | ||
| 820 | +* **function definition:** | ||
| 821 | + | ||
| 822 | + void br_set_header(const char *matrix, const char *target_gallery, const char *query_gallery) | ||
| 823 | + | ||
| 824 | +* **parameters:** | ||
| 825 | + | ||
| 826 | + Parameter | Type | Description | ||
| 827 | + --- | --- | --- | ||
| 828 | + matrix | const char * | The [BEE matrix](../../tutorials.md#the-evaluation-harness) file to modify | ||
| 829 | + target_gallery | const char ** | The matrix target | ||
| 830 | + query_gallery | const char ** | The matrix query | ||
| 831 | + | ||
| 832 | +* **output:** (void) | ||
| 833 | +* **see:** [br_get_header](#br_get_header) | ||
| 834 | + | ||
| 835 | +--- | ||
| 836 | + | ||
| 837 | +## br_set_property | ||
| 838 | + | ||
| 839 | +Appends a provided value to the [global metadata](../cpp_api/context/context.md) using a provided key. | ||
| 840 | + | ||
| 841 | +* **function definition:** | ||
| 842 | + | ||
| 843 | + void br_set_property(const char *key, const char *value) | ||
| 844 | + | ||
| 845 | +* **parameters:** | ||
| 846 | + | ||
| 847 | + Parameter | Type | Description | ||
| 848 | + --- | --- | --- | ||
| 849 | + key | const char * | Key to append | ||
| 850 | + value | const char * | Value to append | ||
| 851 | + | ||
| 852 | +* **output:** (void) | ||
| 853 | + | ||
| 854 | +--- | ||
| 855 | + | ||
| 856 | +## br_time_remaining | ||
| 857 | + | ||
| 858 | +Returns estimate of time remaining in the current process. | ||
| 859 | + | ||
| 860 | +* **function definition:** | ||
| 861 | + | ||
| 862 | + int br_time_remaining() | ||
| 863 | + | ||
| 864 | +* **parameters:** None | ||
| 865 | +* **output:** (int) Returns an estimate of the time remaining | ||
| 866 | +* **see:** [br_most_recent_message](#br_most_recent_message), [br_progress](#br_progress) | ||
| 867 | + | ||
| 868 | +--- | ||
| 869 | + | ||
| 870 | +## br_train | ||
| 871 | + | ||
| 872 | +Trains a provided model's [Transform](../cpp_api/transform/transform.md) and [Distance](../cpp_api/distance/distance.md) on the provided input. | ||
| 873 | + | ||
| 874 | +* **function definiton:** | ||
| 875 | + | ||
| 876 | + void br_train(const char *input, const char *model = "") | ||
| 877 | + | ||
| 878 | +* **parameters:** | ||
| 879 | + | ||
| 880 | + Parameter | Type | Description | ||
| 881 | + --- | --- | --- | ||
| 882 | + input | const char * | The [Gallery](../cpp_api/gallery/gallery.md) to train on. | ||
| 883 | + model | const char * | (Optional) String specifying the binary file to serialize training results to. The trained algorithm can be recovered by using this file as the algorithm. By default the trained algorithm will not be serialized to disk. | ||
| 884 | + | ||
| 885 | +* **output:** (void) | ||
| 886 | +* **see:** [br_train_n](#br_train_n) | ||
| 887 | + | ||
| 888 | +--- | ||
| 889 | + | ||
| 890 | +## br_train_n | ||
| 891 | + | ||
| 892 | +Convenience function for training on multiple inputs | ||
| 893 | + | ||
| 894 | +* **function definition:** | ||
| 895 | + | ||
| 896 | + void br_train_n(int num_inputs, const char *inputs[], const char *model = "") | ||
| 897 | + | ||
| 898 | +* **parameters:** | ||
| 899 | + | ||
| 900 | + Parameter | Type | Description | ||
| 901 | + --- | --- | --- | ||
| 902 | + num_inputs | int | Size of **inputs** | ||
| 903 | + inputs[] | const char * | An array of [galleries](../cpp_api/gallery/gallery.md) to train on. | ||
| 904 | + model | const char * | (Optional) String specifying the binary file to serialize training results to. The trained algorithm can be recovered by using this file as the algorithm. By default the trained algorithm will not be serialized to disk. | ||
| 905 | + | ||
| 906 | +* **output:** (void) | ||
| 907 | +* **see:** [br_train](#br_train) | ||
| 908 | + | ||
| 909 | +--- | ||
| 910 | + | ||
| 911 | +## br_version | ||
| 912 | + | ||
| 913 | +Get the current OpenBR version. | ||
| 914 | + | ||
| 915 | +* **function definition:** | ||
| 916 | + | ||
| 917 | + const char *br_version() | ||
| 918 | + | ||
| 919 | +* **parameters:** None | ||
| 920 | +* **output:** (const char *) Returns the current OpenBR version | ||
| 921 | +* **see:** [br_about](#br_about), [br_scratch_path](#br_scratch_path) | ||
| 922 | + | ||
| 923 | +--- | ||
| 924 | + | ||
| 925 | +## br_slave_process | ||
| 926 | + | ||
| 927 | +For internal use via [ProcessWrapperTransform](../../plugin_docs/core.md#processwrappertransform) | ||
| 928 | + | ||
| 929 | +* **function definition:** | ||
| 930 | + | ||
| 931 | + void br_slave_process(const char * baseKey) | ||
| 932 | + | ||
| 933 | +* **parameters:** | ||
| 934 | + | ||
| 935 | + Parameter | Type | Description | ||
| 936 | + --- | --- | --- | ||
| 937 | + baseKey | const char * | base key for the slave process | ||
| 938 | + | ||
| 939 | +* **output:** (void) | ||
| 940 | + | ||
| 941 | +--- | ||
| 942 | + | ||
| 943 | +## br_load_img | ||
| 944 | + | ||
| 945 | +Load an image from a string buffer. This is an easy way to pass an image in memory from another programming language to openbr. | ||
| 946 | + | ||
| 947 | +* **function definition:** | ||
| 948 | + | ||
| 949 | + br_template br_load_img(const char *data, int len) | ||
| 950 | + | ||
| 951 | +* **parameters:** | ||
| 952 | + | ||
| 953 | + Parameter | Type | Description | ||
| 954 | + --- | --- | --- | ||
| 955 | + data | const char * | The image buffer. | ||
| 956 | + len | int | The length of the buffer. | ||
| 957 | + | ||
| 958 | +* **output:** ([br_template](typedefs.md#br_template) Returns a [br_template](typedefs.md#br_template) loaded with the provided image | ||
| 959 | +* **see:** [br_unload_img](#br_unload_img) | ||
| 960 | + | ||
| 961 | +--- | ||
| 962 | + | ||
| 963 | +## br_unload_img | ||
| 964 | + | ||
| 965 | +Unload an image to a string buffer. This is an easy way to pass an image from openbr to another programming language. | ||
| 966 | + | ||
| 967 | +* **function definition:** | ||
| 968 | + | ||
| 969 | + unsigned char* br_unload_img(br_template tmpl) | ||
| 970 | + | ||
| 971 | +* **parameters:** | ||
| 972 | + | ||
| 973 | + Parameter | Type | Description | ||
| 974 | + --- | --- | --- | ||
| 975 | + tmpl | [br_template](typedefs.md#br_template) | Pointer to a [Template](../cpp_api/template/template.md) | ||
| 976 | + | ||
| 977 | +* **output:** (unsigned char*) Returns a buffer loaded with the image data from tmpl | ||
| 978 | +* **see:** [br_load_img](#br_load_img) | ||
| 979 | + | ||
| 980 | +--- | ||
| 981 | + | ||
| 982 | +## br_template_list_from_buffer | ||
| 983 | + | ||
| 984 | +Deserialize a [TemplateList](../cpp_api/templatelist/templatelist.md) from a buffer. Can be the buffer for a .gal file, since they are just a [TemplateList](../cpp_api/templatelist/templatelist.md) serialized to disk. | ||
| 985 | + | ||
| 986 | +* **function definition:** | ||
| 987 | + | ||
| 988 | + br_template_list br_template_list_from_buffer(const char *buf, int len) | ||
| 989 | + | ||
| 990 | +* **return type:** br_template_list | ||
| 991 | +* **parameters:** | ||
| 992 | + | ||
| 993 | +Parameter | Type | Description | ||
| 994 | +--- | --- | --- | ||
| 995 | +buf | const char * | The buffer. | ||
| 996 | +len | int | The length of the buffer. | ||
| 997 | + | ||
| 998 | +* **output:** ([br_template_list](typedefs.md#br_template_list)) Returns a pointer to a [TemplateList](../cpp_api/templatelist/templatelist.md) created from the buffer. | ||
| 999 | + | ||
| 1000 | +--- | ||
| 1001 | + | ||
| 1002 | +## br_free_template | ||
| 1003 | + | ||
| 1004 | +Free a [Template's](../cpp_api/template/template.md) memory. | ||
| 1005 | + | ||
| 1006 | +* **function definition:** | ||
| 1007 | + | ||
| 1008 | + void br_free_template(br_template tmpl) | ||
| 1009 | + | ||
| 1010 | +* **parameters:** | ||
| 1011 | + | ||
| 1012 | + Parameter | Type | Description | ||
| 1013 | + --- | --- | --- | ||
| 1014 | + tmpl | br_template | Pointer to the [Template](../cpp_api/template/template.md) to free. | ||
| 1015 | + | ||
| 1016 | +* **output:** (void) | ||
| 1017 | + | ||
| 1018 | +--- | ||
| 1019 | + | ||
| 1020 | +## br_free_template_list | ||
| 1021 | + | ||
| 1022 | +Free a [TemplateList's](../cpp_api/templatelist/templatelist.md) memory. | ||
| 1023 | + | ||
| 1024 | +* **function definition:** | ||
| 1025 | + | ||
| 1026 | + void br_free_template_list(br_template_list tl) | ||
| 1027 | + | ||
| 1028 | +* **parameters:** | ||
| 1029 | + | ||
| 1030 | + Parameter | Type | Description | ||
| 1031 | + --- | --- | --- | ||
| 1032 | + tl | [br_template_list](typedefs.md#br_template_list) | Pointer to the [TemplateList](../cpp_api/templatelist/templatelist.md) to free. | ||
| 1033 | + | ||
| 1034 | +* **output:** (void) | ||
| 1035 | + | ||
| 1036 | +--- | ||
| 1037 | + | ||
| 1038 | +## br_free_output | ||
| 1039 | + | ||
| 1040 | +Free a [Output's](../cpp_api/output/output.md) memory. | ||
| 1041 | + | ||
| 1042 | +* **function definition:** | ||
| 1043 | + | ||
| 1044 | + void br_free_output(br_matrix_output output) | ||
| 1045 | + | ||
| 1046 | +* **parameters:** | ||
| 1047 | + | ||
| 1048 | + Parameter | Type | Description | ||
| 1049 | + --- | --- | --- | ||
| 1050 | + output | [br_matrix_output](typedefs.md#br_matrix_output) | Pointer to the[Output](../cpp_api/output/output.md) to free. | ||
| 1051 | + | ||
| 1052 | +* **output:** (void) | ||
| 1053 | + | ||
| 1054 | +--- | ||
| 1055 | + | ||
| 1056 | +## br_img_rows | ||
| 1057 | + | ||
| 1058 | +Returns the number of rows in an image. | ||
| 1059 | + | ||
| 1060 | +* **function definition:** | ||
| 1061 | + | ||
| 1062 | + int br_img_rows(br_template tmpl) | ||
| 1063 | + | ||
| 1064 | +* **parameters:** | ||
| 1065 | + | ||
| 1066 | + Parameter | Type | Description | ||
| 1067 | + --- | --- | --- | ||
| 1068 | + tmpl | [br_template](typedefs.md#br_template) | Pointer to a [Template](../cpp_api/template/template.md). | ||
| 1069 | + | ||
| 1070 | +* **output:** (int) Returns the number of rows in an image | ||
| 1071 | + | ||
| 1072 | +--- | ||
| 1073 | + | ||
| 1074 | +## br_img_cols | ||
| 1075 | + | ||
| 1076 | +Returns the number of cols in an image. | ||
| 1077 | + | ||
| 1078 | +* **function definition:** | ||
| 1079 | + | ||
| 1080 | + int br_img_cols(br_template tmpl) | ||
| 1081 | + | ||
| 1082 | +* **parameters:** | ||
| 1083 | + | ||
| 1084 | + Parameter | Type | Description | ||
| 1085 | + --- | --- | --- | ||
| 1086 | + tmpl | [br_template](typedefs.md#br_template) | Pointer to a [Template](../cpp_api/template/template.md). | ||
| 1087 | + | ||
| 1088 | +* **output:** (int) Returns the number of columns in an image | ||
| 1089 | + | ||
| 1090 | +--- | ||
| 1091 | + | ||
| 1092 | +## br_img_channels | ||
| 1093 | + | ||
| 1094 | +Returns the number of channels in an image. | ||
| 1095 | + | ||
| 1096 | +* **function definition:** | ||
| 1097 | + | ||
| 1098 | + int br_img_channels(br_template tmpl) | ||
| 1099 | + | ||
| 1100 | +* **parameters:** | ||
| 1101 | + | ||
| 1102 | + Parameter | Type | Description | ||
| 1103 | + --- | --- | --- | ||
| 1104 | + tmpl | [br_template](typedefs.md#br_template) | Pointer to a [Template](../cpp_api/template/template.md). | ||
| 1105 | + | ||
| 1106 | +* **output:** (int) Returns the number of channels in an image | ||
| 1107 | + | ||
| 1108 | +--- | ||
| 1109 | + | ||
| 1110 | +## br_img_is_empty | ||
| 1111 | + | ||
| 1112 | +Checks if the image is empty. | ||
| 1113 | + | ||
| 1114 | +* **function definition:** | ||
| 1115 | + | ||
| 1116 | + bool br_img_is_empty(br_template tmpl) | ||
| 1117 | + | ||
| 1118 | +* **parameters:** | ||
| 1119 | + | ||
| 1120 | + Parameter | Type | Description | ||
| 1121 | + --- | --- | --- | ||
| 1122 | + tmpl | [br_template](typedefs.md#br_template) | Pointer to a [Template](../cpp_api/template/template.md). | ||
| 1123 | + | ||
| 1124 | +* **output:** (bool) Returns true if the image is empty, false otherwise. | ||
| 1125 | + | ||
| 1126 | +--- | ||
| 1127 | + | ||
| 1128 | +## br_get_filename | ||
| 1129 | + | ||
| 1130 | +Get the name of the [file](../cpp_api/template/members.md#file) of a provided [Template](../cpp_api/template/template.md). For information on input string buffers please see [here](../c_api.md#input-string-buffers) | ||
| 1131 | + | ||
| 1132 | +* **function definition:** | ||
| 1133 | + | ||
| 1134 | + int br_get_filename(char * buffer, int buffer_length, br_template tmpl) | ||
| 1135 | + | ||
| 1136 | +* **parameters:** | ||
| 1137 | + | ||
| 1138 | + Parameter | Type | Description | ||
| 1139 | + --- | --- | --- | ||
| 1140 | + buffer | char * | Buffer to hold the filename | ||
| 1141 | + buffer_length | int | Length of the buffer | ||
| 1142 | + tmpl | [br_template](typedefs.md#br_template) | Pointer to a [Template](../cpp_api/template/template.md). | ||
| 1143 | + | ||
| 1144 | +* **output:** (int) Returns the size of the buffer required to hold the entire file name. | ||
| 1145 | + | ||
| 1146 | +--- | ||
| 1147 | + | ||
| 1148 | +## br_set_filename | ||
| 1149 | + | ||
| 1150 | +Set the name of the [file](../cpp_api/template/members.md#file) for a provided [Template](../cpp_api/template/template.md). | ||
| 1151 | + | ||
| 1152 | +* **function definition:** | ||
| 1153 | + | ||
| 1154 | + void br_set_filename(br_template tmpl, const char *filename) | ||
| 1155 | + | ||
| 1156 | +* **parameters:** | ||
| 1157 | + | ||
| 1158 | + Parameter | Type | Description | ||
| 1159 | + --- | --- | --- | ||
| 1160 | + tmpl | [br_template](typedefs.md#br_template) | Pointer to a [Template](../cpp_api/template/template.md). | ||
| 1161 | + filename | const char * | New filename for the template. | ||
| 1162 | + | ||
| 1163 | +* **output:** (void) | ||
| 1164 | + | ||
| 1165 | +--- | ||
| 1166 | + | ||
| 1167 | +## br_get_metadata_string | ||
| 1168 | + | ||
| 1169 | +Get the [metadata](../cpp_api/file/members.md#m_metadata) value as a string for a provided key in a provided [Template](../cpp_api/template/template.md). | ||
| 1170 | + | ||
| 1171 | +* **function definition:** | ||
| 1172 | + | ||
| 1173 | + int br_get_metadata_string(char * buffer, int buffer_length, br_template tmpl, const char *key) | ||
| 1174 | + | ||
| 1175 | +* **parameters:** | ||
| 1176 | + | ||
| 1177 | + Parameter | Type | Description | ||
| 1178 | + --- | --- | --- | ||
| 1179 | + buffer | char * | Buffer to hold the metadata string. | ||
| 1180 | + buffer_length | int | length of the buffer. | ||
| 1181 | + tmpl | [br_template](typedefs.md#br_template) | Pointer to a [Template](../cpp_api/template/template.md). | ||
| 1182 | + key | const char * | Key for the metadata lookup | ||
| 1183 | + | ||
| 1184 | +* **output:** (int) Returns the size of the buffer required to hold the entire metadata string | ||
| 1185 | + | ||
| 1186 | +--- | ||
| 1187 | + | ||
| 1188 | +## br_enroll_template | ||
| 1189 | + | ||
| 1190 | +Enroll a [Template](../cpp_api/template/template.md) from the C API! | ||
| 1191 | + | ||
| 1192 | +* **function definition:** | ||
| 1193 | + | ||
| 1194 | + br_template_list br_enroll_template(br_template tmpl) | ||
| 1195 | + | ||
| 1196 | +* **parameters:** | ||
| 1197 | + | ||
| 1198 | + Parameter | Type | Description | ||
| 1199 | + --- | --- | --- | ||
| 1200 | + tmpl | br_template | Pointer to a [Template](../cpp_api/template/template.md). | ||
| 1201 | + | ||
| 1202 | +* **output:** ([br_template_list](typedefs.md#br_template_list)) Returns a pointer to a [TemplateList](../cpp_api/templatelist/templatelist.md) | ||
| 1203 | + | ||
| 1204 | +--- | ||
| 1205 | + | ||
| 1206 | +## br_enroll_template_list | ||
| 1207 | + | ||
| 1208 | +Enroll a [TemplateList](../cpp_api/templatelist/templatelist.md) from the C API! | ||
| 1209 | + | ||
| 1210 | +* **function definition:** | ||
| 1211 | + | ||
| 1212 | + void br_enroll_template_list(br_template_list tl) | ||
| 1213 | + | ||
| 1214 | +* **parameters:** | ||
| 1215 | + | ||
| 1216 | + Parameter | Type | Description | ||
| 1217 | + --- | --- | --- | ||
| 1218 | + tl | [br_template_list](typedefs.md#br_template_list) | Pointer to a [TemplateList](../cpp_api/templatelist/templatelist.md) | ||
| 1219 | + | ||
| 1220 | +* **output:** (void) | ||
| 1221 | + | ||
| 1222 | +--- | ||
| 1223 | + | ||
| 1224 | +## br_compare_template_lists | ||
| 1225 | + | ||
| 1226 | +Compare [TemplateLists](../cpp_api/templatelist/templatelist.md) from the C API! | ||
| 1227 | + | ||
| 1228 | +* **function definition:** | ||
| 1229 | + | ||
| 1230 | + br_matrix_output br_compare_template_lists(br_template_list target, br_template_list query) | ||
| 1231 | + | ||
| 1232 | +* **parameters:** | ||
| 1233 | + | ||
| 1234 | + Parameter | Type | Description | ||
| 1235 | + --- | --- | --- | ||
| 1236 | + target | br_template_list | Pointer to a [TemplateList](../cpp_api/templatelist/templatelist.md) | ||
| 1237 | + query | br_template_list | Pointer to a [TemplateList](../cpp_api/templatelist/templatelist.md) | ||
| 1238 | + | ||
| 1239 | + | ||
| 1240 | +* **output:** ([br_matrix_output](typedefs.md#br_matrix_output)) Returns a pointer to a [MatrixOutput](../cpp_api/matrixoutput/matrixoutput.md) | ||
| 1241 | + | ||
| 1242 | +--- | ||
| 1243 | + | ||
| 1244 | +## br_get_matrix_output_at | ||
| 1245 | + | ||
| 1246 | +Get a value in a provided [MatrixOutput](../cpp_api/matrixoutput/matrixoutput.md). | ||
| 1247 | + | ||
| 1248 | +* **function definition:** | ||
| 1249 | + | ||
| 1250 | + float br_get_matrix_output_at(br_matrix_output output, int row, int col) | ||
| 1251 | + | ||
| 1252 | +* **parameters:** | ||
| 1253 | + | ||
| 1254 | + Parameter | Type | Description | ||
| 1255 | + --- | --- | --- | ||
| 1256 | + output | br_matrix_output | Pointer to [MatrixOutput](../cpp_api/matrixoutput/matrixoutput.md) | ||
| 1257 | + row | int | Row index for lookup | ||
| 1258 | + col | int | Column index for lookup | ||
| 1259 | + | ||
| 1260 | +* **output:** (float) Returns the value of the [MatrixOutput](../cpp_api/matrixoutput/matrixoutput.md) at the provided indexes. | ||
| 1261 | + | ||
| 1262 | +--- | ||
| 1263 | + | ||
| 1264 | +## br_get_template | ||
| 1265 | + | ||
| 1266 | +Get a [Template](../cpp_api/template/template.md) from a [TemplateList](../cpp_api/templatelist/templatelist.md) at a specified index. | ||
| 1267 | + | ||
| 1268 | +* **function definition:** | ||
| 1269 | + | ||
| 1270 | + br_template br_get_template(br_template_list tl, int index) | ||
| 1271 | + | ||
| 1272 | +* **parameters:** | ||
| 1273 | + | ||
| 1274 | + Parameter | Type | Description | ||
| 1275 | + --- | --- | --- | ||
| 1276 | + tl | [br_template_list](typedefs.md#br_template_list) | Pointer to a [TemplateList](../cpp_api/templatelist/templatelist.md) | ||
| 1277 | + index | int | Index into the template list. Should be in the range [0,len(tl) - 1]. | ||
| 1278 | + | ||
| 1279 | +* **output:** ([br_template](typedefs.md#br_template)) Returns a pointer to a [Template](../cpp_api/template/template.md) | ||
| 1280 | + | ||
| 1281 | +--- | ||
| 1282 | + | ||
| 1283 | +## br_num_templates | ||
| 1284 | + | ||
| 1285 | +Get the number of [Templates](../cpp_api/template/template.md) in a [TemplateList](../cpp_api/templatelist/templatelist.md). | ||
| 1286 | + | ||
| 1287 | +* **function definition:** | ||
| 1288 | + | ||
| 1289 | + int br_num_templates(br_template_list tl) | ||
| 1290 | + | ||
| 1291 | +* **parameters:** | ||
| 1292 | + | ||
| 1293 | + Parameter | Type | Description | ||
| 1294 | + --- | --- | --- | ||
| 1295 | + tl | [br_template_list](typedefs.md#br_template_list) | Pointer to a [TemplateList](../cpp_api/templatelist/templatelist.md) | ||
| 1296 | + | ||
| 1297 | +* **output:** (int) Returns the size of the provided [TemplateList](../cpp_api/templatelist/templatelist.md) | ||
| 1298 | + | ||
| 1299 | +--- | ||
| 1300 | + | ||
| 1301 | +## br_make_gallery | ||
| 1302 | + | ||
| 1303 | +Initialize a [Gallery](../cpp_api/gallery/gallery.md) from a file. | ||
| 1304 | + | ||
| 1305 | +* **function definition:** | ||
| 1306 | + | ||
| 1307 | + br_gallery br_make_gallery(const char *gallery) | ||
| 1308 | + | ||
| 1309 | +* **parameters:** | ||
| 1310 | + | ||
| 1311 | + Parameter | Type | Description | ||
| 1312 | + --- | --- | --- | ||
| 1313 | + gallery | const char * | String location of gallery on disk. | ||
| 1314 | + | ||
| 1315 | +* **output:** ([br_gallery](typedefs.md#br_gallery)) Returns a pointer to a [Gallery](../cpp_api/gallery/gallery.md) that has been created from the provided file | ||
| 1316 | + | ||
| 1317 | +--- | ||
| 1318 | + | ||
| 1319 | +## br_load_from_gallery | ||
| 1320 | + | ||
| 1321 | +Read a [TemplateList](../cpp_api/templatelist/templatelist.md) from a [Gallery](../cpp_api/gallery/gallery.md). | ||
| 1322 | + | ||
| 1323 | +* **function definition:** | ||
| 1324 | + | ||
| 1325 | + br_template_list br_load_from_gallery(br_gallery gallery) | ||
| 1326 | + | ||
| 1327 | +* **parameters:** | ||
| 1328 | + | ||
| 1329 | + Parameter | Type | Description | ||
| 1330 | + --- | --- | --- | ||
| 1331 | + gallery | [br_gallery](typedefs.md#br_gallery) | Pointer to a [Gallery](../cpp_api/gallery/gallery.md) | ||
| 1332 | + | ||
| 1333 | +* **output:** ([br_template_list](typedefs.md#br_template_list)) Returns a pointer to a [TemplateList](../cpp_api/templatelist/templatelist.md) containing the data from the provided [Gallery](../cpp_api/gallery/gallery.md) | ||
| 1334 | + | ||
| 1335 | +--- | ||
| 1336 | + | ||
| 1337 | +## br_add_template_to_gallery | ||
| 1338 | + | ||
| 1339 | +Write a [Template](../cpp_api/template/template.md) to a [Gallery](../cpp_api/gallery/gallery.md) | ||
| 1340 | + | ||
| 1341 | +* **function definition:** | ||
| 1342 | + | ||
| 1343 | + void br_add_template_to_gallery(br_gallery gallery, br_template tmpl) | ||
| 1344 | + | ||
| 1345 | +* **parameters:** | ||
| 1346 | + | ||
| 1347 | + Parameter | Type | Description | ||
| 1348 | + --- | --- | --- | ||
| 1349 | + gallery | [br_gallery](typedefs.md#br_gallery) | Pointer to a [Gallery](../cpp_api/gallery/gallery.md) | ||
| 1350 | + tmpl | [br_template](typedefs.md#br_template) | Pointer to a [Template](../cpp_api/template/template.md) | ||
| 1351 | + | ||
| 1352 | +* **output:** (void) | ||
| 1353 | + | ||
| 1354 | +--- | ||
| 1355 | + | ||
| 1356 | +## br_add_template_list_to_gallery | ||
| 1357 | + | ||
| 1358 | +Write a [TemplateList](../cpp_api/templatelist/templatelist.md) to the [Gallery](../cpp_api/gallery/gallery.md) on disk. | ||
| 1359 | + | ||
| 1360 | +* **function definition:** | ||
| 1361 | + | ||
| 1362 | + void br_add_template_list_to_gallery(br_gallery gallery, br_template_list tl) | ||
| 1363 | + | ||
| 1364 | +* **parameters:** | ||
| 1365 | + | ||
| 1366 | + Parameter | Type | Description | ||
| 1367 | + --- | --- | --- | ||
| 1368 | + gallery | [br_gallery](typedefs.md#br_gallery) | Pointer to a [Gallery](../cpp_api/gallery/gallery.md) | ||
| 1369 | + tl | [br_template_list](typedefs.md#br_template_list) | Pointer to a [TemplateList](../cpp_api/templatelist/templatelist.md) | ||
| 1370 | + | ||
| 1371 | +* **output:** (void) | ||
| 1372 | + | ||
| 1373 | +--- | ||
| 1374 | + | ||
| 1375 | +## br_close_gallery | ||
| 1376 | + | ||
| 1377 | +Close a provided [Gallery](../cpp_api/gallery/gallery.md). | ||
| 1378 | + | ||
| 1379 | +* **function definition:** | ||
| 1380 | + | ||
| 1381 | + void br_close_gallery(br_gallery gallery) | ||
| 1382 | + | ||
| 1383 | +* **parameters:** | ||
| 1384 | + | ||
| 1385 | + Parameter | Type | Description | ||
| 1386 | + --- | --- | --- | ||
| 1387 | + gallery | [br_gallery](typedefs.md#br_gallery) | Pointer to a [Gallery](../cpp_api/gallery/gallery.md) | ||
| 1388 | + | ||
| 1389 | +* **output:** (void) | ||
| 1390 | + | ||
| 1391 | +[^1]: *Zhu et al.* | ||
| 1392 | + **A Rank-Order Distance based Clustering Algorithm for Face Tagging**, | ||
| 1393 | + CVPR 2011 | ||
| 1394 | + | ||
| 1395 | +<!-- Links --> | ||
| 1396 | +[R]: http://www.r-project.org/ "R" | ||
| 1397 | +[QRegExp]: http://doc.qt.io/qt-5/QRegExp.html "QRegExp" |
docs/docs/api_docs/c_api/typedefs.md
0 → 100644
docs/docs/api_docs/cl_api.md
0 → 100644
| 1 | +The command line API is a tool to run OpenBR from the command line. The command line is the easiest and fastest way to run OpenBR! | ||
| 2 | + | ||
| 3 | +The following is a detailed description of the command line API. The command line API is really just a set of wrappers to call the [C API](c_api.md). All of the flags in this API have a corresponding C API call. To help display the examples the following shorthand definitions will be used: | ||
| 4 | + | ||
| 5 | +Shortcut | Definition | ||
| 6 | +--- | --- | ||
| 7 | +<arg> | <> Represent an input argument | ||
| 8 | +\{arg\} | \{\} Represent an output argument | ||
| 9 | +[arg] | [] Represent an optional argument | ||
| 10 | +(arg0 | ... | argN) | (... | ...) Represent a choice. | ||
| 11 | + | ||
| 12 | +## Algorithms | ||
| 13 | + | ||
| 14 | +Almost every command line process needs to specify an algorithm to work properly. Algorithms in OpenBR are described in detail [here](../tutorials.md#algorithms-in-openbr). To specify algorithms to the command line use the <tt>-algorithm</tt> flag like so: | ||
| 15 | + | ||
| 16 | + -algorithm "AlgorithmString" | ||
| 17 | + | ||
| 18 | +Make sure you use the quotes if your algorithm is longer than one plugin because special characters in OpenBR are also special characters (with very different meanings!) in Bash. | ||
| 19 | + | ||
| 20 | +## Core Commands | ||
| 21 | + | ||
| 22 | +### -train {: #train } | ||
| 23 | + | ||
| 24 | +Train a model | ||
| 25 | + | ||
| 26 | +* **arguments:** | ||
| 27 | + | ||
| 28 | + -train <gallery> ... <gallery> [{model}] | ||
| 29 | + | ||
| 30 | +* **wraps:** [br_train_n](c_api/functions.md#br_train_n) | ||
| 31 | + | ||
| 32 | +### -enroll {: #enroll } | ||
| 33 | + | ||
| 34 | +Enroll a [Gallery](cpp_api/gallery/gallery.md) through an algorithm | ||
| 35 | + | ||
| 36 | +* **arguments:** | ||
| 37 | + | ||
| 38 | + -enroll <input_gallery> ... <input_gallery> {output_gallery} | ||
| 39 | + | ||
| 40 | +* **wraps:** [br_enroll](c_api/functions.md#br_enroll) or [br_enroll_n](c_api/functions.md#br_enroll_n) depending on the input size | ||
| 41 | + | ||
| 42 | +### -compare {: #compare } | ||
| 43 | + | ||
| 44 | +Compare query [Templates](cpp_api/template/template.md) against a target [Gallery](cpp_api/gallery/gallery.md) | ||
| 45 | + | ||
| 46 | +* **arguments:** | ||
| 47 | + | ||
| 48 | + -compare <target_gallery> <query_gallery> [{output}] | ||
| 49 | + | ||
| 50 | +* **wraps:** [br_compare](c_api/functions.md#br_compare) | ||
| 51 | + | ||
| 52 | +### -pairwiseCompare {: #pairwisecompare } | ||
| 53 | + | ||
| 54 | +DOCUMENT ME | ||
| 55 | + | ||
| 56 | +* **arguments:** | ||
| 57 | + | ||
| 58 | + -pairwiseCompare <target_gallery> <query_gallery> [{output}] | ||
| 59 | + | ||
| 60 | +* **wraps:** [br_pairwise_compare](c_api/functions.md#br_pairwise_compare) | ||
| 61 | + | ||
| 62 | +### -eval {: #eval } | ||
| 63 | + | ||
| 64 | +Evaluate a similarity matrix | ||
| 65 | + | ||
| 66 | +* **arguments:** | ||
| 67 | + | ||
| 68 | + -eval <simmat> [<mask>] [{csv}] [{matches}] | ||
| 69 | + | ||
| 70 | +* **wraps:** [br_eval](c_api/functions.md#br_eval) | ||
| 71 | + | ||
| 72 | +### -inplaceEval {: #inplaceeval } | ||
| 73 | + | ||
| 74 | +DOCUMENT ME | ||
| 75 | + | ||
| 76 | +* **arguments:** | ||
| 77 | + | ||
| 78 | + -inplaceEval <simmat> <target> <query> [{output}] | ||
| 79 | + | ||
| 80 | +* **wraps:** [br_inplace_eval](c_api/functions.md#br_inplace_eval) | ||
| 81 | + | ||
| 82 | +### -plot {: #inplaceeval} | ||
| 83 | + | ||
| 84 | +Plot the results of an evaluation | ||
| 85 | + | ||
| 86 | +* **arguments:** | ||
| 87 | + | ||
| 88 | + -plot <file> ... <file> {destination} | ||
| 89 | + | ||
| 90 | +* **wraps:** [br_plot](c_api/functions.md#br_plot) | ||
| 91 | + | ||
| 92 | + | ||
| 93 | +## Other Commands | ||
| 94 | + | ||
| 95 | +### -fuse {: #fuse } | ||
| 96 | + | ||
| 97 | +Perform score level fusion on similarity matrices. | ||
| 98 | + | ||
| 99 | +* **arguments:** | ||
| 100 | + | ||
| 101 | + -fuse <simmat> ... <simmat> (None|MinMax|ZScore|WScore) (Min|Max|Sum[W1:W2:...:Wn]|Replace|Difference|None) {simmat} | ||
| 102 | + | ||
| 103 | +* **wraps:** [br_fuse](c_api/functions.md#br_fuse) | ||
| 104 | + | ||
| 105 | +### -cluster {: #cluster } | ||
| 106 | + | ||
| 107 | +Clusters one or more similarity matrices into a list of subjects | ||
| 108 | + | ||
| 109 | +* **arguments:** | ||
| 110 | + | ||
| 111 | + -cluster <simmat> ... <simmat> <aggressiveness> {csv} | ||
| 112 | + | ||
| 113 | +* **wraps:** [br_cluster](c_api/functions.md#br_cluster) | ||
| 114 | + | ||
| 115 | +### -makeMask {: #makemask } | ||
| 116 | + | ||
| 117 | +Constructs a mask from target and query inputs | ||
| 118 | + | ||
| 119 | +* **arguments:** | ||
| 120 | + | ||
| 121 | + -makeMask <target_gallery> <query_gallery> {mask} | ||
| 122 | + | ||
| 123 | +* **wraps:** [br_make_mask](c_api/functions.md#br_make_mask) | ||
| 124 | + | ||
| 125 | +### -makePairwiseMask {: #makepairwisemask } | ||
| 126 | + | ||
| 127 | +Constructs a mask from target and query inputs considering the target and input sets to be definite pairwise comparisons. | ||
| 128 | + | ||
| 129 | +* **arguments:** | ||
| 130 | + | ||
| 131 | + -makePairwiseMask <target_gallery> <query_gallery> {mask} | ||
| 132 | + | ||
| 133 | +* **wraps:** [br_make_pairwise_mask](c_api/functions.md#br_make_pairwise_mask) | ||
| 134 | + | ||
| 135 | +### -combineMasks {: #combinemask } | ||
| 136 | + | ||
| 137 | +Combines several equal-sized mask matrices. A comparison may not be simultaneously indentified as both a genuine and an imposter by different input masks. | ||
| 138 | + | ||
| 139 | +* **arguments:** | ||
| 140 | + | ||
| 141 | + -combineMasks <mask> ... <mask> {mask} (And|Or) | ||
| 142 | + | ||
| 143 | +* **wraps:** [br_combine_masks](c_api/functions.md#br_combine_masks) | ||
| 144 | + | ||
| 145 | +### -cat {: #cat } | ||
| 146 | + | ||
| 147 | +Concatenates a list of galleries into 1 gallery | ||
| 148 | + | ||
| 149 | +* **arguments:** | ||
| 150 | + | ||
| 151 | + -cat <gallery> ... <gallery> {gallery} | ||
| 152 | + | ||
| 153 | +* **wraps:** [br_cat](c_api/functions.md#br_cat) | ||
| 154 | + | ||
| 155 | +### -convert {: #convert } | ||
| 156 | + | ||
| 157 | +Convert a file to a different type. Files can only be converted to types within the same group. For example formats can only be converted to other formats. | ||
| 158 | + | ||
| 159 | +* **arguments:** | ||
| 160 | + | ||
| 161 | + -convert (Format|Gallery|Output) <input_file> {output_file} | ||
| 162 | + | ||
| 163 | +* **wraps:** [br_convert](c_api/functions.md#br_convert) | ||
| 164 | + | ||
| 165 | +### -evalClassification {: #evalclassification } | ||
| 166 | + | ||
| 167 | +Evaluates and prints classification accuracy to terminal | ||
| 168 | + | ||
| 169 | +* **arguments:** | ||
| 170 | + | ||
| 171 | + -evalClassification <predicted_gallery> <truth_gallery> <predicted property name> <ground truth property name> | ||
| 172 | + | ||
| 173 | +* **wraps:** [br_eval_classification](c_api/functions.md#br_eval_classification) | ||
| 174 | + | ||
| 175 | +### -evalClustering {: #evalclustering } | ||
| 176 | + | ||
| 177 | +Evaluates and prints clustering accuracy to the terminal | ||
| 178 | + | ||
| 179 | +* **arguments:** | ||
| 180 | + | ||
| 181 | + -evalClustering <clusters> <gallery> | ||
| 182 | + | ||
| 183 | +* **wraps:** [br_eval_clustering](c_api/functions.md#br_eval_clustering) | ||
| 184 | + | ||
| 185 | +### -evalDetection {: #evaldetection } | ||
| 186 | + | ||
| 187 | +Evaluates and prints detection accuracy to terminal | ||
| 188 | + | ||
| 189 | +* **arguments:** | ||
| 190 | + | ||
| 191 | + -evalDetection <predicted_gallery> <truth_gallery> [{csv}] [{normalize}] [{minSize}] [{maxSize}] | ||
| 192 | + | ||
| 193 | +* **wraps:** [br_eval_detection](c_api/functions.md#br_eval_detection) | ||
| 194 | + | ||
| 195 | +### -evalLandmarking {: #evallandmarking } | ||
| 196 | + | ||
| 197 | +Evaluates and prints landmarking accuracy to terminal | ||
| 198 | + | ||
| 199 | +* **arguments:** | ||
| 200 | + | ||
| 201 | + -evalLandmarking <predicted_gallery> <truth_gallery> [{csv} [<normalization_index_a> <normalization_index_b>] [sample_index] [total_examples]] | ||
| 202 | + | ||
| 203 | +* **wraps:** [br_eval_landmarking](c_api/functions.md#br_eval_landmarking) | ||
| 204 | + | ||
| 205 | + | ||
| 206 | +### -evalRegression {: #evalregression } | ||
| 207 | + | ||
| 208 | +Evaluates regression accuracy to disk | ||
| 209 | + | ||
| 210 | +* **arguments:** | ||
| 211 | + | ||
| 212 | + -evalRegression <predicted_gallery> <truth_gallery> <predicted property name> <ground truth property name> | ||
| 213 | + | ||
| 214 | +* **wraps:** [br_eval_regression](c_api/functions.md#br_eval_regression) | ||
| 215 | + | ||
| 216 | +### -assertEval {: #asserteval } | ||
| 217 | + | ||
| 218 | +Evaluates the similarity matrix using the mask matrix. Function aborts if TAR @ FAR = 0.001 does not meet an expected performance value. | ||
| 219 | + | ||
| 220 | +* **arguments:** | ||
| 221 | + | ||
| 222 | + -assertEval <simmat> <mask> <accuracy> | ||
| 223 | + | ||
| 224 | +* **wraps:** [br_assert_eval](c_api/functions.md#br_assert_eval) | ||
| 225 | + | ||
| 226 | +### -plotDetection {: #plotdetection } | ||
| 227 | + | ||
| 228 | +Renders detection performance figures for a set of .csv files created by [-evalDetection](#evaldetection). | ||
| 229 | + | ||
| 230 | +* **arguments:** | ||
| 231 | + | ||
| 232 | + -plotDetection <file> ... <file> {destination} | ||
| 233 | + | ||
| 234 | +* **wraps:** [br_plot_detection](c_api/functions.md#br_plot_detection) | ||
| 235 | + | ||
| 236 | +### -plotLandmarking {: #plotlandmarking } | ||
| 237 | + | ||
| 238 | +Renders landmarking performance figures for a set of .csv files created by [-evalLandmarking](#evallandmarking) | ||
| 239 | + | ||
| 240 | +* **arguments:** | ||
| 241 | + | ||
| 242 | + -plotLandmarking <file> ... <file> {destination} | ||
| 243 | + | ||
| 244 | +* **wraps:** [br_plot_landmarking](c_api/functions.md#br_plot_landmarking) | ||
| 245 | + | ||
| 246 | +### -plotMetadata {: #plotmetadata } | ||
| 247 | + | ||
| 248 | +Renders metadata figures for a set of .csv files with specified columns | ||
| 249 | + | ||
| 250 | +* **arguments:** | ||
| 251 | + | ||
| 252 | + -plotMetadata <file> ... <file> <columns> | ||
| 253 | + | ||
| 254 | +* **wraps:** [br_plot_metadata](c_api/functions.md#br_plot_metadata) | ||
| 255 | + | ||
| 256 | +### -project {: #project } | ||
| 257 | + | ||
| 258 | +A naive alternative to [-enroll](#enroll) | ||
| 259 | + | ||
| 260 | +* **arguments:** | ||
| 261 | + | ||
| 262 | + -project <input_gallery> {output_gallery} | ||
| 263 | + | ||
| 264 | +* **wraps:** [br_project](c_api/functions.md#br_project) | ||
| 265 | + | ||
| 266 | +### -getHeader {: #getheader } | ||
| 267 | + | ||
| 268 | +Retrieve the target and query inputs in the [BEE matrix](../tutorials.md#the-evaluation-harness) header | ||
| 269 | + | ||
| 270 | +* **arguments:** | ||
| 271 | + | ||
| 272 | + -getHeader <matrix> | ||
| 273 | + | ||
| 274 | +* **wraps:** [br_get_header](c_api/functions.md#br_get_header) | ||
| 275 | + | ||
| 276 | +### -setHeader {: #setheader } | ||
| 277 | + | ||
| 278 | +Update the target and query inputs in the [BEE matrix](../tutorials.md#the-evaluation-harness) header | ||
| 279 | + | ||
| 280 | +* **arguments:** | ||
| 281 | + | ||
| 282 | + -setHeader {<matrix>} <target_gallery> <query_gallery> | ||
| 283 | + | ||
| 284 | +* **wraps:** [br_set_header](c_api/functions.md#br_set_header) | ||
| 285 | + | ||
| 286 | +### -<key> <value> {: #setproperty } | ||
| 287 | + | ||
| 288 | +Appends a provided value to the [global metadata](cpp_api/context/context.md) using a provided key | ||
| 289 | + | ||
| 290 | +* **arguments:** | ||
| 291 | + | ||
| 292 | + -<key> <value> | ||
| 293 | + | ||
| 294 | +* **wraps:** [br_set_property](c_api/functions.md#br_set_property) | ||
| 295 | + | ||
| 296 | + | ||
| 297 | +## Miscellaneous | ||
| 298 | + | ||
| 299 | +### -help {: #help } | ||
| 300 | + | ||
| 301 | +Print command line API documentation to the terminal | ||
| 302 | + | ||
| 303 | +* **arguments:** | ||
| 304 | + | ||
| 305 | + -help | ||
| 306 | + | ||
| 307 | +* **wraps:** N/A | ||
| 308 | + | ||
| 309 | +### -gui {: #gui } | ||
| 310 | + | ||
| 311 | +If this flag is set OpenBR will enable GUI windows to be launched. It must be the first flag set. | ||
| 312 | + | ||
| 313 | +* **arguments:** | ||
| 314 | + | ||
| 315 | + br -gui | ||
| 316 | + | ||
| 317 | +* **wraps:** N/A | ||
| 318 | + | ||
| 319 | +### -objects {: #objects } | ||
| 320 | + | ||
| 321 | +Returns names and parameters for the requested objects. Each object is newline separated. Arguments are separated from the object name with a tab. This function uses [QRegExp][QRegExp] syntax | ||
| 322 | + | ||
| 323 | +* **arguments:** | ||
| 324 | + | ||
| 325 | + -objects [abstraction [implementation]] | ||
| 326 | + | ||
| 327 | +* **wraps:** [br_objects](c_api/functions.md#br_objects) | ||
| 328 | + | ||
| 329 | +### -about {: #about } | ||
| 330 | + | ||
| 331 | +Get a string with the name, version, and copyright of the project. This string is suitable for printing or terminal | ||
| 332 | + | ||
| 333 | +* **arguments:** | ||
| 334 | + | ||
| 335 | + -about | ||
| 336 | + | ||
| 337 | +* **wraps:** [br_about](c_api/functions.md#br_about) | ||
| 338 | + | ||
| 339 | +### -version {: #version } | ||
| 340 | + | ||
| 341 | +Get the current OpenBR version | ||
| 342 | + | ||
| 343 | +* **arguments:** | ||
| 344 | + | ||
| 345 | + -version | ||
| 346 | + | ||
| 347 | +* **wraps:** [br_version](c_api/functions.md#br_version) | ||
| 348 | + | ||
| 349 | +### -slave {: #slave } | ||
| 350 | + | ||
| 351 | +For internal use via [ProcessWrapperTransform](../plugin_docs/core.md#processwrappertransform) | ||
| 352 | + | ||
| 353 | +* **arguments:** | ||
| 354 | + | ||
| 355 | + -slave <baseKey> | ||
| 356 | + | ||
| 357 | +* **wraps:** [br_slave_process](c_api/functions.md#br_slave_process) | ||
| 358 | + | ||
| 359 | +### -daemon {: #daemon } | ||
| 360 | + | ||
| 361 | +DOCUMENT ME | ||
| 362 | + | ||
| 363 | +* **arguments:** | ||
| 364 | + | ||
| 365 | + -daemon <daemon_pipe> | ||
| 366 | + | ||
| 367 | +* **wraps:** N/A | ||
| 368 | + | ||
| 369 | +### -exit | ||
| 370 | + | ||
| 371 | +Exit the application | ||
| 372 | + | ||
| 373 | +* **arguments:** | ||
| 374 | + | ||
| 375 | + -exit | ||
| 376 | + | ||
| 377 | +* **wraps:** N/A | ||
| 378 | + | ||
| 379 | +<!-- Link --> | ||
| 380 | +[QRegExp]: http://doc.qt.io/qt-5/QRegExp.html "QRegExp" |
docs/docs/api_docs/cpp_api.md
0 → 100644
| 1 | +# C++ Plugin API | ||
| 2 | + | ||
| 3 | +The C++ Plugin API is a pluggable API designed to allow the succinct expression of biometrics algorithms as a series of independent plugins. The API exposes a number of data structures and plugin abstractions to use as simple building blocks for complex algorithms. | ||
| 4 | + | ||
| 5 | +## Data Structures | ||
| 6 | + | ||
| 7 | +The API defines two data structures: | ||
| 8 | + | ||
| 9 | +* [File](cpp_api/file/file.md)s are typically used to store the path to a file on disk with associated metadata (in the form of key-value pairs). In the example above, we store the rectangles detected by [Cascade](../plugin_docs/metadata.md#cascadetransform) as metadata which are then used by [Draw](../plugin_docs/gui.md#drawtransform) for visualization. | ||
| 10 | +* [Template](cpp_api/template/template.md)s are containers for images and [File](cpp_api/file/file.md)s. Images in OpenBR are OpenCV Mats and are member variables of Templates. Templates can contain one or more images. | ||
| 11 | + | ||
| 12 | +## Plugin Abstractions | ||
| 13 | + | ||
| 14 | +A plugin in OpenBR is defined as *classes which modify, interpret, or assist with the modification of OpenBR compatible images and/or metadata*. All OpenBR plugins have a common ancestor, [Object](cpp_api/object/object.md), and they all are constructed from string descriptions given by [Files](cpp_api/file/file.md). There are eight base abstractions that derive from [Object](cpp_api/object/object.md), one of which should be the parent for all production plugins. They are: | ||
| 15 | + | ||
| 16 | +Plugin | Function | ||
| 17 | +--- | --- | ||
| 18 | +[Initializer](cpp_api/initializer/initializer.md) | Initializes shared contexts and variables at the launch of OpenBR. Typically used with third-party plugins. | ||
| 19 | +[Transform](cpp_api/transform/transform.md) | The most common plugin type in OpenBR. Provides the basis for algorithms by transforming images or metadata. | ||
| 20 | +[Distance](cpp_api/distance/distance.md) | Used to compute a distance metric between [Template](cpp_api/template/template.md)s. | ||
| 21 | +[Format](cpp_api/format/format.md) | Used for I/O. Formats handle file types that correspond to single objects (e.g. .jpg, .png, etc.). | ||
| 22 | +[Gallery](cpp_api/gallery/gallery.md) | Used for I/O. Galleries handle file types that correspond to many objects (e.g. .csv., .xml, etc.). | ||
| 23 | +[Output](cpp_api/output/output.md) | Used for I/O. Outputs handle the results of [Distance](cpp_api/distance/distance.md) comparisons. | ||
| 24 | +[Representation](cpp_api/representation/representation.md) | Converts images into feature vectors. Slightly different then [Transform](cpp_api/transform/transform.md)s in implementation and available API calls. | ||
| 25 | +[Classifier](cpp_api/classifier/classifier.md) | Classifies feature vectors as members of specific classes or performs regression on them. | ||
| 26 | + | ||
| 27 | + Additionally, there are several child-abstractions for specific use cases. A few examples are: | ||
| 28 | + | ||
| 29 | + Plugin | Parent | Function | ||
| 30 | + --- | --- | --- | ||
| 31 | + [UntrainableTransform](cpp_api/untrainabletransform/untrainabletransform.md) | [Transform](cpp_api/transform/transform.md) | A [Transform](cpp_api/transform/transform.md) that cannot be trained. | ||
| 32 | + [MetaTransform](cpp_api/metatransform/metatransform.md) | [Transform](cpp_api/transform/transform.md) | A [Transform](cpp_api/transform/transform.md) that is *not* [independent](cpp_api/transform/members.md#independent). | ||
| 33 | + [UntrainableMetaTransform](cpp_api/untrainablemetatransform/untrainablemetatransform.md) | [UntrainableTransform](cpp_api/untrainabletransform/untrainabletransform.md) | A [Transform](cpp_api/transform/transform.md) that is *not* [independent](cpp_api/transform/members.md#independent) and cannot be trained. | ||
| 34 | + [MetadataTransform](cpp_api/metadatatransform/metadatatransform.md) | [Transform](cpp_api/transform/transform.md) | A [Transform](cpp_api/transform/transform.md) that operates only on [Template](cpp_api/template/template.md) [metadata](cpp_api/template/members.md#file). | ||
| 35 | + [TimeVaryingTransform](cpp_api/timevaryingtransform/timevaryingtransform.md) | [Transform](cpp_api/transform/transform.md) | A [Transform](cpp_api/transform/transform.md) that changes at runtime as a result of the input. | ||
| 36 | + [UntrainableDistance](cpp_api/untrainabledistance/untrainabledistance.md) | [Distance](cpp_api/distance/distance.md) | A [Distance](cpp_api/distance/distance.md) that cannot be trained. | ||
| 37 | + [MatrixOutput](cpp_api/matrixoutput/matrixoutput.md) | [Output](cpp_api/output/output.md) | A [Output](cpp_api/output/output.md) that outputs data as a matrix. | ||
| 38 | + | ||
| 39 | + As previously mentioned, all plugins in OpenBR are constructed using strings stored as [Files](cpp_api/file/file.md). The construction is done at runtime by a [Factory](cpp_api/factory/factory.md) class[^1]. The [Factory](cpp_api/factory/factory.md) expects strings of the form `PluginName(property1=value1,property2=value2...propertyN=valueN)` (value lists are also permitted). It looks up the `PluginName` in a static registry and builds the plugin if found. The registry is populated using a special macro [BR_REGISTER](cpp_api/factory/macros.md#br_register); each plugin needs to register itself and its base abstraction in the factory to enable construction. The purpose of this is to allow algorithms to be described completely by strings. For more information on algorithms in OpenBR please see the [tutorial](../tutorials.md#algorithms-in-openbr) | ||
| 40 | + | ||
| 41 | +[^1]: [Industrial Strength Pluggable Factories](https://adtmag.com/articles/2000/09/25/industrial-strength-pluggable-factories.aspx) |
docs/docs/api_docs/cpp_api/apifunctions.md
0 → 100644
| 1 | +<!-- API FUNCTIONS --> | ||
| 2 | + | ||
| 3 | +## IsClassifier {: #isclassifier } | ||
| 4 | + | ||
| 5 | +Determines if the given algorithm is a classifier. A classifier is defined as a [Transform](transform/transform.md) with no associated [Distance](distance/distance.md). Instead metadata fields with the predicted output classes are populated in [Template](template/template.md) [files](template/members.md#file). | ||
| 6 | + | ||
| 7 | +* **function definition:** | ||
| 8 | + | ||
| 9 | + bool IsClassifier(const QString &algorithm) | ||
| 10 | + | ||
| 11 | +* **parameters:** | ||
| 12 | + | ||
| 13 | + Parameter | Type | Description | ||
| 14 | + --- | --- | --- | ||
| 15 | + algorithm | const [QString][QString] & | Algorithm to evaluate | ||
| 16 | + | ||
| 17 | +* **output:** (bool) True if the algorithm is a classifier and false otherwise | ||
| 18 | +* **see:** [br_is_classifier](../c_api/functions.md#br_is_classifier) | ||
| 19 | +* **example:** | ||
| 20 | + | ||
| 21 | + IsClassifier("Identity"); // returns true | ||
| 22 | + IsClassifier("Identity:Dist"); // returns false | ||
| 23 | + | ||
| 24 | +--- | ||
| 25 | + | ||
| 26 | +## Train {: #train } | ||
| 27 | + | ||
| 28 | +High level function for creating models. | ||
| 29 | + | ||
| 30 | +* **function definition:** | ||
| 31 | + | ||
| 32 | + void Train(const File &input, const File &model) | ||
| 33 | + | ||
| 34 | +* **parameters:** | ||
| 35 | + | ||
| 36 | + Parameter | Type | Description | ||
| 37 | + --- | --- | --- | ||
| 38 | + input | const [File](file/file.md) & | Training data | ||
| 39 | + model | const [File](file/file.md) & | Model file | ||
| 40 | + | ||
| 41 | +* **output:** (void) | ||
| 42 | +* **see:** The [training tutorial](../../tutorials.md#training-algorithms) for an example of training. | ||
| 43 | +* **example:** | ||
| 44 | + | ||
| 45 | + File file("/path/to/images/or/gallery.gal"); | ||
| 46 | + File model("/path/to/model/file"); | ||
| 47 | + Train(file, model); | ||
| 48 | + | ||
| 49 | +--- | ||
| 50 | + | ||
| 51 | +## Enroll {: #enroll-1 } | ||
| 52 | + | ||
| 53 | +High level function for creating [galleries](gallery/gallery.md). | ||
| 54 | + | ||
| 55 | +* **function definition:** | ||
| 56 | + | ||
| 57 | + void Enroll(const File &input, const File &gallery = File()) | ||
| 58 | + | ||
| 59 | +* **parameters:** | ||
| 60 | + | ||
| 61 | + Parameter | Type | Description | ||
| 62 | + --- | --- | --- | ||
| 63 | + input | const [File](file/file.md) & | Path to enrollment file | ||
| 64 | + gallery | const [File](file/file.md) & | (Optional) Path to gallery file. | ||
| 65 | + | ||
| 66 | +* **output:** (void) | ||
| 67 | +* **see:** [br_enroll](../c_api/functions.md#br_enroll) | ||
| 68 | +* **example:** | ||
| 69 | + | ||
| 70 | + File file("/path/to/images/or/gallery.gal"); | ||
| 71 | + Enroll(file); // Don't need to specify a gallery file | ||
| 72 | + File gallery("/path/to/gallery/file"); | ||
| 73 | + Enroll(file, gallery); // Will write to the specified gallery file | ||
| 74 | + | ||
| 75 | +--- | ||
| 76 | + | ||
| 77 | +## Enroll {: #enroll-2 } | ||
| 78 | + | ||
| 79 | +High level function for enrolling templates. Templates are modified in place as they are projected through the algorithm. | ||
| 80 | + | ||
| 81 | +* **function definition:** | ||
| 82 | + | ||
| 83 | + void Enroll(TemplateList &tmpl) | ||
| 84 | + | ||
| 85 | +* **parameters:** | ||
| 86 | + | ||
| 87 | + Parameter | Type | Description | ||
| 88 | + --- | --- | --- | ||
| 89 | + tmpl | [TemplateList](templatelist/templatelist.md) & | Data to enroll | ||
| 90 | + | ||
| 91 | +* **output:** (void) | ||
| 92 | +* **example:** | ||
| 93 | + | ||
| 94 | + TemplateList tList = TemplateList() << Template("picture1.jpg") | ||
| 95 | + << Template("picture2.jpg") | ||
| 96 | + << Template("picture3.jpg"); | ||
| 97 | + Enroll(tList); | ||
| 98 | + | ||
| 99 | +--- | ||
| 100 | + | ||
| 101 | +## Project {: #project} | ||
| 102 | + | ||
| 103 | +A naive alternative to [Enroll](#enroll-1). | ||
| 104 | + | ||
| 105 | +* **function definition:** | ||
| 106 | + | ||
| 107 | + void Project(const File &input, const File &output) | ||
| 108 | + | ||
| 109 | +* **parameters:** | ||
| 110 | + | ||
| 111 | + Parameter | Type | Description | ||
| 112 | + --- | --- | --- | ||
| 113 | + input | const [File](file/file.md) & | Path to enrollment file | ||
| 114 | + gallery | const [File](file/file.md) & | Path to gallery file. | ||
| 115 | + | ||
| 116 | +* **output:** (void) | ||
| 117 | +* **see:** [Enroll](#enroll-1) | ||
| 118 | +* **example:** | ||
| 119 | + | ||
| 120 | + File file("/path/to/images/or/gallery.gal"); | ||
| 121 | + File output("/path/to/gallery/file"); | ||
| 122 | + Project(file, gallery); // Will write to the specified gallery file | ||
| 123 | + | ||
| 124 | +--- | ||
| 125 | + | ||
| 126 | +## Compare {: #compare } | ||
| 127 | + | ||
| 128 | +High level function for comparing galleries. Each template in the **queryGallery** is compared against every template in the **targetGallery**. | ||
| 129 | + | ||
| 130 | +* **function definition:** | ||
| 131 | + | ||
| 132 | + void Compare(const File &targetGallery, const File &queryGallery, const File &output) | ||
| 133 | + | ||
| 134 | +* **parameters:** | ||
| 135 | + | ||
| 136 | + Parameter | Type | Description | ||
| 137 | + --- | --- | --- | ||
| 138 | + targetGallery | const [File](file/file.md) & | Gallery of target templates | ||
| 139 | + queryGallery | const [File](file/file.md) & | Gallery of query templates | ||
| 140 | + output | const [File](file/file.md) & | Output file for results | ||
| 141 | + | ||
| 142 | +* **returns:** (output) | ||
| 143 | +* **see:** [br_compare](../c_api/functions.md#br_compare) | ||
| 144 | +* **example:** | ||
| 145 | + | ||
| 146 | + File target("/path/to/target/images/"); | ||
| 147 | + File query("/path/to/query/images/"); | ||
| 148 | + File output("/path/to/output/file"); | ||
| 149 | + Compare(target, query, output); | ||
| 150 | + | ||
| 151 | +--- | ||
| 152 | + | ||
| 153 | +## CompareTemplateList {: #comparetemplatelists} | ||
| 154 | + | ||
| 155 | +High level function for comparing templates. | ||
| 156 | + | ||
| 157 | +* **function definition:** | ||
| 158 | + | ||
| 159 | + void CompareTemplateLists(const TemplateList &target, const TemplateList &query, Output *output); | ||
| 160 | + | ||
| 161 | +* **parameters:** | ||
| 162 | + | ||
| 163 | + Parameter | Type | Description | ||
| 164 | + --- | --- | --- | ||
| 165 | + target | const [TemplateList](templatelist/templatelist.md) & | Target templates | ||
| 166 | + query | const [TemplateList](templatelist/templatelist.md) & | Query templates | ||
| 167 | + output | [Output](output/output.md) \* | Output file for results | ||
| 168 | + | ||
| 169 | +* **output:** (void) | ||
| 170 | +* **example:** | ||
| 171 | + | ||
| 172 | + TemplateList targets = TemplateList() << Template("target_img1.jpg") | ||
| 173 | + << Template("target_img2.jpg") | ||
| 174 | + << Template("target_img3.jpg"); | ||
| 175 | + | ||
| 176 | + TemplateList query = TemplateList() << Template("query_img.jpg"); | ||
| 177 | + Output *output = Factory::make<Output>("/path/to/output/file"); | ||
| 178 | + | ||
| 179 | + CompareTemplateLists(targets, query, output); | ||
| 180 | + | ||
| 181 | +--- | ||
| 182 | + | ||
| 183 | +## PairwiseCompare {: #pairwisecompare } | ||
| 184 | + | ||
| 185 | +High level function for doing a series of pairwise comparisons. | ||
| 186 | + | ||
| 187 | +* **function definition:** | ||
| 188 | + | ||
| 189 | + void PairwiseCompare(const File &targetGallery, const File &queryGallery, const File &output) | ||
| 190 | + | ||
| 191 | +* **parameters:** | ||
| 192 | + | ||
| 193 | + Parameter | Type | Description | ||
| 194 | + --- | --- | --- | ||
| 195 | + targetGallery | const [File](file/file.md) & | Gallery of target templates | ||
| 196 | + queryGallery | const [File](file/file.md) & | Gallery of query templates | ||
| 197 | + output | const [File](file/file.md) & | Output file for results | ||
| 198 | + | ||
| 199 | +* **output:** (void) | ||
| 200 | +* **see:** [br_pairwise_comparison](../c_api/functions.md#br_pairwise_compare) | ||
| 201 | +* **example:** | ||
| 202 | + | ||
| 203 | + File target("/path/to/target/images/"); | ||
| 204 | + File query("/path/to/query/images/"); | ||
| 205 | + File output("/path/to/output/file"); | ||
| 206 | + PairwiseCompare(target, query, output); | ||
| 207 | + | ||
| 208 | +--- | ||
| 209 | + | ||
| 210 | +## Convert {: #convert } | ||
| 211 | + | ||
| 212 | +Change the format of the **inputFile** to the format of the **outputFile**. Both the **inputFile** format and the **outputFile** format must be of the same format group, which is specified by the **fileType**. | ||
| 213 | + | ||
| 214 | +* **function definition:** | ||
| 215 | + | ||
| 216 | + void Convert(const File &fileType, const File &inputFile, const File &outputFile) | ||
| 217 | + | ||
| 218 | +* **parameters:** | ||
| 219 | + | ||
| 220 | + Parameter | Type | Description | ||
| 221 | + --- | --- | --- | ||
| 222 | + fileType | const [File](file/file.md) & | Can be either: <ul> <li>[Format](format/format.md)</li> <li>[Gallery](gallery/gallery.md)</li> <li>[Output](output/output.md)</li> </ul> | ||
| 223 | + inputFile | const [File](file/file.md) & | File to be converted. Format is inferred from the extension. | ||
| 224 | + outputFile | const [File](file/file.md) & | File to store converted input. Format is inferred from the extension. | ||
| 225 | + | ||
| 226 | +* **output:** (void) | ||
| 227 | +* **example:** | ||
| 228 | + | ||
| 229 | + File input("input.csv"); | ||
| 230 | + File output("output.xml"); | ||
| 231 | + Convert("Format", input, output); | ||
| 232 | + | ||
| 233 | +--- | ||
| 234 | + | ||
| 235 | +## Cat {: #cat } | ||
| 236 | + | ||
| 237 | +Concatenate several galleries into one. | ||
| 238 | + | ||
| 239 | +* **function definition:** | ||
| 240 | + | ||
| 241 | + void Cat(const QStringList &inputGalleries, const QString &outputGallery) | ||
| 242 | + | ||
| 243 | +* **parameters:** | ||
| 244 | + | ||
| 245 | + Parameter | Type | Description | ||
| 246 | + --- | --- | --- | ||
| 247 | + inputGalleries | const [QStringList][QStringList] & | List of galleries to concatenate | ||
| 248 | + outputGallery | const [QString][QString] & | Gallery to store the concatenated result. This gallery cannot be in the inputGalleries | ||
| 249 | + | ||
| 250 | +* **output:** (void) | ||
| 251 | +* **see:** [br_cat](../c_api/functions.md#br_cat) | ||
| 252 | +* **example:** | ||
| 253 | + | ||
| 254 | + QStringList inputGalleries = QStringList() << "/path/to/gallery1" | ||
| 255 | + << "/path/to/gallery2" | ||
| 256 | + << "/path/to/gallery3"; | ||
| 257 | + | ||
| 258 | + QString outputGallery = "/path/to/outputGallery"; | ||
| 259 | + Cat(inputGalleries, outputGallery); | ||
| 260 | + | ||
| 261 | +--- | ||
| 262 | + | ||
| 263 | +## Deduplicate {: #deduplicate } | ||
| 264 | + | ||
| 265 | +Deduplicate a gallery. A duplicate is defined as an image with a match score above a given threshold to another image in the gallery. | ||
| 266 | + | ||
| 267 | +* **function definition:** | ||
| 268 | + | ||
| 269 | + void Deduplicate(const File &inputGallery, const File &outputGallery, const QString &threshold) | ||
| 270 | + | ||
| 271 | +* **parameters:** | ||
| 272 | + | ||
| 273 | + Parameter | Type | Description | ||
| 274 | + --- | --- | --- | ||
| 275 | + inputGallery | const [File](file/file.md) & | Gallery to deduplicate | ||
| 276 | + outputGallery | const [File](file/file.md) & | Gallery to store the deduplicated result | ||
| 277 | + threshold | const [QString][QString] & | Match score threshold to determine duplicates | ||
| 278 | + | ||
| 279 | +* **output:** (void) | ||
| 280 | +* **see:** [br_deduplicate](../c_api/functions.md#br_deduplicate) | ||
| 281 | +* **example:** | ||
| 282 | + | ||
| 283 | + File input("/path/to/input/galley/with/dups"); | ||
| 284 | + File output("/path/to/output/gallery"); | ||
| 285 | + Deduplicate(input, output, "0.7"); // Remove duplicates with match scores above 0.7 | ||
| 286 | + | ||
| 287 | +<!-- Links --> | ||
| 288 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 289 | +[QStringList]: http://doc.qt.io/qt-5/qstringlist.html "QStringList" |
docs/docs/api_docs/cpp_api/classifier/classifier.md
0 → 100644
| 1 | +<!-- CLASSIFIER --> | ||
| 2 | + | ||
| 3 | +Inherits [Object](../object/object.md) | ||
| 4 | + | ||
| 5 | +See: | ||
| 6 | + | ||
| 7 | +* [Constructors](constructors.md) | ||
| 8 | +* [Static Functions](statics.md) | ||
| 9 | +* [Functions](functions.md) | ||
| 10 | + | ||
| 11 | +Classifiers are used to assign images to a specific class, or to a particular value along a regression line. Although [Transforms](../transform/transform.md) can also be used for this purpose, [Classifiers](classifier.md) provide a simpler and more consistent API. |
docs/docs/api_docs/cpp_api/classifier/constructors.md
0 → 100644
docs/docs/api_docs/cpp_api/classifier/functions.md
0 → 100644
| 1 | +## void train(const [QList][QList]<[Mat][Mat]> &images, const [QList][QList]<float> &labels) {: #train } | ||
| 2 | + | ||
| 3 | +This is a pure, virtual function. Train the classifier using the provided images and labels. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + virtual void train(const QList<Mat> &images, const QList<float> &labels) = 0 | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Descriptions | ||
| 12 | + --- | --- | --- | ||
| 13 | + images | const [QList][QList]<[Mat][Mat]> & | Training images | ||
| 14 | + labels | const [QList][QList]<float> & | Training labels | ||
| 15 | + | ||
| 16 | +* **output:** (void) | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + // Create data for a 2-class classification problem | ||
| 20 | + QList<Mat> images = QList<Mat>() << Template("training_pic1.jpg").m() | ||
| 21 | + << Template("training_pic2.jpg").m() | ||
| 22 | + << Template("training_pic3.jpg").m() | ||
| 23 | + << Template("training_pic4.jpg").m(); | ||
| 24 | + | ||
| 25 | + QList<float> labels = QList<float>() << 0 << 0 << 1 << 1; | ||
| 26 | + | ||
| 27 | + Classifier *classifier = Classifier::make("Classifier"); | ||
| 28 | + rep->train(images, labels); | ||
| 29 | + | ||
| 30 | +## float classify(const [Mat][Mat] &image) const {: #classify } | ||
| 31 | + | ||
| 32 | +This is a pure virtual function. Classify a provided input image. | ||
| 33 | + | ||
| 34 | +* **function description:** | ||
| 35 | + | ||
| 36 | + virtual float classify(const Mat &image) const = 0 | ||
| 37 | + | ||
| 38 | +* **parameters:** | ||
| 39 | + | ||
| 40 | + Parameter | Type | Description | ||
| 41 | + --- | --- | --- | ||
| 42 | + image | const [Mat][Mat] & | Input image to be classified | ||
| 43 | + | ||
| 44 | +* **output:** (float) Returns the classification value of the image. The value can be a confidence, a regression, or a class. In 2-class classification is it often a confidence which has been normalized such that 0 is the inflection point. Values below zero represent a negative classification and values above represent a positive classification. | ||
| 45 | +* **example:** | ||
| 46 | + Classifier *classifier = Classifier::make("2ClassClassifier"); // assume classifier is already trained | ||
| 47 | + | ||
| 48 | + Template p1("pos_image1.jpg"); // positive sample | ||
| 49 | + Template n1("neg_image1.jpg"); // negative sample | ||
| 50 | + | ||
| 51 | + classifier->classify(p1); // returns confidence > 0 | ||
| 52 | + classifier->classify(n1); // returns confidence < 0 | ||
| 53 | + | ||
| 54 | +<!-- Links --> | ||
| 55 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 56 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" |
docs/docs/api_docs/cpp_api/classifier/statics.md
0 → 100644
| 1 | +## [Classifier](classifier.md) \*make([QString][QString] str, [QObject][QObject] \*parent) {: #make } | ||
| 2 | + | ||
| 3 | +Make a [Classifier](classifier.md) from a string. The string is passed to [Factory](../factory/factory.md)::[make](../factory/statics.md#make) to be turned into a classifier. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static Classifier *make(QString str, QObject *parent) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + str | [QString][QString] | String describing the classifier | ||
| 14 | + parent | [QObject][QObject] \* | Parent of the object to be created | ||
| 15 | + | ||
| 16 | +* **output:** ([Classifier](classifier.md) \*) Returns a pointer to the [Classifier](classifier.md) described by the string | ||
| 17 | +* **see:** [Factory::make](../factory/statics.md#make) | ||
| 18 | +* **example:** | ||
| 19 | + | ||
| 20 | + Classifier *classifier = Classifier::make("Classifier(representation=Representation(property1=value1)"); | ||
| 21 | + classifier->description(); // Returns "Classifier(representation=Representation(property1=value1))" | ||
| 22 | + | ||
| 23 | +<!-- Links --> | ||
| 24 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 25 | +[QObject]: http://doc.qt.io/qt-5/QObject.html "QObject" |
docs/docs/api_docs/cpp_api/compositetransform/compositetransform.md
0 → 100644
| 1 | +<!-- CompositeTransform --> | ||
| 2 | + | ||
| 3 | +Inherits [TimeVaryingTransform](../timevaryingtransform/timevaryingtransform.md) | ||
| 4 | + | ||
| 5 | +Base class for [Transforms](../transform/transform.md) that aggregate subtransforms. | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Properties](properties.md) | ||
| 10 | +* [Members](members.md) | ||
| 11 | +* [Constructors](constructors.md) | ||
| 12 | +* [Functions](functions.md) | ||
| 13 | + | ||
| 14 | +CompositeTransforms are the base class for [Transforms](../transform/transform.md) that have a list of child transforms. It is used internally for plugins like pipes and forks. It inherits from [TimeVaryingTransform](../timevaryingtransform/timevaryingtransform.md) so that it can properly handle having children (one or many) that are time varying. |
docs/docs/api_docs/cpp_api/compositetransform/constructors.md
0 → 100644
docs/docs/api_docs/cpp_api/compositetransform/functions.md
0 → 100644
| 1 | +## bool timeVarying() {: #timevarying } | ||
| 2 | + | ||
| 3 | +Check if the transform is time varying. The transform is time varying if any of its children are time varying. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + bool timeVarying() const | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** (bool) Returns [isTimeVarying](members.md#istimevarying) | ||
| 11 | + | ||
| 12 | +## void init() {: #init } | ||
| 13 | + | ||
| 14 | +Initialize the transform. If any of the child transform are time varying, [isTimeVarying](members.md#istimevarying) is set to true. Similarly if any of the child transforms are trainable, [trainable](../transform/members.md#trainable) is set to true. | ||
| 15 | + | ||
| 16 | +* **function definition:** | ||
| 17 | + | ||
| 18 | + void init() | ||
| 19 | + | ||
| 20 | +* **parameters:** NONE | ||
| 21 | +* **output:** (void) | ||
| 22 | + | ||
| 23 | +## void project(const [Template](../template/template.md) &src, [Template](../template/template.md) &dst) {: #project-1 } | ||
| 24 | + | ||
| 25 | +If the transform is time varying call [timeInvariantAlias](../timevaryingtransform/members.md#timeinvariantalias) project, which ensures thread safety. If the transform is not time varying call [_project](#_project-1). | ||
| 26 | + | ||
| 27 | +* **function definition:** | ||
| 28 | + | ||
| 29 | + virtual void project(const Template &src, Template &dst) const | ||
| 30 | + | ||
| 31 | +* **parameters:** | ||
| 32 | + | ||
| 33 | + Parameter | Type | Description | ||
| 34 | + --- | --- | --- | ||
| 35 | + src | const [Template](../template/template.md) & | The input template | ||
| 36 | + dst | [Template](../template/template.md) & | The output template | ||
| 37 | + | ||
| 38 | +* **output:** (void) | ||
| 39 | + | ||
| 40 | +## void project(const [TemplateList](../templatelist/templatelist.md) &src, [TemplateList](../templatelist/templatelist.md) &dst) {: #project-2 } | ||
| 41 | + | ||
| 42 | +If the transform is time varying call [timeInvariantAlias](../timevaryingtransform/members.md#timeinvariantalias) project, which ensures thread safety. If the transform is not time varying call [_project](#_project-2). | ||
| 43 | + | ||
| 44 | +* **function definition:** | ||
| 45 | + | ||
| 46 | + virtual void project(const TemplateList &src, TemplateList &dst) const | ||
| 47 | + | ||
| 48 | +* **parameters:** | ||
| 49 | + | ||
| 50 | + Parameter | Type | Description | ||
| 51 | + --- | --- | --- | ||
| 52 | + src | const [TemplateList](../templatelist/templatelist.md) & | The input template list | ||
| 53 | + dst | [TemplateList ](../templatelist/templatelist.md) & | The output template list | ||
| 54 | + | ||
| 55 | +* **output:** (void) | ||
| 56 | + | ||
| 57 | +## void \_project(const [Template](../template/template.md) &src, [Template](../template/template.md) &dst) {: #\_project-1 } | ||
| 58 | + | ||
| 59 | +This is a pure virtual function. It should handle standard projection through the child transforms | ||
| 60 | + | ||
| 61 | +* **function definition:** | ||
| 62 | + | ||
| 63 | + virtual void _project(const Template &src, Template &dst) const = 0 | ||
| 64 | + | ||
| 65 | +* **parameters:** | ||
| 66 | + | ||
| 67 | + Parameter | Type | Description | ||
| 68 | + --- | --- | --- | ||
| 69 | + src | const [Template](../template/template.md) & | The input template | ||
| 70 | + dst | [Template](../template/template.md) & | The output template | ||
| 71 | + | ||
| 72 | +* **output:** (void) | ||
| 73 | + | ||
| 74 | +## void \_project(const [TemplateList](../templatelist/templatelist.md) &src, [TemplateList](../templatelist/templatelist.md) &dst) {: #\_project-2 } | ||
| 75 | + | ||
| 76 | +This is a pure virtual function. It should handle standard projection through the child transforms | ||
| 77 | + | ||
| 78 | +* **function definition:** | ||
| 79 | + | ||
| 80 | + virtual void _project(const TemplateList &src, TemplateList &dst) const = 0 | ||
| 81 | + | ||
| 82 | +* **parameters:** | ||
| 83 | + | ||
| 84 | + Parameter | Type | Description | ||
| 85 | + --- | --- | --- | ||
| 86 | + src | const [TemplateList](../templatelist/templatelist.md) & | The input template list | ||
| 87 | + dst | [TemplateList](../templatelist/templatelist.md) & | The output template list | ||
| 88 | + | ||
| 89 | +* **output:** (void) | ||
| 90 | + | ||
| 91 | +## [Transform](../transform/transform.md) \*simplify(bool &newTransform) {: #simplify } | ||
| 92 | + | ||
| 93 | +This is a virtual function. Calls [simplify](../transform/functions.md#simplify) on each child transform. | ||
| 94 | + | ||
| 95 | +* **function definition:** | ||
| 96 | + | ||
| 97 | + virtual Transform *simplify(bool &newTransform) | ||
| 98 | + | ||
| 99 | +* **parameters:** | ||
| 100 | + | ||
| 101 | + Parameter | Type | Description | ||
| 102 | + --- | --- | --- | ||
| 103 | + newTransform | bool & | True if a new, simplified, transform was allocated inside this call, false otherwise | ||
| 104 | + | ||
| 105 | +* **output:** ([Transform](../transform/transform.md) \*) Returns itself if none of the children can be simplified. newTransform is false in this case. If any child can be simplified a new [CompositeTransform](compositetransform.md) is allocated and its children are set as the result of calling simplify on each of the old children. newTransform is true in this case | ||
| 106 | + | ||
| 107 | +## [Transform](../transform/transform.md) \*smartCopy(bool &newTransform) {: #smartcopy } | ||
| 108 | + | ||
| 109 | +Get a smart copy, meaning a copy only if one is required, of this transform | ||
| 110 | + | ||
| 111 | +* **function definition:** | ||
| 112 | + | ||
| 113 | + Transform *smartCopy(bool &newTransform) | ||
| 114 | + | ||
| 115 | +* **parameters:** | ||
| 116 | + | ||
| 117 | + Parameter | Type | Description | ||
| 118 | + --- | --- | --- | ||
| 119 | + newTransform | bool & | True if a new, simplified, transform was allocated inside this call, false otherwise | ||
| 120 | + | ||
| 121 | +* **output:** ([Transform](../transform/transform.md) \*) Returns itself if [isTimeVarying](members.md#istimevarying) is false (no copy needed). newTransform is set to false in this case. If [isTimeVarying](members.md#istimevarying) is true, a new [CompositeTransform](compositetransform.md) is allocated and its children are set to the result of calling smartCopy on each of the old children. newTransform is true in this case. |
docs/docs/api_docs/cpp_api/compositetransform/members.md
0 → 100644
docs/docs/api_docs/cpp_api/compositetransform/properties.md
0 → 100644
docs/docs/api_docs/cpp_api/context/context.md
0 → 100644
| 1 | +<!-- CONTEXT --> | ||
| 2 | + | ||
| 3 | +The singleton class of global settings. | ||
| 4 | + | ||
| 5 | +See: | ||
| 6 | + | ||
| 7 | +* [Members](members.md) | ||
| 8 | +* [Static Functions](statics.md) | ||
| 9 | +* [Functions](functions.md) | ||
| 10 | + | ||
| 11 | +Before including and using OpenBR in a project the user must call [initialize](statics.md#initialize). Before the program terminates the user must call [finalize](statics.md#finalize). The settings are accessible as Context \*Globals. |
docs/docs/api_docs/cpp_api/context/functions.md
0 → 100644
| 1 | +## bool contains(const [QString][QString] &name) {: #contains } | ||
| 2 | + | ||
| 3 | +Check if a property exists in the [global metadata](context.md). | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + bool contains(const QString &name); | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + name | const [QString][QString] & | [Metadata](context.md) key. It must be queryable using [QObject::property][QObject::property]. | ||
| 14 | + | ||
| 15 | +* **output:** (bool) Returns true if the provided key is a global property. | ||
| 16 | +* **see:** [setProperty](#setproperty) | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + Globals->contains("path"); // returns true | ||
| 20 | + Globals->contains("key"); // returns false | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +## void setProperty(const [QString][QString] &key, const [QString][QString] &value) {: #setproperty } | ||
| 24 | + | ||
| 25 | +Set a global property. | ||
| 26 | + | ||
| 27 | +* **function definition:** | ||
| 28 | + | ||
| 29 | + void setProperty(const QString &key, const QString &value) | ||
| 30 | + | ||
| 31 | +* **parameters:** | ||
| 32 | + | ||
| 33 | + Parameter | Type | Description | ||
| 34 | + --- | --- | --- | ||
| 35 | + key | const [QString][QString] & | [Metadata](context.md) key | ||
| 36 | + value | const [QString][QString] & | Value to be added to the [Metadata](context.md) | ||
| 37 | + | ||
| 38 | +* **output:** (void) | ||
| 39 | +* **see:** [contains](#contains) | ||
| 40 | +* **example:** | ||
| 41 | + | ||
| 42 | + Globals->contains("key"); // returns false | ||
| 43 | + Globals->setProperty("key", "value"); | ||
| 44 | + Globals->contains("key"); // returns true | ||
| 45 | + | ||
| 46 | + | ||
| 47 | +## void printStatus() {: #printstatus } | ||
| 48 | + | ||
| 49 | +Prints the current progress statistics to **stdout**. | ||
| 50 | + | ||
| 51 | +* **function definition:** | ||
| 52 | + | ||
| 53 | +void printStatus(); | ||
| 54 | + | ||
| 55 | +* **parameters:** NONE | ||
| 56 | +* **output:** (void) | ||
| 57 | +* **see:** [progress](#progress) | ||
| 58 | +* **example:** | ||
| 59 | + | ||
| 60 | + Globals->printStatus(); // returns 00.00% ELAPSED=00:00:00 REMAINING=99:99:99 COUNT=0 | ||
| 61 | + | ||
| 62 | + | ||
| 63 | +## int timeRemaining() const {: #timeremaining } | ||
| 64 | + | ||
| 65 | +Get the time remaining in seconds of a call to [Train](../apifunctions.md#train), [Enroll](../apifunctions.md#enroll-1) or [Compare](../apifunctions.md#compare). | ||
| 66 | + | ||
| 67 | +* **function defintion:** | ||
| 68 | + | ||
| 69 | + int timeRemaining() const; | ||
| 70 | + | ||
| 71 | +* **parameters:** NONE | ||
| 72 | +* **output:** (int) Returns the estimated time remaining in the currently running process. If not process is running returns -1. | ||
| 73 | + | ||
| 74 | +## float progress() {: #progress } | ||
| 75 | + | ||
| 76 | +Get the completion percentage of a call to [Train](../apifunctions.md#train), [Enroll](../apifunctions.md#enroll-1) or [Compare](../apifunctions.md#compare). | ||
| 77 | + | ||
| 78 | +* **function definition:** | ||
| 79 | + | ||
| 80 | + float progress() const; | ||
| 81 | + | ||
| 82 | +* **parameters:** NONE | ||
| 83 | +* **output:** (float) Returns the fraction of the currently running job that has been completed. | ||
| 84 | + | ||
| 85 | +<!-- Links --> | ||
| 86 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 87 | +[QObject::property]: http://doc.qt.io/qt-5/qobject.html#property "QObject::property" |
docs/docs/api_docs/cpp_api/context/members.md
0 → 100644
| 1 | +Member | Type | Description | ||
| 2 | +--- | --- | --- | ||
| 3 | +<a class="table-anchor" id=sdkpath></a>sdkPath | [QString][QString] | Path to the sdk. Path + **share/openbr/openbr.bib** must exist. | ||
| 4 | +<a class="table-anchor" id=algorithm></a>algorithm | [QString][QString] | The default algorithm to use when enrolling and comparing templates. | ||
| 5 | +<a class="table-anchor" id=log></a>log | [QString][QString] | Optional log file to copy **stderr** to. | ||
| 6 | +<a class="table-anchor" id=path></a>path | [QString][QString] | Path to use when resolving images specified with relative paths. Multiple paths can be specified using a semicolon separator. | ||
| 7 | +<a class="table-anchor" id=parallelism></a>parallelism | int | The number of threads to use. The default is the maximum of 1 and the value returned by ([QThread][QThread]::idealThreadCount() + 1). | ||
| 8 | +<a class="table-anchor" id=usegui></a>useGui | bool | Whether or not to use GUI functions. The default is true. | ||
| 9 | +<a class="table-anchor" id=blocksize></a>blockSize | int | The maximum number of templates to process in parallel. The default is: ```parallelism * ((sizeof(void*) == 4) ? 128 : 1024)``` | ||
| 10 | +<a class="table-anchor" id=quiet></a>quiet | bool | If true, no messages will be sent to the terminal. The default is false. | ||
| 11 | +<a class="table-anchor" id=verbose></a>verbose | bool | If true, extra messages will be sent to the terminal. The default is false. | ||
| 12 | +<a class="table-anchor" id=mostrecentmessage></a>mostRecentMessage | [QString][QString] | The most recent message sent to the terminal. | ||
| 13 | +<a class="table-anchor" id=currentstep></a>currentStep | double | Used internally to compute [progress](functions.md#progress) and [timeRemaining](functions.md#timeremaining). | ||
| 14 | +<a class="table-anchor" id=totalsteps></a>totalSteps | double | Used internally to compute [progress](functions.md#progress) and [timeRemaining](functions.md#timeremaining). | ||
| 15 | +<a class="table-anchor" id=enrollall></a>enrollAll | bool | If true, enroll 0 or more templates per image. Otherwise, enroll exactly one. The default is false. | ||
| 16 | +<a class="table-anchor" id=filters></a>filters | Filters | Filters is a ```typedef QHash<QString,QStringList> Filters```. Filters that automatically determine imposter matches based on target ([gallery](../gallery/gallery.md)) template metadata. See [FilterDistance](../../../plugin_docs/distance.md#filterdistance). | ||
| 17 | +<a class="table-anchor" id=buffer></a>buffer | [QByteArray][QByteArray] | File output is redirected here if the file's basename is "buffer". This clears previous contents. | ||
| 18 | +<a class="table-anchor" id=scorenormalization></a>scoreNormalization | bool | If true, enable score normalization. Otherwise disable it. The default is true. | ||
| 19 | +<a class="table-anchor" id=crossvalidate></a>crossValidate | int | Perform k-fold cross validation where k is the value of **crossValidate**. The default value is 0. | ||
| 20 | +<a class="table-anchor" id=modelsearch></a>modelSearch | [QList][QList]<[QString][QString]> | List of paths to search for sub-models on. | ||
| 21 | +<a class="table-anchor" id=abbreviations></a>abbreviations | [QHash][QHash]<[QString][QString], [QString][QString]> | Used by [Transform](../transform/transform.md)::[make](../transform/statics.md#make) to expand abbreviated algorithms into their complete definitions. | ||
| 22 | +<a class="table-anchor" id=starttime></a>startTime | [QTime][QTime] | Used to estimate [timeRemaining](functions.md#timeremaining). | ||
| 23 | +<a class="table-anchor" id=logfile></a>logFile | [QFile][QFile] | Log file to write to. | ||
| 24 | + | ||
| 25 | + | ||
| 26 | +<!-- Links --> | ||
| 27 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 28 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 29 | +[QHash]: http://doc.qt.io/qt-5/qhash.html "QHash" | ||
| 30 | +[QThread]: http://doc.qt.io/qt-5/qthread.html "QThread" | ||
| 31 | +[QByteArray]: http://doc.qt.io/qt-5/qbytearray.html "QByteArray" | ||
| 32 | +[QTime]: http://doc.qt.io/qt-5/QTime.html "QTime" | ||
| 33 | +[QFile]: http://doc.qt.io/qt-5/qfile.html "QFile" |
docs/docs/api_docs/cpp_api/context/statics.md
0 → 100644
| 1 | +## void initialize(int &argc, char \*argv[], [QString][QString] sdkPath = "", bool useGui = true) {: #initialize } | ||
| 2 | + | ||
| 3 | +Call *once* at the start of the application to allocate global variables. If the project is a [Qt][Qt] project this call should occur after initializing <tt>QApplication</tt>. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static void initialize(int &argc, char *argv[], QString sdkPath = "", bool useGui = true); | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + argc | int & | Number of command line arguments as provided by <tt>main()</tt> | ||
| 14 | + argv | char * [] | Command line arguments as provided by <tt>main()</tt> | ||
| 15 | + sdkPath | [QString][QString] | (Optional) The path to the folder containing **share/openbr/openbr.bib**. If no path is provided (default) OpenBR automatically searches: <ul> <li>The working directory</li> <li>The executable's location</li> </ul> | ||
| 16 | + useGui | bool | (Optional) Make OpenBR as a [QApplication][QApplication] instead of a [QCoreApplication][QCoreApplication]. Default is true. | ||
| 17 | + | ||
| 18 | +* **output:** (void) | ||
| 19 | +* **see:** [finalize](#finalize) | ||
| 20 | +* **example:** | ||
| 21 | + | ||
| 22 | + int main(int argc, char \*argv[]) | ||
| 23 | + { | ||
| 24 | + QApplication(argc, argv); // ONLY FOR QT PROJECTS | ||
| 25 | + br::Context::initialize(argc, argv); | ||
| 26 | + | ||
| 27 | + // ... | ||
| 28 | + | ||
| 29 | + br::Context::finalize(); | ||
| 30 | + return 0; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | +## void finalize() {: #finalize } | ||
| 34 | + | ||
| 35 | +Call *once* at the end of the application to deallocate global variables. | ||
| 36 | + | ||
| 37 | +* **function definition:** | ||
| 38 | + | ||
| 39 | + static void finalize(); | ||
| 40 | + | ||
| 41 | +* **parameters:** NONE | ||
| 42 | +* **output:** (void) | ||
| 43 | +* **see:** [initialize](#initialize) | ||
| 44 | + | ||
| 45 | + | ||
| 46 | +## bool checkSDKPath(const [QString][QString] &sdkPath) {: #checksdkpath } | ||
| 47 | + | ||
| 48 | +Check if a given SDK path is valid. A valid SDK satisfies | ||
| 49 | + | ||
| 50 | + exists(sdkPath + "share/openbr/openbr.bib") | ||
| 51 | + | ||
| 52 | +* **function definition:** | ||
| 53 | + | ||
| 54 | + static bool checkSDKPath(const QString &sdkPath); | ||
| 55 | + | ||
| 56 | +* **parameters:** | ||
| 57 | + | ||
| 58 | + Parameter | Type | Description | ||
| 59 | + --- | --- | --- | ||
| 60 | + sdkPath | const [QString][QString] & | Possible sdk path to examine | ||
| 61 | + | ||
| 62 | +* **output:** (bool) Returns true if the sdkPath + "share/openbr/openbr.bib" exists, otherwise returns false. | ||
| 63 | +* **example:** | ||
| 64 | + | ||
| 65 | + // OpenBR is at /libs/openbr | ||
| 66 | + | ||
| 67 | + checkSDKPath("/libs/openbr/"); // returns true | ||
| 68 | + checkSDKPath("/libs/"); // returns false | ||
| 69 | + | ||
| 70 | +## [QString][QString] about() {: #about } | ||
| 71 | + | ||
| 72 | +Get a string with the name, version, and copyright of the project. This string is suitable for printing or terminal. | ||
| 73 | + | ||
| 74 | +* **function definition:** | ||
| 75 | + | ||
| 76 | + static QString about(); | ||
| 77 | + | ||
| 78 | +* **parameters:** NONE | ||
| 79 | +* **output:** ([QString][QString]) Returns a string containing the name, version and copyright of the project | ||
| 80 | +* **example:** | ||
| 81 | + | ||
| 82 | + // Using OpenBR version 0.6.0 | ||
| 83 | + Context::about(); // returns "OpenBR 0.6.0 Copyright (c) 2013 OpenBiometrics. All rights reserved." | ||
| 84 | + | ||
| 85 | +## [QString][QString] version() {: #version } | ||
| 86 | + | ||
| 87 | +Get the version of the SDK. | ||
| 88 | + | ||
| 89 | +* **function definition:** | ||
| 90 | + | ||
| 91 | + static QString version(); | ||
| 92 | + | ||
| 93 | +* **parameters:** NONE | ||
| 94 | +* **output:** ([QString][QString]) Returns a string containing the version of the OpenBR SDK. The string has the format *<MajorVersion\>*\.*<MinorVersion\>*\.*<PatchVersion\>* | ||
| 95 | +* **example:** | ||
| 96 | + | ||
| 97 | + // Using OpenBR version 0.6.0 | ||
| 98 | + Context::version(); // returns "0.6.0" | ||
| 99 | + | ||
| 100 | +## [QString][QString] scratchPath() {: #scratchpath } | ||
| 101 | + | ||
| 102 | +Get the scratch directory used by OpenBR. This directory should be used as the root directory for managing temporary files and providing process persistence. | ||
| 103 | + | ||
| 104 | +* **function definition:** | ||
| 105 | + | ||
| 106 | + static QString scratchPath(); | ||
| 107 | + | ||
| 108 | +* **parameters:** NONE | ||
| 109 | +* **output:** ([QString][QString]) Returns a string pointing to the OpenBR scratch directory. The string has the format *<path/to/user/home\><OpenBR-\><MajorVersion\>*\.*<MinorVersion\>*. | ||
| 110 | +* **see:** [version](#version) | ||
| 111 | +* **example:** | ||
| 112 | + | ||
| 113 | + // Using OpenBR version 0.6.0 | ||
| 114 | + Context::scratchPath(); // returns "/path/to/user/home/OpenBR-0.6" | ||
| 115 | + | ||
| 116 | +## [QStringList][QStringList] objects(const char \*abstractions = ".\*", const char \*implementations = ".\*", bool parameters = true) {: #objects } | ||
| 117 | + | ||
| 118 | +Get a collection of objects in OpenBR that match provided regular expressions. This function uses [QRegExp][QRegExp] syntax. | ||
| 119 | + | ||
| 120 | +* **function definition:** | ||
| 121 | + | ||
| 122 | + static QStringList objects(const char *abstractions = ".*", const char *implementations = ".*", bool parameters = true) | ||
| 123 | + | ||
| 124 | +* **parameters:** | ||
| 125 | + | ||
| 126 | + Parameter | Type | Description | ||
| 127 | + --- | --- | --- | ||
| 128 | + abstractions | const char \* | (Optional) Regular expression of the abstractions to search. Default is ".\*" | ||
| 129 | + implementations | const char \* | (Optional) Regular expression of the implementations to search. Default is ".\*". | ||
| 130 | + parameters | bool | (Optional) If true include parameters after object name. Default is true. | ||
| 131 | + | ||
| 132 | +* **output:** ([QStringList][QStringList]) Return names and parameters for the requested objects. Each object is newline separated. Arguments are separated from the object name with tabs. | ||
| 133 | +* **example:** | ||
| 134 | + | ||
| 135 | + // Find all 'Rnd' Transforms | ||
| 136 | + Context::objects("Transform", "Rnd.*", false); // returns ["RndPoint", "RndRegion", "RndRotate", "RndSample", "RndSubspace"] | ||
| 137 | + | ||
| 138 | +<!-- Links --> | ||
| 139 | +[Qt]: http://qt-project.org/ "Qt" | ||
| 140 | +[QApplication]: http://doc.qt.io/qt-5/qapplication.html "QApplication" | ||
| 141 | +[QCoreApplication]: http://doc.qt.io/qt-5/qcoreapplication.html "QCoreApplication" | ||
| 142 | + | ||
| 143 | +[QRegExp]: http://doc.qt.io/qt-5/QRegExp.html "QRegExp" | ||
| 144 | + | ||
| 145 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 146 | +[QStringList]: http://doc.qt.io/qt-5/qstringlist.html "QStringList" |
docs/docs/api_docs/cpp_api/distance/constructors.md
0 → 100644
docs/docs/api_docs/cpp_api/distance/distance.md
0 → 100644
| 1 | +Inherits [Object](../object/object.md) | ||
| 2 | + | ||
| 3 | +Plugin base class for comparing two [Templates](../template/template.md) | ||
| 4 | + | ||
| 5 | +See: | ||
| 6 | + | ||
| 7 | +* [Constructors](constructors.md) | ||
| 8 | +* [Static Functions](statics.md) | ||
| 9 | +* [Functions](functions.md) | ||
| 10 | + | ||
| 11 | +Distances are used to find the *distance* or *similarity* between two feature vectors. A *distance* is defined such that a higher value indicates a larger difference between templates. A *similarity* is the opposite, higher values indicate a smaller difference between templates (they are more similar). |
docs/docs/api_docs/cpp_api/distance/functions.md
0 → 100644
| 1 | + | ||
| 2 | +## bool trainable() {: #trainable } | ||
| 3 | + | ||
| 4 | +This is a virtual function. Check if the distance is trainable. The default version returns true. Distances that are not trainable should derive from [UntrainableDistance](../untrainabledistance/untrainabledistance.md) instead. | ||
| 5 | + | ||
| 6 | +* **function defintion:** | ||
| 7 | + | ||
| 8 | + virtual bool trainable() | ||
| 9 | + | ||
| 10 | +* **parameters:** NONE | ||
| 11 | +* **output:** (bool) Returns true if the distance is trainable, false otherwise. | ||
| 12 | + | ||
| 13 | +## void train(const [TemplateList](../templatelist/templatelist.md) &src) {: #train } | ||
| 14 | + | ||
| 15 | +This is a pure virtual function. Train the distance on a provided [TemplateList](../templatelist/templatelist.md) of data. The structure of the data is dependent on the distance to be trained. Distances that are not trainable should derive from [UntrainableDistance](../untrainabledistance/untrainabledistance.md) so they do not have to overload this function. | ||
| 16 | + | ||
| 17 | +* **function definition:** | ||
| 18 | + | ||
| 19 | + virtual void train(const TemplateList &src) = 0 | ||
| 20 | + | ||
| 21 | +* **parameters:** | ||
| 22 | + | ||
| 23 | + Parameter | Type | Description | ||
| 24 | + --- | --- | --- | ||
| 25 | + src | const [TemplateList](../templatelist/templatelist.md) & | Training data for the distance. | ||
| 26 | + | ||
| 27 | +* **output:** (void) | ||
| 28 | +* **example:** | ||
| 29 | + | ||
| 30 | + // Create data for a 2-class classification problem | ||
| 31 | + Template t1("training_pic1.jpg"); | ||
| 32 | + t1.file.set("Label", 0); | ||
| 33 | + Template t2("training_pic2.jpg"); | ||
| 34 | + t2.file.set("Label", 0); | ||
| 35 | + Template t3("training_pic3.jpg"); | ||
| 36 | + t3.file.set("Label", 1); | ||
| 37 | + Template t4("training_pic4.jpg"); | ||
| 38 | + t4.file.set("Label", 1); | ||
| 39 | + | ||
| 40 | + TemplateList training_data(QList<Template>() << t1 << t2 << t3 << t4); | ||
| 41 | + | ||
| 42 | + Transform *distance = Distance::fromAlgorithm("Enrollment:Distance"); | ||
| 43 | + distance->train(training_data); // Images are enrolled through Enrollment and the passed to Distance for training | ||
| 44 | + | ||
| 45 | + | ||
| 46 | +## void compare(const [TemplateList](../templatelist/templatelist.md) &target, const [TemplateList] &query, [Output](../output/output.md)) {: #compare-1 } | ||
| 47 | + | ||
| 48 | +This is a virtual function. Compare two [TemplateLists](../templatelist/templatelist.md) and store the results in a provided output. | ||
| 49 | + | ||
| 50 | +* **function definition:** | ||
| 51 | + | ||
| 52 | + virtual void compare(const TemplateList &target, const TemplateList &query, Output *output) const | ||
| 53 | + | ||
| 54 | +* **parameters:** | ||
| 55 | + | ||
| 56 | + Parameter | Type | Description | ||
| 57 | + --- | --- | --- | ||
| 58 | + target | const [TemplateList](../templatelist/templatelist.md) & | List of templates to compare the query against | ||
| 59 | + query | const [TemplateList](../templatelist/templatelist.md) & | List of templates to compare against the target | ||
| 60 | + output | [Output](../output/output.md) \* | [Output](../output/output.md) plugin to use to store the results of the comparisons | ||
| 61 | + | ||
| 62 | +* **output:** (void) | ||
| 63 | + | ||
| 64 | + | ||
| 65 | +## [QList][QList]<float> compare(const [TemplateList](../templatelist/templatelist.md) &target, const [Template](../template/template.md) &query) {: #compare-2 } | ||
| 66 | + | ||
| 67 | +This is a virtual function. Compare a query against a list of targets. Each comparison results in a floating point response which is the distance between the query and a specific target. | ||
| 68 | + | ||
| 69 | +* **function definition:** | ||
| 70 | + | ||
| 71 | + virtual QList<float> compare(const TemplateList &targets, const Template &query) const | ||
| 72 | + | ||
| 73 | +* **parameters:** | ||
| 74 | + | ||
| 75 | + Parameter | Type | Description | ||
| 76 | + --- | --- | --- | ||
| 77 | + targets | const [TemplateList](../templatelist/templatelist.md) & | List of templates to compare the query against | ||
| 78 | + query | const [Template](../template/template.md) & | Query template to be compared | ||
| 79 | + | ||
| 80 | +* **output:** ([QList][QList]<float>) Returns a list of the responses from each comparison between the query and a target. | ||
| 81 | +* **example:** | ||
| 82 | + | ||
| 83 | + Template t1("target_picture1.jpg"); | ||
| 84 | + Template t2("target_picture2.jpg"); | ||
| 85 | + Template t3("target_picture3.jpg"); | ||
| 86 | + | ||
| 87 | + TemplateList targets = TemplateList() << t1 << t2 << t3; | ||
| 88 | + | ||
| 89 | + Template query("query_picture.jpg"); | ||
| 90 | + | ||
| 91 | + algorithm = "Enrollment:Distance"; | ||
| 92 | + | ||
| 93 | + Transform *transform = Transform::fromAlgorithm(algorithm); | ||
| 94 | + Distance *distance = Distance::fromAlgorithm(algorithm); | ||
| 95 | + | ||
| 96 | + targets >> *transform; | ||
| 97 | + query >> *transform; | ||
| 98 | + | ||
| 99 | + distance->compare(targets, query); // returns [0.37, -0.56, 4.35] *Note results are made up! | ||
| 100 | + | ||
| 101 | + | ||
| 102 | +## float compare(const [Template](../template/template.md) &a, const [Template](../template/template.md) &b) {: #compare-3} | ||
| 103 | + | ||
| 104 | +This is a virtual function. Compare two templates and get the difference between them. | ||
| 105 | + | ||
| 106 | +* **function definition:** | ||
| 107 | + | ||
| 108 | + virtual float compare(const Template &a, const Template &b) const | ||
| 109 | + | ||
| 110 | +* **parameters:** | ||
| 111 | + | ||
| 112 | + Parameter | Type | Description | ||
| 113 | + --- | --- | --- | ||
| 114 | + a | const [Template](../template/template.md) & | First template to compare | ||
| 115 | + b | const [Template](../template/template.md) & | Second template to compare | ||
| 116 | + | ||
| 117 | +* **output:** (float) Returns the calculated difference between the provided templates | ||
| 118 | +* **example:** | ||
| 119 | + | ||
| 120 | +Template a("picture_a.jpg"); | ||
| 121 | +Template b("picture_b.jpg"); | ||
| 122 | + | ||
| 123 | +algorithm = "Enrollment:Distance"; | ||
| 124 | + | ||
| 125 | +Transform *transform = Transform::fromAlgorithm(algorithm); | ||
| 126 | +Distance *distance = Distance::fromAlgorithm(algorithm); | ||
| 127 | + | ||
| 128 | +a >> *transform; | ||
| 129 | +b >> *transform; | ||
| 130 | + | ||
| 131 | +distance->compare(a, b); // returns 16.43 *Note results are made up! | ||
| 132 | + | ||
| 133 | + | ||
| 134 | +## float compare(const [Mat][Mat] &a, const [Mat][Mat] &b) {: #compare-4} | ||
| 135 | + | ||
| 136 | +This is a virtual function. Compare two [Mats][Mat] and get the difference between them. | ||
| 137 | + | ||
| 138 | +* **function definition:** | ||
| 139 | + | ||
| 140 | + virtual float compare(const Mat &a, const Mat &b) const | ||
| 141 | + | ||
| 142 | +* **parameters:** | ||
| 143 | + | ||
| 144 | + Parameter | Type | Description | ||
| 145 | + --- | --- | --- | ||
| 146 | + a | const [Mat][Mat] & | First matrix to compare | ||
| 147 | + b | const [Mat][Mat] & | Second matrix to compare | ||
| 148 | + | ||
| 149 | +* **output:** (float) Returns the calculated difference between the provided [Mats][Mat] | ||
| 150 | +* **example:** | ||
| 151 | + | ||
| 152 | + Template a("picture_a.jpg"); | ||
| 153 | + Template b("picture_b.jpg"); | ||
| 154 | + | ||
| 155 | + algorithm = "Enrollment:Distance"; | ||
| 156 | + | ||
| 157 | + Transform *transform = Transform::fromAlgorithm(algorithm); | ||
| 158 | + Distance *distance = Distance::fromAlgorithm(algorithm); | ||
| 159 | + | ||
| 160 | + a >> *transform; | ||
| 161 | + b >> *transform; | ||
| 162 | + | ||
| 163 | + distance->compare(a.m(), b.m()); // returns 16.43 *Note results are made up! | ||
| 164 | + | ||
| 165 | + | ||
| 166 | +## float compare(const uchar \*a, const uchar \*b, size_t size) {: #compare-5 } | ||
| 167 | + | ||
| 168 | +This is a virtual function. Compare two buffers and get the difference between them | ||
| 169 | + | ||
| 170 | +* **function definition:** | ||
| 171 | + | ||
| 172 | + virtual float compare(const uchar *a, const uchar *b, size_t size) const | ||
| 173 | + | ||
| 174 | +* **parameters:** | ||
| 175 | + | ||
| 176 | + Parameter | Type | Description | ||
| 177 | + --- | --- | --- | ||
| 178 | + a | const uchar \* | First buffer to compare | ||
| 179 | + b | const uchar \* | Second buffer to compare | ||
| 180 | + size | size_t | Size of buffers a and b (they must be the same size) | ||
| 181 | + | ||
| 182 | +* **output:** (float) Returns the calculated difference between the provided buffers | ||
| 183 | +* **example:** | ||
| 184 | + | ||
| 185 | + Template a("picture_a.jpg"); | ||
| 186 | + Template b("picture_b.jpg"); | ||
| 187 | + | ||
| 188 | + algorithm = "Enrollment:Distance"; | ||
| 189 | + | ||
| 190 | + Transform *transform = Transform::fromAlgorithm(algorithm); | ||
| 191 | + Distance *distance = Distance::fromAlgorithm(algorithm); | ||
| 192 | + | ||
| 193 | + a >> *transform; | ||
| 194 | + b >> *transform; | ||
| 195 | + | ||
| 196 | + distance->compare(a.m().ptr(), b.m().ptr()); // returns -4.32 *Note results are made up! | ||
| 197 | + | ||
| 198 | + | ||
| 199 | +## [Distance](distance.md) \*make(const [QString][QString] &description) {: #make } | ||
| 200 | + | ||
| 201 | +This is a protected function. Makes a child distance from a provided description by calling [make](statics.md#make) with parent = <tt>this</tt>. | ||
| 202 | + | ||
| 203 | +* **function definition:** | ||
| 204 | + | ||
| 205 | + inline Distance *make(const QString &description) | ||
| 206 | + | ||
| 207 | +* **parameters:** | ||
| 208 | + | ||
| 209 | + Parameter | Type | Description | ||
| 210 | + --- | --- | --- | ||
| 211 | + description | const [QString][QString] & | Description of the child distance | ||
| 212 | + | ||
| 213 | +* **output:** ([Distance](distance.md) \*) Returns a pointer to the created child distance | ||
| 214 | + | ||
| 215 | +<!-- Links --> | ||
| 216 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 217 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 218 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" |
docs/docs/api_docs/cpp_api/distance/statics.md
0 → 100644
| 1 | +## [Distance](distance.md) \*make([QString][QString] str, [QObject][QObject] \*parent) {: #make } | ||
| 2 | + | ||
| 3 | +Make a [Distance](distance.md) from a string. This function converts the abbreviation character **+** into it's full-length alternative. | ||
| 4 | + | ||
| 5 | +Abbreviation | Translation | ||
| 6 | +--- | --- | ||
| 7 | +\+ | [PipeDistance](../../../plugin_docs/distance.md#pipedistance). Each [Distance](distance.md) linked by a **+** is turned into a child of a single [PipeDistance](../../../plugin_docs/distance.md#pipedistance). "Distance1+Distance2" becomes "Pipe([Distance1,Distance2])". [Templates](../template/template.md) are projected through the children of a pipe in series, the output of one become the input of the next. | ||
| 8 | + | ||
| 9 | +The expanded string is then passed to [Factory](../factory/factory.md)::[make](../factory/statics.md#make) to be turned into a distance. | ||
| 10 | + | ||
| 11 | +* **function definition:** | ||
| 12 | + | ||
| 13 | + static Distance *make(QString str, QObject *parent) | ||
| 14 | + | ||
| 15 | +* **parameters:** | ||
| 16 | + | ||
| 17 | + Parameter | Type | Description | ||
| 18 | + --- | --- | --- | ||
| 19 | + str | [QString][QString] | String describing the distance | ||
| 20 | + parent | [QObject][QObject] \* | Parent of the object to be created | ||
| 21 | + | ||
| 22 | +* **output:** ([Distance](distance.md) \*) Returns a pointer to the [Distance](distance.md) described by the string | ||
| 23 | +* **see:** [Factory::make](../factory/statics.md#make) | ||
| 24 | +* **example:** | ||
| 25 | + | ||
| 26 | + Distance::make("Distance1+Distance2+Distance3")->description(); // returns "Pipe(distances=[Distance1,Distance2,Distance3])". | ||
| 27 | + | ||
| 28 | +## [QSharedPointer][QSharedPointer]<[Distance](distance.md)> fromAlgorithm(const [QString][QString] &algorithm) {: #fromalgorithm } | ||
| 29 | + | ||
| 30 | +Create a [Distance](distance.md) from an OpenBR algorithm string. The [Distance](distance.md) is created using everything to the right of a **:** or a **!** in the string. | ||
| 31 | + | ||
| 32 | +* **function definition:** | ||
| 33 | + | ||
| 34 | + static QSharedPointer<Distance> fromAlgorithm(const QString &algorithm) | ||
| 35 | + | ||
| 36 | +* **parameters:** | ||
| 37 | + | ||
| 38 | + Parameter | Type | Description | ||
| 39 | + --- | --- | --- | ||
| 40 | + algorithm | const [QString][QString] & | Algorithm string to construct the [Distance](distance.md) from | ||
| 41 | + | ||
| 42 | +* **output:** ([QSharedPointer][QSharedPointer]<[Distance](distance.md)>) Returns a pointer to the [Distance](distance.md) described by the algorithm. | ||
| 43 | +* **example:** | ||
| 44 | + | ||
| 45 | + Distance::fromAlgorithm("EnrollmentTransform:Distance")->decription(); // returns "Distance" | ||
| 46 | + Distance::fromAlgorithm("EnrollmentTransform!Distance1+Distance2")->decription(); // returns "Pipe(distances=[Distance1,Distance2]) | ||
| 47 | + | ||
| 48 | +<!-- Links --> | ||
| 49 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 50 | +[QObject]: http://doc.qt.io/qt-5/QObject.html "QObject" | ||
| 51 | +[QSharedPointer]: http://doc.qt.io/qt-5/qsharedpointer.html "QSharedPointer" |
docs/docs/api_docs/cpp_api/factory/constructors.md
0 → 100644
| 1 | +Constructor \| Destructor | Description | ||
| 2 | +--- | --- | ||
| 3 | +Factory([QString][QString] name) | This is a special constructor in OpenBR. It is used to register new objects in the [registry](members.md#registry). | ||
| 4 | +virtual ~Factory() | Default destructor | ||
| 5 | + | ||
| 6 | +<!-- Links --> | ||
| 7 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" |
docs/docs/api_docs/cpp_api/factory/factory.md
0 → 100644
| 1 | +<!-- FACTORY --> | ||
| 2 | + | ||
| 3 | +For the run time construction of objects from strings. | ||
| 4 | + | ||
| 5 | +See: | ||
| 6 | + | ||
| 7 | +* [Members](members.md) | ||
| 8 | +* [Constructors](constructors.md) | ||
| 9 | +* [Macros](macros.md) | ||
| 10 | +* [Static Functions](statics.md) | ||
| 11 | + | ||
| 12 | +Uses the Industrial Strength Pluggable Factory model described [here](http://adtmag.com/articles/2000/09/25/industrial-strength-pluggable-factories.aspx). | ||
| 13 | + | ||
| 14 | +OpenBR's plugin architecture is premised on the idea that algorithms can be described as strings and can be built at runtime. Constructing plugins from strings is the job of the [Factory](factory.md). For a plugin to be built by the [Factory](factory.md) it must inherit from [Object](../object/object.md). It also must be registered with the factory at compile time using [BR_REGISTER](macros.md#br_register). At runtime, the [Factory](factory.md) will look up provided strings in its [registry](members.md#registry) and, if they exist, return the described plugins. |
docs/docs/api_docs/cpp_api/factory/macros.md
0 → 100644
| 1 | +## BR_REGISTER {: #br_register } | ||
| 2 | + | ||
| 3 | +A special macro to register plugins in the [Factory](factory.md)::[registry](members.md#registry). When a plugin is registered the associated abstraction type will be removed from it's name, if it exists. For example, ```BR_REGISTER(Transform, ExampleTransform)``` will be registered as "Example". Plugins *do not* have to have the abstraction as part of their name. | ||
| 4 | + | ||
| 5 | +* **macro definition:** | ||
| 6 | + | ||
| 7 | + #define BR_REGISTER(ABSTRACTION,IMPLEMENTATION) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Description | ||
| 12 | + --- | --- | ||
| 13 | + ABSTRACTION | The Abstraction that the object inherits from. The object must inherit from [Object](../object/object.md) somewhere in its inheritance tree. Abstractions should also implement ```ABSTRACTION *make()```. See [Transform](../transform/transform.md) as an example of an abstraction. | ||
| 14 | + IMPLEMENTATION | The Implementation of the object. This is the definition of the object you want returned when you call ```Factory<T>::make```. | ||
| 15 | + | ||
| 16 | +* **example:** | ||
| 17 | + | ||
| 18 | + class Implementation : public Abstraction | ||
| 19 | + { | ||
| 20 | + Q_OBJECT | ||
| 21 | + | ||
| 22 | + ... // some functions etc. | ||
| 23 | + }; | ||
| 24 | + | ||
| 25 | + BR_REGISTER(Abstraction, Implementation) |
docs/docs/api_docs/cpp_api/factory/members.md
0 → 100644
| 1 | +Member | Type | Description | ||
| 2 | +--- | --- | --- | ||
| 3 | +<a class="table-anchor" id=registry></a>registry | static [QMap][QMap]<[QString][QString],[Factory](factory.md)<<tt>T</tt>>\*> | List of all objects that have been registered with the factory. Registered objects are stored in this static registry by abstraction type. | ||
| 4 | + | ||
| 5 | +<!-- Links --> | ||
| 6 | +[QMap]: http://doc.qt.io/qt-5/qmap.html "QMap" | ||
| 7 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" |
docs/docs/api_docs/cpp_api/factory/statics.md
0 → 100644
| 1 | +## <tt>T</tt> \*make(const [File](../file/file.md) &file) {: #make } | ||
| 2 | + | ||
| 3 | +This function constructs a plugin of type <tt>T</tt> from a provided [File](../file/file.md). The [File](../file/file.md) [name](../file/members.md#name) must already be in the [registry](members.md#registry) to be made. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static T *make(const File &file) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + file | const [File](../file/file.md) & | File describing the object to be constructed | ||
| 14 | + | ||
| 15 | +* **output:** (<tt>T</tt>) Returns an object of type <tt>T</tt>. <tt>T</tt> must inherit from [Object](../object/object.md). | ||
| 16 | +* **example:** | ||
| 17 | + | ||
| 18 | + Transform *transform = Factory<Transform>::make("ExampleTransform(Property1=Value1,Property2=Value2)"); | ||
| 19 | + // returns a pointer to an instance of ExampleTransform with property1 set to value1 | ||
| 20 | + // and property2 set to value 2. | ||
| 21 | + | ||
| 22 | +## [QList][QList]<[QSharedPointer][QSharedPointer]<<tt>T</tt>>>makeAll {: #makeall } | ||
| 23 | + | ||
| 24 | +Make all of the registered plugins for a specific abstraction. | ||
| 25 | + | ||
| 26 | +* **function definition:** | ||
| 27 | + | ||
| 28 | + static QList< QSharedPointer<T> > makeAll() | ||
| 29 | + | ||
| 30 | +* **parameters:** NONE | ||
| 31 | +* **output:** ([QList][QList]<[QSharedPointer][QSharedPointer]<<tt>T</tt>>>) Returns a list of all of the objects registered to a particular abstraction <tt>T</tt> | ||
| 32 | +* **example:** | ||
| 33 | + | ||
| 34 | + BR_REGISTER(Transform, FirstTransform) | ||
| 35 | + BR_REGISTER(Transform, SecondTransform) | ||
| 36 | + | ||
| 37 | + QList<QSharedPointer<Transform> > = Factory<Transform>::makeAll(); // returns a list with pointers to FirstTransform and SecondTransform | ||
| 38 | + | ||
| 39 | + | ||
| 40 | +## [QStringList][QStringList] names() {: #names } | ||
| 41 | + | ||
| 42 | +Get the names of all of the registered objects for a specific abstraction. | ||
| 43 | + | ||
| 44 | +* **function definition:** | ||
| 45 | + | ||
| 46 | + static QStringList names() | ||
| 47 | + | ||
| 48 | +* **parameters:** NONE | ||
| 49 | +* **output:** ([QStringList][QStringList]) Returns a list of object names from the [registry](members.md#registry) | ||
| 50 | +* **example:** | ||
| 51 | + | ||
| 52 | + BR_REGISTER(Transform, FirstTransform) | ||
| 53 | + BR_REGISTER(Transform, SecondTransform) | ||
| 54 | + | ||
| 55 | + QStringList names = Factory<Transform>::names(); // returns ["First", "Second"] | ||
| 56 | + | ||
| 57 | + | ||
| 58 | +## [QString][QString] parameters(const [QString][QString] &name) {: #parameters } | ||
| 59 | + | ||
| 60 | +Get the parameters for the plugin defined by the provided name. | ||
| 61 | + | ||
| 62 | +* **function definition:** | ||
| 63 | + | ||
| 64 | + static QString parameters(const QString &name) | ||
| 65 | + | ||
| 66 | +* **parameters:** | ||
| 67 | + | ||
| 68 | + Parameter | Type | Description | ||
| 69 | + --- | --- | --- | ||
| 70 | + name | const [QString][QString] & | Name of a plugin | ||
| 71 | + | ||
| 72 | +* **output:** ([QString][QString]) Returns a string with each property and its value seperated by commas. | ||
| 73 | +* **example:** | ||
| 74 | + | ||
| 75 | + class ExampleTransform : public Transform | ||
| 76 | + { | ||
| 77 | + Q_OBJECT | ||
| 78 | + | ||
| 79 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 80 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 81 | + Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) | ||
| 82 | + BR_PROPERTY(int, property1, 1) | ||
| 83 | + BR_PROPERTY(float, property2, 2.5) | ||
| 84 | + BR_PROPERTY(QString, property3, "Value") | ||
| 85 | + | ||
| 86 | + ... | ||
| 87 | + }; | ||
| 88 | + | ||
| 89 | + Factory<Transform>::parameters("Example"); // returns "int property1 = 1, float property2 = 2.5, QString property3 = Value" | ||
| 90 | + Factory<Transform>::parameters("Example(property3=NewValue)"); // returns "int property1 = 1, float property2 = 2.5, QString property3 = NewValue" | ||
| 91 | + | ||
| 92 | +<!-- Links --> | ||
| 93 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 94 | +[QStringList]: http://doc.qt.io/qt-5/qstringlist.html "QStringList" | ||
| 95 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 96 | +[QSharedPointer]: http://doc.qt.io/qt-5/qsharedpointer.html "QSharedPointer" |
docs/docs/api_docs/cpp_api/file/constructors.md
0 → 100644
| 1 | +Constructor | Description | ||
| 2 | +--- | --- | ||
| 3 | +File() | Default constructor. Sets [name](members.md#name) to false. | ||
| 4 | +File(const [QString][QString] &file) | Initializes the file by calling the private function init. | ||
| 5 | +File(const [QString][QString] &file, const [QVariant][QVariant] &label) | Initializes the file by calling the private function init. Append label to the [metadata](members.md#m_metadata) using the key "Label". | ||
| 6 | +File(const char \*file) | Initializes the file with a c-style string. | ||
| 7 | +File(const [QVariantMap][QVariantMap] &metadata) | Sets [name](members.md#name) to false and sets the [file metadata](members.md#m_metadata) to metadata. | ||
| 8 | + | ||
| 9 | +<!-- Links --> | ||
| 10 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 11 | +[QVariant]: http://doc.qt.io/qt-5/qvariant.html "QVariant" | ||
| 12 | +[QVariantMap]: http://doc.qt.io/qt-5/qvariant.html#QVariantMap-typedef "QVariantMap" |
docs/docs/api_docs/cpp_api/file/file.md
0 → 100644
| 1 | +A file path with associated metadata. | ||
| 2 | + | ||
| 3 | +See: | ||
| 4 | + | ||
| 5 | +* [Members](members.md) | ||
| 6 | +* [Constructors](constructors.md) | ||
| 7 | +* [Static Functions](statics.md) | ||
| 8 | +* [Functions](functions.md) | ||
| 9 | + | ||
| 10 | +The File is one of two important data structures in OpenBR (the [Template](../template/template.md) is the other). | ||
| 11 | +It is typically used to store the path to a file on disk with associated metadata. | ||
| 12 | +The ability to associate a key/value metadata table with the file helps keep the API simple while providing customizable behavior. | ||
| 13 | + | ||
| 14 | +When querying the value of a metadata key, the value will first try to be resolved against the file's private metadata table. | ||
| 15 | +If the key does not exist in its local table then it will be resolved against the properties in the global Context. | ||
| 16 | +By design file metadata may be set globally using Context::setProperty to operate on all files. | ||
| 17 | + | ||
| 18 | +Files have a simple grammar that allow them to be converted to and from strings. | ||
| 19 | +If a string ends with a **]** or **)** then the text within the final **[]** or **()** are parsed as comma separated metadata fields. | ||
| 20 | +By convention, fields within **[]** are expected to have the format <tt>[key1=value1, key2=value2, ..., keyN=valueN]</tt> where order is irrelevant. | ||
| 21 | +Fields within **()** are expected to have the format <tt>(value1, value2, ..., valueN)</tt> where order matters and the key context dependent. | ||
| 22 | +The left hand side of the string not parsed in a manner described above is assigned to [name](members.md#name). | ||
| 23 | + | ||
| 24 | +Values are not necessarily stored as strings in the metadata table. | ||
| 25 | +The system will attempt to infer and convert them to their "native" type. | ||
| 26 | +The conversion logic is as follows: | ||
| 27 | + | ||
| 28 | +1. If the value starts with **[** and ends with **]** then it is treated as a comma separated list and represented with [QVariantList][QVariantList]. Each value in the list is parsed recursively. | ||
| 29 | +2. If the value starts with **(** and ends with **)** and contains four comma separated elements, each convertable to a floating point number, then it is represented with [QRectF][QRectF]. | ||
| 30 | +3. If the value starts with **(** and ends with **)** and contains two comma separated elements, each convertable to a floating point number, then it is represented with [QPointF][QPointF]. | ||
| 31 | +4. If the value is convertable to a floating point number then it is represented with <tt>float</tt>. | ||
| 32 | +5. Otherwise, it is represented with [QString][QString]. | ||
| 33 | + | ||
| 34 | +Metadata keys fall into one of two categories: | ||
| 35 | +* camelCaseKeys are inputs that specify how to process the file. | ||
| 36 | +* Capitalized_Underscored_Keys are outputs computed from processing the file. | ||
| 37 | + | ||
| 38 | +Below are some of the most commonly occurring standardized keys: | ||
| 39 | + | ||
| 40 | +Key | Value | Description | ||
| 41 | +--- | ---- | ----------- | ||
| 42 | +name | QString | Contents of [name](members.md#name) | ||
| 43 | +separator | QString | Separate [name](members.md#name) into multiple files | ||
| 44 | +Index | int | Index of a template in a template list | ||
| 45 | +Confidence | float | Classification/Regression quality | ||
| 46 | +FTE | bool | Failure to enroll | ||
| 47 | +FTO | bool | Failure to open | ||
| 48 | +\*_X | float | Position | ||
| 49 | +\*_Y | float | Position | ||
| 50 | +\*_Width | float | Size | ||
| 51 | +\*_Height | float | Size | ||
| 52 | +\*_Radius | float | Size | ||
| 53 | +Label | QString | Class label | ||
| 54 | +Theta | float | Pose | ||
| 55 | +Roll | float | Pose | ||
| 56 | +Pitch | float | Pose | ||
| 57 | +Yaw | float | Pose | ||
| 58 | +Points | QList<QPointF> | List of unnamed points | ||
| 59 | +Rects | QList<Rect> | List of unnamed rects | ||
| 60 | +Age | float | Age used for demographic filtering | ||
| 61 | +Gender | QString | Subject gender | ||
| 62 | +Train | bool | The data is for training, as opposed to enrollment | ||
| 63 | +_\* | \* | Reserved for internal use | ||
| 64 | + | ||
| 65 | +<!-- Links --> | ||
| 66 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 67 | +[QVariantList]: http://doc.qt.io/qt-5/qvariant.html#QVariantList-typedef "QVariantList" | ||
| 68 | +[QRectF]: http://doc.qt.io/qt-5/qrectf.html "QRectF" | ||
| 69 | +[QPointF]: http://doc.qt.io/qt-5/qpointf.html "QPointF" |
docs/docs/api_docs/cpp_api/file/functions.md
0 → 100644
| 1 | +## operator [QString][QString]() {: #operator-qstring } | ||
| 2 | + | ||
| 3 | +Convenience function that allows [Files](file.md) to be used as [QStrings][QString] | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + inline operator QString() const | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** ([QString][QString]) returns [name](members.md#name). | ||
| 11 | + | ||
| 12 | +## [QString][QString] flat() {: #flat } | ||
| 13 | + | ||
| 14 | +Function to output files in string formats. | ||
| 15 | + | ||
| 16 | +* **function definition:** | ||
| 17 | + | ||
| 18 | + QString flat() const | ||
| 19 | + | ||
| 20 | +* **parameters:** NONE | ||
| 21 | +* **output:** ([QString][QString]) returns the [file name](members.md#name) and [metadata](members.md#m_metadata) as a formated string. The format is *filename*[*key1=value1,key2=value2,...keyN=valueN*]. | ||
| 22 | +* **example:** | ||
| 23 | + | ||
| 24 | + File file("picture.jpg"); | ||
| 25 | + file.set("Key1", QVariant::fromValue<float>(1)); | ||
| 26 | + file.set("Key2", QVariant::fromValue<float>(2)); | ||
| 27 | + | ||
| 28 | + file.flat(); // returns "picture.jpg[Key1=1,Key2=2]" | ||
| 29 | + | ||
| 30 | + | ||
| 31 | +## [QString][QString] hash() {: #hash } | ||
| 32 | + | ||
| 33 | +Function to output a hash of the file. | ||
| 34 | + | ||
| 35 | +* **function definition:** | ||
| 36 | + | ||
| 37 | + QString hash() const | ||
| 38 | + | ||
| 39 | +* **parameters:** NONE | ||
| 40 | +* **output:** ([QString][QString]) Returns a hash of the file. | ||
| 41 | +* **example:** | ||
| 42 | + | ||
| 43 | + File file("../path/to/pictures/picture.jpg"); | ||
| 44 | + file.set("Key1", QVariant::fromValue<float>(1)); | ||
| 45 | + file.set("Key2", QVariant::fromValue<float>(2)); | ||
| 46 | + | ||
| 47 | + file.hash(); // returns "kElVwY" | ||
| 48 | + | ||
| 49 | + | ||
| 50 | +## [QStringList][QStringList] localKeys() {: #localkeys } | ||
| 51 | + | ||
| 52 | +Function to get the private [metadata](members.md#m_metadata) keys. | ||
| 53 | + | ||
| 54 | +* **function definition:** | ||
| 55 | + | ||
| 56 | + inline QStringList localKeys() const | ||
| 57 | + | ||
| 58 | +* **parameters:** NONE | ||
| 59 | +* **output:** ([QStringList][QStringList]) Returns a list of the local [metadata](members.md#m_metadata) keys. They are called local because they do not include the keys in the [global metadata](../context/context.md). | ||
| 60 | +* **example:** | ||
| 61 | + | ||
| 62 | + File file("../path/to/pictures/picture.jpg"); | ||
| 63 | + file.set("Key1", QVariant::fromValue<float>(1)); | ||
| 64 | + file.set("Key2", QVariant::fromValue<float>(2)); | ||
| 65 | + | ||
| 66 | + file.localKeys(); // returns [Key1, Key2] | ||
| 67 | + | ||
| 68 | + | ||
| 69 | +## [QVariantMap][QVariantMap] localMetadata() {: #localmetadata } | ||
| 70 | + | ||
| 71 | +Function to get the private [metadata](members.md#m_metadata). | ||
| 72 | + | ||
| 73 | +* **function definition:** | ||
| 74 | + | ||
| 75 | + inline QVariantMap localMetadata() const | ||
| 76 | + | ||
| 77 | +* **parameters:** NONE | ||
| 78 | +* **output:** ([QVariantMap][QVariantMap]) Returns the local [metadata](members.md#m_metadata). | ||
| 79 | +* **example:** | ||
| 80 | + | ||
| 81 | + File file("../path/to/pictures/picture.jpg"); | ||
| 82 | + file.set("Key1", QVariant::fromValue<float>(1)); | ||
| 83 | + file.set("Key2", QVariant::fromValue<float>(2)); | ||
| 84 | + | ||
| 85 | + file.localMetadata(); // return QMap(("Key1", QVariant(float, 1)) ("Key2", QVariant(float, 2))) | ||
| 86 | + | ||
| 87 | + | ||
| 88 | +## void append(const [QVariantMap][QVariantMap] &localMetadata) {: #append-1 } | ||
| 89 | + | ||
| 90 | +Add new metadata fields to [metadata](members.md#m_metadata). | ||
| 91 | + | ||
| 92 | +* **function definition:** | ||
| 93 | + | ||
| 94 | + void append(const QVariantMap &localMetadata) | ||
| 95 | + | ||
| 96 | +* **parameters:** | ||
| 97 | + | ||
| 98 | + Parameter | Type | Description | ||
| 99 | + --- | --- | --- | ||
| 100 | + localMetadata | const [QVariantMap][QVariantMap] & | metadata to append to the local [metadata](members.md#m_metadata) | ||
| 101 | + | ||
| 102 | +* **output:** (void) | ||
| 103 | +* **example:** | ||
| 104 | + | ||
| 105 | + File f(); | ||
| 106 | + f.set("Key1", QVariant::fromValue<float>(1)); | ||
| 107 | + | ||
| 108 | + QVariantMap map; | ||
| 109 | + map.insert("Key2", QVariant::fromValue<float>(2)); | ||
| 110 | + map.insert("Key3", QVariant::fromValue<float>(3)); | ||
| 111 | + | ||
| 112 | + f.append(map); | ||
| 113 | + f.flat(); // returns "[Key1=1, Key2=2, Key3=3]" | ||
| 114 | + | ||
| 115 | + | ||
| 116 | +## void append(const [File](file.md) &other) {: #append-2 } | ||
| 117 | + | ||
| 118 | +Append another file using the **;** separator. The [File](file.md) [names](members.md#name) are combined with the separator in between them. The [metadata](members.md#m_metadata) fields are combined. An additional field describing the separator is appended to the [metadata](members.md#m_metadata). | ||
| 119 | + | ||
| 120 | +* **function definition:** | ||
| 121 | + | ||
| 122 | + void append(const File &other) | ||
| 123 | + | ||
| 124 | +* **parameters:** | ||
| 125 | + | ||
| 126 | + Parameter | Type | Description | ||
| 127 | + --- | --- | --- | ||
| 128 | + other | const [File](file.md) & | File to append | ||
| 129 | + | ||
| 130 | +* **output:** (void) | ||
| 131 | +* **example:** | ||
| 132 | + | ||
| 133 | + File f1("../path/to/pictures/picture1.jpg"); | ||
| 134 | + f1.set("Key1", QVariant::fromValue<float>(1)); | ||
| 135 | + | ||
| 136 | + File f2("../path/to/pictures/picture2.jpg"); | ||
| 137 | + f2.set("Key2", QVariant::fromValue<float>(2)); | ||
| 138 | + f2.set("Key3", QVariant::fromValue<float>(3)); | ||
| 139 | + | ||
| 140 | + f1.append(f2); | ||
| 141 | + f1.name; // return "../path/to/pictures/picture1.jpg;../path/to/pictures/picture2.jpg" | ||
| 142 | + f1.localKeys(); // returns "[Key1, Key2, Key3, separator]" | ||
| 143 | + | ||
| 144 | + | ||
| 145 | +## [File](file.md) &operator+=(const [QMap][QMap]<[QString][QString], [QVariant][QVariant]> &other) {: #operator-pe-1 } | ||
| 146 | + | ||
| 147 | +Shortcut operator to call [append](#append-1). | ||
| 148 | + | ||
| 149 | +* **function definition:** | ||
| 150 | + | ||
| 151 | + inline File &operator+=(const QMap<QString, QVariant> &other) | ||
| 152 | + | ||
| 153 | +* **parameters:** | ||
| 154 | + | ||
| 155 | + Parameter | Type | Description | ||
| 156 | + other | const [QMap][QMap]<[QString][QString], [QVariant][QVariant]> & | Metadata map to append to the local [metadata](members.md#m_metadata) | ||
| 157 | + | ||
| 158 | +* **output:** ([File](file.md) &) Returns a reference to this file after the append occurs. | ||
| 159 | +* **example:** | ||
| 160 | + | ||
| 161 | + File f(); | ||
| 162 | + f.set("Key1", QVariant::fromValue<float>(1)); | ||
| 163 | + | ||
| 164 | + QMap<QString, QVariant> map; | ||
| 165 | + map.insert("Key2", QVariant::fromValue<float>(2)); | ||
| 166 | + map.insert("Key3", QVariant::fromValue<float>(3)); | ||
| 167 | + | ||
| 168 | + f += map; | ||
| 169 | + f.flat(); // returns "[Key1=1, Key2=2, Key3=3]" | ||
| 170 | + | ||
| 171 | + | ||
| 172 | +## [File](file.md) &operator+=(const [File](file.md) &other) {: #operator-pe-2 } | ||
| 173 | + | ||
| 174 | +Shortcut operator to call [append](#append-2). | ||
| 175 | + | ||
| 176 | +* **function definition:** | ||
| 177 | + | ||
| 178 | + inline File &operator+=(const File &other) | ||
| 179 | + | ||
| 180 | +* **parameters:** | ||
| 181 | + | ||
| 182 | + Parameter | Type | Description | ||
| 183 | + other | const [File](file.md) & | File to append | ||
| 184 | + | ||
| 185 | +* **output:** ([File](file.md) &) Returns a reference to this file after the append occurs. | ||
| 186 | +* **example:** | ||
| 187 | + | ||
| 188 | + File f1("../path/to/pictures/picture1.jpg"); | ||
| 189 | + f1.set("Key1", QVariant::fromValue<float>(1)); | ||
| 190 | + | ||
| 191 | + File f2("../path/to/pictures/picture2.jpg"); | ||
| 192 | + f2.set("Key2", QVariant::fromValue<float>(2)); | ||
| 193 | + f2.set("Key3", QVariant::fromValue<float>(3)); | ||
| 194 | + | ||
| 195 | + f1 += f2; | ||
| 196 | + f1.name; // return "../path/to/pictures/picture1.jpg;../path/to/pictures/picture2.jpg" | ||
| 197 | + f1.localKeys(); // returns "[Key1, Key2, Key3, separator]" | ||
| 198 | + | ||
| 199 | + | ||
| 200 | +## [QList][QList]<[File](file.md)> split() {: #split-1 } | ||
| 201 | + | ||
| 202 | +This function splits the [File](file.md) into multiple files and returns them as a list. This is done by parsing the file [name](members.md#name) and splitting on the separator located at [metadata](members.md#m_metadata)["separator"]. If "separator" is not a [metadata](members.md#m_metadata) key, the returned list has the original file as the only entry. Each new file has the same [metadata](members.md#m_metadata) as the original, pre-split, file. | ||
| 203 | + | ||
| 204 | +* **function definition:** | ||
| 205 | + | ||
| 206 | + QList<File> split() const | ||
| 207 | + | ||
| 208 | +* **parameters:** None | ||
| 209 | +* **output:** ([QList][QList]<[File](file.md)>) List of split files | ||
| 210 | +* **example:** | ||
| 211 | + | ||
| 212 | + File f1("../path/to/pictures/picture1.jpg"); | ||
| 213 | + f1.set("Key1", QVariant::fromValue<float>(1)); | ||
| 214 | + | ||
| 215 | + f1.split(); // returns [../path/to/pictures/picture1.jpg[Key1=1]] | ||
| 216 | + | ||
| 217 | + File f2("../path/to/pictures/picture2.jpg"); | ||
| 218 | + f2.set("Key2", QVariant::fromValue<float>(2)); | ||
| 219 | + f2.set("Key3", QVariant::fromValue<float>(3)); | ||
| 220 | + | ||
| 221 | + f1.append(f2); | ||
| 222 | + f1.split(); // returns [../path/to/pictures/picture1.jpg[Key1=1, Key2=2, Key3=3, separator=;], | ||
| 223 | + // ../path/to/pictures/picture2.jpg[Key1=1, Key2=2, Key3=3, separator=;]] | ||
| 224 | + | ||
| 225 | + | ||
| 226 | +## [QList][QList]<[File](file.md)> split(const [QString][QString] &separator) {: #split-2 } | ||
| 227 | + | ||
| 228 | +This function splits the file into multiple files and returns them as a list. This is done by parsing the file [name](members.md#name) and splitting on the given separator. Each new file has the same [metadata](members.md#m_metadata) as the original, pre-split, file. | ||
| 229 | + | ||
| 230 | +* **function definition:** | ||
| 231 | + | ||
| 232 | + QList<File> split(const QString &separator) const | ||
| 233 | + | ||
| 234 | +* **parameters:** | ||
| 235 | + | ||
| 236 | + Parameter | Type | Description | ||
| 237 | + --- | --- | --- | ||
| 238 | + separator | const [QString][QString] & | Separator to split the file name on | ||
| 239 | + | ||
| 240 | +* **output:** ([QList][QList]<[File](file.md)>) List of split files | ||
| 241 | +* **example:** | ||
| 242 | + | ||
| 243 | + File f("../path/to/pictures/picture1.jpg,../path/to/pictures/picture2.jpg"); | ||
| 244 | + f.set("Key1", QVariant::fromValue<float>(1)); | ||
| 245 | + f.set("Key2", QVariant::fromValue<float>(2)); | ||
| 246 | + | ||
| 247 | + f.split(","); // returns [../path/to/pictures/picture1.jpg[Key1=1, Key2=2], | ||
| 248 | + ../path/to/pictures/picture2.jpg[Key1=1, Key2=2]] | ||
| 249 | + | ||
| 250 | + | ||
| 251 | +## void setParameter(int index, const [QVariant][QVariant] &value) {: #setparameter } | ||
| 252 | + | ||
| 253 | +Insert a keyless value into the [metadata](members.md#m_metadata). Generic key of "ArgN" is used, where N is given as a parameter. | ||
| 254 | + | ||
| 255 | +* **function definition:** | ||
| 256 | + | ||
| 257 | + inline void setParameter(int index, const QVariant &value) | ||
| 258 | + | ||
| 259 | +* **parameters:** | ||
| 260 | + | ||
| 261 | + Parameter | Type | Description | ||
| 262 | + --- | --- | --- | ||
| 263 | + index | int | Number to append to generic key | ||
| 264 | + value | const [QVariant][QVariant] & | Value to add to the metadata | ||
| 265 | + | ||
| 266 | +* **output:** (void) | ||
| 267 | +* **see:** [containsParameter](#containsparameter), [getParameter](#getparameter) | ||
| 268 | +* **example:** | ||
| 269 | + | ||
| 270 | + File f; | ||
| 271 | + f.set("Key1", QVariant::fromValue<float>(1)); | ||
| 272 | + f.set("Key2", QVariant::fromValue<float>(2)); | ||
| 273 | + | ||
| 274 | + f.setParameter(1, QVariant::fromValue<float>(3)); | ||
| 275 | + f.setParameter(5, QVariant::fromValue<float>(4)); | ||
| 276 | + | ||
| 277 | + f.flat(); // returns "[Key1=1, Key2=2, Arg1=3, Arg5=4]" | ||
| 278 | + | ||
| 279 | + | ||
| 280 | +## bool containsParameter(int index) {: #containsparameter } | ||
| 281 | + | ||
| 282 | +Check if the local [metadata](members.md#m_metadata) contains a keyless value. | ||
| 283 | + | ||
| 284 | +* **function definition:** | ||
| 285 | + | ||
| 286 | + inline bool containsParameter(int index) const | ||
| 287 | + | ||
| 288 | +* **parameters:** | ||
| 289 | + | ||
| 290 | + Parameter | Type | Description | ||
| 291 | + --- | --- | --- | ||
| 292 | + index | int | Index of the keyless value to check for | ||
| 293 | + | ||
| 294 | +* **output:** (bool) Returns true if the local [metadata](members.md#m_metadata) contains the keyless value, otherwise reutrns false. | ||
| 295 | +* **see:** [setParameter](#setparameter), [getParameter](#getparameter) | ||
| 296 | +* **example:** | ||
| 297 | + | ||
| 298 | + File f; | ||
| 299 | + f.setParameter(1, QVariant::fromValue<float>(1)); | ||
| 300 | + f.setParameter(2, QVariant::fromValue<float>(2)); | ||
| 301 | + | ||
| 302 | + f.containsParameter(1); // returns true | ||
| 303 | + f.containsParameter(2); // returns true | ||
| 304 | + f.containsParameter(3); // returns false | ||
| 305 | + | ||
| 306 | + | ||
| 307 | +## [QVariant][QVariant] getParameter(int index) {: #getparameter } | ||
| 308 | + | ||
| 309 | +Get a keyless value from the local [metadata](members.md#m_metadata). If the value does not exist an error is thrown. | ||
| 310 | + | ||
| 311 | +* **function definition:** | ||
| 312 | + | ||
| 313 | + inline QVariant getParameter(int index) const | ||
| 314 | + | ||
| 315 | +* **parameter:** | ||
| 316 | + | ||
| 317 | + Parameter | Type | Description | ||
| 318 | + --- | --- | --- | ||
| 319 | + index | int | Index of the keyless value to look up. If the index does not exist an error is thrown. | ||
| 320 | + | ||
| 321 | +* **output:** ([QVariant][QVariant]) Returns the keyless value associated with the given index | ||
| 322 | +* **see:** [setParameter](#setparameter), [containsParameter](#containsparameter) | ||
| 323 | +* **example:** | ||
| 324 | + | ||
| 325 | + File f; | ||
| 326 | + f.setParameter(1, QVariant::fromValue<float>(1)); | ||
| 327 | + f.setParameter(2, QVariant::fromValue<float>(2)); | ||
| 328 | + | ||
| 329 | + f.getParameter(1); // returns 1 | ||
| 330 | + f.getParameter(2); // returns 2 | ||
| 331 | + f.getParameter(3); // error: index does not exist | ||
| 332 | + | ||
| 333 | + | ||
| 334 | +## bool operator==(const char \*other) {: #operator-ee-1 } | ||
| 335 | + | ||
| 336 | +Compare [name](members.md#name) against a c-style string. | ||
| 337 | + | ||
| 338 | +* **function definition:** | ||
| 339 | + | ||
| 340 | + inline bool operator==(const char *other) const | ||
| 341 | + | ||
| 342 | +* **parameters:** | ||
| 343 | + | ||
| 344 | + Parameter | Type | Description | ||
| 345 | + --- | --- | --- | ||
| 346 | + other | const char \* | C-style string to compare against | ||
| 347 | + | ||
| 348 | +* **output:** (bool) Returns true if the strings are equal, false otherwise. | ||
| 349 | +* **example:** | ||
| 350 | + | ||
| 351 | + File f("picture.jpg"); | ||
| 352 | + | ||
| 353 | + f == "picture.jpg"; // returns true | ||
| 354 | + f == "other_picture.jpg"; // returns false | ||
| 355 | + | ||
| 356 | + | ||
| 357 | +## bool operator==(const [File](file.md) &other) {: #operator-ee-2 } | ||
| 358 | + | ||
| 359 | +Compare [name](members.md#name) and [metadata](members.md#m_metadata) against another file name and metadata. | ||
| 360 | + | ||
| 361 | +* **function definition:** | ||
| 362 | + | ||
| 363 | + inline bool operator==(const File &other) const | ||
| 364 | + | ||
| 365 | +* **parameters:** | ||
| 366 | + | ||
| 367 | + Parameter | Type | Description | ||
| 368 | + --- | --- | --- | ||
| 369 | + other | const [File](file.md) & | File to compare against | ||
| 370 | + | ||
| 371 | +* **output:** (bool) Returns true if the names and metadata are equal, false otherwise. | ||
| 372 | +* **example:** | ||
| 373 | + | ||
| 374 | + File f1("picture1.jpg"); | ||
| 375 | + File f2("picture1.jpg"); | ||
| 376 | + | ||
| 377 | + f1 == f2; // returns true | ||
| 378 | + | ||
| 379 | + f1.set("Key1", QVariant::fromValue<float>(1)); | ||
| 380 | + f2.set("Key2", QVariant::fromValue<float>(2)); | ||
| 381 | + | ||
| 382 | + f1 == f2; // returns false (metadata doesn't match) | ||
| 383 | + | ||
| 384 | + | ||
| 385 | +## bool operator!=(const [File](file.md) &other) {: #operator-ne } | ||
| 386 | + | ||
| 387 | +Compare [name](members.md#name) and [metadata](members.md#m_metadata) against another file name and metadata. | ||
| 388 | + | ||
| 389 | +* **function definition:** | ||
| 390 | + | ||
| 391 | + inline bool operator!=(const File &other) const | ||
| 392 | + | ||
| 393 | +* **parameters:** | ||
| 394 | + | ||
| 395 | + Parameter | Type | Description | ||
| 396 | + --- | --- | --- | ||
| 397 | + other | const [File](file.md) & | File to compare against | ||
| 398 | + | ||
| 399 | +* **output:** (bool) Returns true if the names and metadata are not equal, false otherwise. | ||
| 400 | +* **example:** | ||
| 401 | + | ||
| 402 | + File f1("picture1.jpg"); | ||
| 403 | + File f2("picture1.jpg"); | ||
| 404 | + | ||
| 405 | + f1 != f2; // returns false | ||
| 406 | + | ||
| 407 | + f1.set("Key1", QVariant::fromValue<float>(1)); | ||
| 408 | + f2.set("Key2", QVariant::fromValue<float>(2)); | ||
| 409 | + | ||
| 410 | + f1 != f2; // returns true (metadata doesn't match) | ||
| 411 | + | ||
| 412 | + | ||
| 413 | +## bool operator<(const [File](file.md) &other) {: #operator-lt } | ||
| 414 | + | ||
| 415 | +Compare [name](members.md#name) against another file name. | ||
| 416 | + | ||
| 417 | +* **function definition:** | ||
| 418 | + | ||
| 419 | + inline bool operator<(const File &other) const | ||
| 420 | + | ||
| 421 | +* **parameters:** | ||
| 422 | + | ||
| 423 | + Parameter | Type | Description | ||
| 424 | + --- | --- | --- | ||
| 425 | + other | const [File](file.md) & | File to compare against | ||
| 426 | + | ||
| 427 | +* **output:** (bool) Returns true if [name](members.md#name) < others.name | ||
| 428 | + | ||
| 429 | + | ||
| 430 | +## bool operator<=(const [File](file.md) &other) {: #operator-lte } | ||
| 431 | + | ||
| 432 | +Compare [name](members.md#name) against another file name. | ||
| 433 | + | ||
| 434 | +* **function definition:** | ||
| 435 | + | ||
| 436 | + inline bool operator<=(const File &other) const | ||
| 437 | + | ||
| 438 | +* **parameters:** | ||
| 439 | + | ||
| 440 | + Parameter | Type | Description | ||
| 441 | + --- | --- | --- | ||
| 442 | + other | const [File](file.md) & | File to compare against | ||
| 443 | + | ||
| 444 | +* **output:** (bool) Returns true if [name](members.md#name) <= others.name | ||
| 445 | + | ||
| 446 | + | ||
| 447 | +## bool operator>(const [File](file.md) &other) {: #operator-gt } | ||
| 448 | + | ||
| 449 | +Compare [name](members.md#name) against another file name. | ||
| 450 | + | ||
| 451 | +* **function definition:** | ||
| 452 | + | ||
| 453 | + inline bool operator>(const File &other) const | ||
| 454 | + | ||
| 455 | +* **parameters:** | ||
| 456 | + | ||
| 457 | + Parameter | Type | Description | ||
| 458 | + --- | --- | --- | ||
| 459 | + other | const [File](file.md) & | File to compare against | ||
| 460 | + | ||
| 461 | +* **output:** (bool) Returns true if [name](members.md#name) > others.name | ||
| 462 | + | ||
| 463 | + | ||
| 464 | +## bool operator>=(const [File](file.md) &other) {: #operator-gte } | ||
| 465 | + | ||
| 466 | +Compare [name](members.md#name) against another file name. | ||
| 467 | + | ||
| 468 | +* **function definition:** | ||
| 469 | + | ||
| 470 | + inline bool operator>=(const File &other) const | ||
| 471 | + | ||
| 472 | +* **parameters:** | ||
| 473 | + | ||
| 474 | + Parameter | Type | Description | ||
| 475 | + --- | --- | --- | ||
| 476 | + other | const [File](file.md) & | File to compare against | ||
| 477 | + | ||
| 478 | +* **output:** (bool) Returns true if [name](members.md#name) >= others.name | ||
| 479 | + | ||
| 480 | + | ||
| 481 | +## bool isNull() {: #isnull } | ||
| 482 | + | ||
| 483 | +Check if the file is null. | ||
| 484 | + | ||
| 485 | +* **function definition:** | ||
| 486 | + | ||
| 487 | + inline bool isNull() const | ||
| 488 | + | ||
| 489 | +* **parameters:** NONE | ||
| 490 | +* **output:** (bool) Returns true if [name](members.md#name) and [metadata](members.md#m_metadata) are empty, false otherwise. | ||
| 491 | +* **example:** | ||
| 492 | + | ||
| 493 | + File f; | ||
| 494 | + f.isNull(); // returns true | ||
| 495 | + | ||
| 496 | + f.set("Key1", QVariant::fromValue<float>(1)); | ||
| 497 | + f.isNull(); // returns false | ||
| 498 | + | ||
| 499 | + | ||
| 500 | +## bool isTerminal() {: #isterminal } | ||
| 501 | + | ||
| 502 | +Checks if the value of [name](members.md#name) == "terminal". | ||
| 503 | + | ||
| 504 | +* **function definition:** | ||
| 505 | + | ||
| 506 | + inline bool isTerminal() const | ||
| 507 | + | ||
| 508 | +* **parameters:** NONE | ||
| 509 | +* **output:** (bool) Returns true if [name](members.md#name) == "terminal", false otherwise. | ||
| 510 | +* **example:** | ||
| 511 | + | ||
| 512 | + File f1("terminal"), f2("not_terminal"); | ||
| 513 | + | ||
| 514 | + f1.isTerminal(); // returns true | ||
| 515 | + f2.isTerminal(); // returns false | ||
| 516 | + | ||
| 517 | + | ||
| 518 | +## bool exists() {: #exists } | ||
| 519 | + | ||
| 520 | +Check if the file exists on disk. | ||
| 521 | + | ||
| 522 | +* **function definition:** | ||
| 523 | + | ||
| 524 | + inline bool exists() const | ||
| 525 | + | ||
| 526 | +* **parameters:** NONE | ||
| 527 | +* **output:** Returns true if [name](members.md#name) exists on disk, false otherwise. | ||
| 528 | +* **example:** | ||
| 529 | + | ||
| 530 | + File f1("/path/to/file/that/exists"), f2("/path/to/non/existant/file"); | ||
| 531 | + | ||
| 532 | + f1.exists(); // returns true | ||
| 533 | + f2.exists(); // returns false | ||
| 534 | + | ||
| 535 | + | ||
| 536 | +## [QString][QString] fileName() {: #filename } | ||
| 537 | + | ||
| 538 | +Get the file's base name and extension. | ||
| 539 | + | ||
| 540 | +* **function definition:** | ||
| 541 | + | ||
| 542 | + inline QString fileName() const | ||
| 543 | + | ||
| 544 | +* **parameters:** NONE | ||
| 545 | +* **output:** ([QString][QString]) Returns the base name + extension of [name](members.md#name) | ||
| 546 | +* **example:** | ||
| 547 | + | ||
| 548 | + File file("../path/to/pictures/picture.jpg"); | ||
| 549 | + file.fileName(); // returns "picture.jpg" | ||
| 550 | + | ||
| 551 | + | ||
| 552 | +## [QString][QString] baseName() {: #basename } | ||
| 553 | + | ||
| 554 | +Get the file's base name. | ||
| 555 | + | ||
| 556 | +* **function definition:** | ||
| 557 | + | ||
| 558 | + inline QString baseName() const | ||
| 559 | + | ||
| 560 | +* **parameters:** NONE | ||
| 561 | +* **output:** ([QString][QString]) Returns the base name of [name](members.md#name) | ||
| 562 | +* **example:** | ||
| 563 | + | ||
| 564 | + File file("../path/to/pictures/picture.jpg"); | ||
| 565 | + file.baseName(); // returns "picture" | ||
| 566 | + | ||
| 567 | + | ||
| 568 | +## [QString][QString] suffix() {: #suffix } | ||
| 569 | + | ||
| 570 | +Get the file's extension. | ||
| 571 | + | ||
| 572 | +* **function definition:** | ||
| 573 | + | ||
| 574 | + inline QString suffix() const | ||
| 575 | + | ||
| 576 | +* **parameters:** NONE | ||
| 577 | +* **output:** ([QString][QString]) Returns the extension of [name](members.md#name) | ||
| 578 | +* **example:** | ||
| 579 | + | ||
| 580 | + File file("../path/to/pictures/picture.jpg"); | ||
| 581 | + file.suffix(); // returns "jpg" | ||
| 582 | + | ||
| 583 | + | ||
| 584 | +## [QString][QString] path() {: #path } | ||
| 585 | + | ||
| 586 | +Get the path of the file without the name. | ||
| 587 | + | ||
| 588 | +* **function definition:** | ||
| 589 | + | ||
| 590 | + inline QString path() const | ||
| 591 | + | ||
| 592 | +* **parameters:** NONE | ||
| 593 | +* **output:** ([QString][QString]) Returns the path of [name](members.md#name). | ||
| 594 | +* **example:** | ||
| 595 | + | ||
| 596 | + File file("../path/to/pictures/picture.jpg"); | ||
| 597 | + file.suffix(); // returns "../path/to/pictures" | ||
| 598 | + | ||
| 599 | + | ||
| 600 | +## [QString][QString] resolved() {: #resolved } | ||
| 601 | + | ||
| 602 | +Get the full path for the file. This is done in three steps: | ||
| 603 | + | ||
| 604 | +1. If [name](members.md#name) exists, return [name](members.md#name). | ||
| 605 | +2. Prepend each path stored in [Globals->path](../context/members.md#path) to [name](members.md#name). If the combined name exists then it is returned. | ||
| 606 | +3. Prepend each path stored in [Globals->path](../context/members.md#path) to [fileName](#filename). If the combined name exists then it is returned. | ||
| 607 | + | ||
| 608 | +If none of the attempted names exist, [name](members.md#name) is returned unmodified. | ||
| 609 | + | ||
| 610 | +* **function definition:** | ||
| 611 | + | ||
| 612 | + QString resolved() const | ||
| 613 | + | ||
| 614 | +* **parameters:** NONE | ||
| 615 | +* **output:** ([QString][QString]) Returns the resolved string if it can be created. Otherwise it returns [name](members.md#name) | ||
| 616 | + | ||
| 617 | + | ||
| 618 | +## bool contains(const [QString][QString] &key) {: #contains-1 } | ||
| 619 | + | ||
| 620 | +Check if a given key is in the local [metadata](members.md#m_metadata). | ||
| 621 | + | ||
| 622 | +* **function definition:** | ||
| 623 | + | ||
| 624 | + bool contains(const QString &key) const | ||
| 625 | + | ||
| 626 | +* **parameters:** | ||
| 627 | + | ||
| 628 | + Parameter | Type | Description | ||
| 629 | + --- | --- | --- | ||
| 630 | + key | const [QString][QString] & | Key to check the [metadata](members.md#m_metadata) for | ||
| 631 | + | ||
| 632 | +* **output:** (bool) Returns true if the given key is in the [metadata](members.md#m_metadata), false otherwise. | ||
| 633 | +* **example:** | ||
| 634 | + | ||
| 635 | + File file; | ||
| 636 | + file.set("Key1", QVariant::fromValue<float>(1)); | ||
| 637 | + | ||
| 638 | + file.contains("Key1"); // returns true | ||
| 639 | + file.contains("Key2"); // returns false | ||
| 640 | + | ||
| 641 | + | ||
| 642 | +## bool contains(const [QStringList][QStringList] &keys) {: #contains-2 } | ||
| 643 | + | ||
| 644 | +Check if a list of keys is in the local [metadata](members.md#m_metadata). | ||
| 645 | + | ||
| 646 | +* **function definition:** | ||
| 647 | + | ||
| 648 | + bool contains(const QStringList &keys) const | ||
| 649 | + | ||
| 650 | +* **parameters:** | ||
| 651 | + | ||
| 652 | + Parameter | Type | Description | ||
| 653 | + --- | --- | --- | ||
| 654 | + keys | const [QStringList][QStringList] & | Keys to check the [metadata](members.md#m_metadata) for | ||
| 655 | + | ||
| 656 | +* **output:** (bool) Returns true if *all* of the given keys are in the [metadata](members.md#m_metadata), false otherwise. | ||
| 657 | +* **example:** | ||
| 658 | + | ||
| 659 | + File file; | ||
| 660 | + file.set("Key1", QVariant::fromValue<float>(1)); | ||
| 661 | + file.set("Key2", QVariant::fromValue<float>(2)); | ||
| 662 | + | ||
| 663 | + file.contains(QStringList("Key1")); // returns true | ||
| 664 | + file.contains(QStringList() << "Key1" << "Key2") // returns true | ||
| 665 | + file.contains(QStringList() << "Key1" << "Key3"); // returns false | ||
| 666 | + | ||
| 667 | + | ||
| 668 | +## [QVariant][QVariant] value(const [QString][QString] &key) {: #value } | ||
| 669 | + | ||
| 670 | +Get the value associated with a given key from the [metadata](members.md#m_metadata). If the key is not found in the [local metadata](members.md#m_metadata), the [global metadata](../context/context.md) is searched. In a special case, the key can be "name". This returns the file's [name](members.md#name). | ||
| 671 | + | ||
| 672 | +* **function description:** | ||
| 673 | + | ||
| 674 | + QVariant value(const QString &key) const | ||
| 675 | + | ||
| 676 | +* **parameters:** | ||
| 677 | + | ||
| 678 | + Parameter | Type | Description | ||
| 679 | + --- | --- | --- | ||
| 680 | + key | const [QString][QString] & | Key to look up the value in the [local metadata](members.md#m_metadata) or [global metadata](../context/context.md). The key can also be "name". | ||
| 681 | + | ||
| 682 | +* **output:** ([QVariant][QVariant]) Returns the key associated with the value from either the [local](members.md#m_metadata) or [global](../context/context.md) metadata. If the key is "name", [name](members.md#name) is returned. | ||
| 683 | +* **example:** | ||
| 684 | + | ||
| 685 | + File file; | ||
| 686 | + file.set("Key1", QVariant::fromValue<float>(1)); | ||
| 687 | + file.value("Key1"); // returns QVariant(float, 1) | ||
| 688 | + | ||
| 689 | + | ||
| 690 | +## void set(const [QString][QString] &key, const [QVariant][QVariant] &value) {: #set-1 } | ||
| 691 | + | ||
| 692 | +Insert a value into the [metadata](members.md#m_metadata) using a provided key. If the key already exists the new value will override the old one. | ||
| 693 | + | ||
| 694 | +* **function description:** | ||
| 695 | + | ||
| 696 | + inline void set(const QString &key, const QVariant &value) | ||
| 697 | + | ||
| 698 | +* **parameters:** | ||
| 699 | + | ||
| 700 | + Parameters | Type | Description | ||
| 701 | + --- | --- | --- | ||
| 702 | + key | const [QString][QString] & | Key to store the given value in the [metadata](members.md#m_metadata) | ||
| 703 | + value | const [QVariant][QVariant] & | Value to be stored | ||
| 704 | + | ||
| 705 | +* **output:** (void) | ||
| 706 | +* **example:** | ||
| 707 | + | ||
| 708 | + File f; | ||
| 709 | + f.flat(); // returns "" | ||
| 710 | + | ||
| 711 | + f.set("Key1", QVariant::fromValue<float>(1)); | ||
| 712 | + f.flat(); // returns "[Key1=1]" | ||
| 713 | + | ||
| 714 | + | ||
| 715 | +## void set(const [QString][QString] &key, const [QString][QString] &value) {: #set-2 } | ||
| 716 | + | ||
| 717 | +Insert a value into the [metadata](members.md#m_metadata) using a provided key. If the key already exists the new value will override the old one. | ||
| 718 | + | ||
| 719 | +* **function description:** | ||
| 720 | + | ||
| 721 | + void set(const QString &key, const QString &value) | ||
| 722 | + | ||
| 723 | +* **parameters:** | ||
| 724 | + | ||
| 725 | + Parameters | Type | Description | ||
| 726 | + --- | --- | --- | ||
| 727 | + key | const [QString][QString] & | Key to store the given value in the [metadata](members.md#m_metadata) | ||
| 728 | + value | const [QString][QString] & | Value to be stored | ||
| 729 | + | ||
| 730 | +* **output:** (void) | ||
| 731 | +* **example:** | ||
| 732 | + | ||
| 733 | + File f; | ||
| 734 | + f.flat(); // returns "" | ||
| 735 | + | ||
| 736 | + f.set("Key1", QString("1")); | ||
| 737 | + f.flat(); // returns "[Key1=1]" | ||
| 738 | + | ||
| 739 | + | ||
| 740 | +## void setList(const [QString][QString] &key, const [QList][QList]<T> &value) {: #setlist } | ||
| 741 | + | ||
| 742 | +Insert a list into the [metadata](members.md#m_metadata) using a provided key. If the key already exists the new value will override the old one. The value should be queried with [getList](#getlist-1) instead of [get](#get-1). | ||
| 743 | + | ||
| 744 | +* **function description:** | ||
| 745 | + | ||
| 746 | + template <typename T> void setList(const QString &key, const QList<T> &value) | ||
| 747 | + | ||
| 748 | +* **parameters:** | ||
| 749 | + | ||
| 750 | + Parameter | Type | Description | ||
| 751 | + --- | --- | --- | ||
| 752 | + key | const [QString][QString] & | Key to store the given value in the [metadata](members.md#m_metadata) | ||
| 753 | + value | const [QList][QList]<T> | List to be stored | ||
| 754 | + | ||
| 755 | +* **output:** (void) | ||
| 756 | +* **see:** [getList](#getlist-1), [get](#get-1) | ||
| 757 | +* **example:** | ||
| 758 | + | ||
| 759 | + File file; | ||
| 760 | + | ||
| 761 | + QList<float> list = QList<float>() << 1 << 2 << 3; | ||
| 762 | + file.setList<float>("List", list); | ||
| 763 | + file.getList<float>("List"); // return [1., 2. 3.] | ||
| 764 | + | ||
| 765 | + | ||
| 766 | +## void remove(const [QString][QString] &key) {: #remove } | ||
| 767 | + | ||
| 768 | +Remove a key-value pair from the [metadata](members.md#m_metadata) | ||
| 769 | + | ||
| 770 | +* **function description:** | ||
| 771 | + | ||
| 772 | + inline void remove(const QString &key) | ||
| 773 | + | ||
| 774 | +* **parameters:** | ||
| 775 | + | ||
| 776 | + Parameter | Type | Description | ||
| 777 | + --- | --- | --- | ||
| 778 | + key | const [QString][QString] & | Key to be removed from [metadata](members.md#m_metadata) along with its associated value. | ||
| 779 | + | ||
| 780 | +* **output:** (void) | ||
| 781 | +* **example:** | ||
| 782 | + | ||
| 783 | + File f; | ||
| 784 | + f.set("Key1", QVariant::fromValue<float>(1)); | ||
| 785 | + f.set("Key2", QVariant::fromValue<float>(2)); | ||
| 786 | + | ||
| 787 | + f.flat(); // returns "[Key1=1, Key2=2]" | ||
| 788 | + | ||
| 789 | + f.remove("Key1"); | ||
| 790 | + f.flat(); // returns "[Key2=2]" | ||
| 791 | + | ||
| 792 | + | ||
| 793 | +## T get(const [QString][QString] &key) {: #get-1 } | ||
| 794 | + | ||
| 795 | +Get a value from the [metadata](members.md#m_metadata) using a provided key. If the key does not exist or the value cannot be converted to a user specified type an error is thrown. | ||
| 796 | + | ||
| 797 | +* **function definition:** | ||
| 798 | + | ||
| 799 | + template <typename T> T get(const QString &key) const | ||
| 800 | + | ||
| 801 | +* **parameters:** | ||
| 802 | + | ||
| 803 | + Parameter | Type | Description | ||
| 804 | + --- | --- | --- | ||
| 805 | + key | const [QString][QString] & | Key to retrieve a value from [metadata](members.md#m_metadata) | ||
| 806 | + | ||
| 807 | +* **output:** (<tt>T</tt>) Returns a value of type <tt>T</tt>. <tt>T</tt> is a user specified type. The value associated with the given key must be convertable to <tt>T</tt>. | ||
| 808 | +* **see:** [get](#get-2), [getList](#getlist-1) | ||
| 809 | +* **example:** | ||
| 810 | + | ||
| 811 | + File f; | ||
| 812 | + f.set("Key1", QVariant::fromValue<float>(1)); | ||
| 813 | + | ||
| 814 | + f.get<float>("Key1"); // returns 1 | ||
| 815 | + f.get<float>("Key2"); // Error: Key2 is not in the metadata | ||
| 816 | + f.get<QRectF>("Key1"); // Error: A float can't be converted to a QRectF | ||
| 817 | + | ||
| 818 | +## T get(const [QString][QString] &key, const T &defaultValue) {: #get-2 } | ||
| 819 | + | ||
| 820 | +Get a value from the [metadata](members.md#m_metadata) using a provided key. If the key does not exist or the value cannot be converted to user specified type a provided default value is returned instead. | ||
| 821 | + | ||
| 822 | +* **function definition:** | ||
| 823 | + | ||
| 824 | + template <typename T> T get(const QString &key, const T &defaultValue) | ||
| 825 | + | ||
| 826 | +* **parameters:** | ||
| 827 | + | ||
| 828 | + Parameter | Type | Description | ||
| 829 | + --- | --- | --- | ||
| 830 | + key | const [QString][QString] & | Key to retrieve a value from the [metadata](members.md#m_metadata) | ||
| 831 | + defaultValue | const T & | Default value to be returned if the key does not exist or found value cannot be converted to <tt>T</tt>. <tt>T</tt> is a user specified type. | ||
| 832 | + | ||
| 833 | +* **output:** (<tt>T</tt>) Returns a value of type <tt>T</tt>. <tt>T</tt> is a user specified type. If the value associated with the key is invalid, the provided default value is returned instead. | ||
| 834 | +* **see:** [get](#get-1), [getList](#getlist-1) | ||
| 835 | +* **example:** | ||
| 836 | + | ||
| 837 | + File f; | ||
| 838 | + f.set("Key1", QVariant::fromValue<float>(1)); | ||
| 839 | + | ||
| 840 | + f.get<float>("Key1", 5); // returns 1 | ||
| 841 | + f.get<float>("Key2", 5); // returns 5 | ||
| 842 | + f.get<QRectF>("Key1", QRectF(0, 0, 10, 10)); // returns QRectF(0, 0, 10x10) | ||
| 843 | + | ||
| 844 | + | ||
| 845 | +## bool getBool(const [QString][QString] &key, bool defaultValue = false) {: #getbool } | ||
| 846 | + | ||
| 847 | +Get a boolean value from the [metadata](members.md#m_metadata) using a provided key. If the key is not in the [metadata](members.md#m_metadata) a provided default value is returned. If the key is in the metadata but the value cannot be converted to a bool true is returned. If the key is found and the value can be converted to a bool the value is returned. | ||
| 848 | + | ||
| 849 | +* **function definition:** | ||
| 850 | + | ||
| 851 | + bool getBool(const QString &key, bool defaultValue = false) const | ||
| 852 | + | ||
| 853 | +* **parameters:** | ||
| 854 | + | ||
| 855 | + Parameter | Type | Description | ||
| 856 | + --- | --- | --- | ||
| 857 | + key | const [QString][QString] & | Key to retrieve a value from the [metadata](members.md#m_metadata) | ||
| 858 | + defaultValue | bool | (Optional) Default value to be returned if the key is not in the [metadata](members.md#m_metadata). | ||
| 859 | + | ||
| 860 | +* **output:** (bool) If the key *is not* in the [metadata](members.md#m_metadata) the provided default value is returned. If the key *is* in the [metadata](members.md#m_metadata) but the associated value *cannot* be converted to a bool true is returned. If the key *is* in the [metadata](members.md#m_metadata) and the associated value *can* be converted to a bool, that value is returned. | ||
| 861 | +* **see:** [get](#get-2) | ||
| 862 | +* **example:** | ||
| 863 | + | ||
| 864 | + File f; | ||
| 865 | + f.set("Key1", QVariant::fromValue<bool>(true)); | ||
| 866 | + f.set("Key2", QVariant::fromValue<float>(10)); | ||
| 867 | + | ||
| 868 | + f.getBool("Key1"); // returns true | ||
| 869 | + f.getBool("Key2") // returns true (key found) | ||
| 870 | + f.getBool("Key3"); // returns false (default value) | ||
| 871 | + f.getBool("Key3", true); // returns true (default value) | ||
| 872 | + | ||
| 873 | + | ||
| 874 | +## [QList][QList]<T> getList(const [QString][QString] &key) {: #getlist-1 } | ||
| 875 | + | ||
| 876 | +Get a list from the [metadata](members.md#m_metadata) using a provided key. If the key does not exist or the elements of the list cannot be converted to a user specified type an error is thrown. | ||
| 877 | + | ||
| 878 | +* **function definition:** | ||
| 879 | + | ||
| 880 | + template <typename T> QList<T> getList(const QString &key) const | ||
| 881 | + | ||
| 882 | +* **parameters:** | ||
| 883 | + | ||
| 884 | + Parameter | Type | Description | ||
| 885 | + --- | --- | --- | ||
| 886 | + key | const [QString][QString] & | Key to retrieve a value from the [metadata](members.md#m_metadata) | ||
| 887 | + | ||
| 888 | +* **output:** ([QList][QList]<<tt>T</tt>>) Returns a list of values of a user specified type. | ||
| 889 | +* **see:** [setList](#setlist), [get](#get-1) | ||
| 890 | +* **example:** | ||
| 891 | + | ||
| 892 | + File file; | ||
| 893 | + | ||
| 894 | + QList<float> list = QList<float>() << 1 << 2 << 3; | ||
| 895 | + file.setList<float>("List", list); | ||
| 896 | + | ||
| 897 | + file.getList<float>("List"); // return [1., 2. 3.] | ||
| 898 | + file.getList<QRectF>("List"); // Error: float cannot be converted to QRectF | ||
| 899 | + file.getList<float>("Key"); // Error: key doesn't exist | ||
| 900 | + | ||
| 901 | + | ||
| 902 | +## [QList][QList]<T> getList(const [QString][QString] &key, const [QList][QList]<T> defaultValue) {: #getlist-2 } | ||
| 903 | + | ||
| 904 | +Get a list from the [metadata](members.md#m_metadata) using a provided key. If the key does not exist or the elements of the list cannot be converted to a user specified type a provided default value is returned. | ||
| 905 | + | ||
| 906 | +* **function definition:** | ||
| 907 | + | ||
| 908 | +template <typename T> QList<T> getList(const QString &key, const QList<T> defaultValue) const | ||
| 909 | + | ||
| 910 | +* **parameters:** | ||
| 911 | + | ||
| 912 | + Parameter | Type | Description | ||
| 913 | + --- | --- | --- | ||
| 914 | + key | const [QString][QString] & | Key to retrieve a value from the [metadata](members.md#m_metadata) | ||
| 915 | + defaultValue | [QList][QList]<<tt>T</tt> | (Optional) Default value to be returned if the key is not in the [metadata](members.md#m_metadata). | ||
| 916 | + | ||
| 917 | +* **output:** ([QList][QList]<<tt>T</tt>>) Returns a list of values of user specified type. If key is not in the [metadata](members.md#m_metadata) or if the value cannot be converted to a [QList][QList]<<tt>T</tt>> the default value is returned. | ||
| 918 | +* **see:** [getList](#getlist-1) | ||
| 919 | +* **example:** | ||
| 920 | + | ||
| 921 | + File file; | ||
| 922 | + | ||
| 923 | + QList<float> list = QList<float>() << 1 << 2 << 3; | ||
| 924 | + file.setList<float>("List", list); | ||
| 925 | + | ||
| 926 | + file.getList<float>("List", QList<float>()); // return [1., 2. 3.] | ||
| 927 | + file.getList<QRectF>("List", QList<QRectF>()); // return [] | ||
| 928 | + file.getList<float>("Key", QList<float>() << 1 << 2 << 3); // return [1., 2., 3.] | ||
| 929 | + | ||
| 930 | + | ||
| 931 | +## [QList][QList]<[QPointF][QPointF]> namedPoints() {: #namedpoints } | ||
| 932 | + | ||
| 933 | +Find values in the [metadata](members.md#m_metadata) that can be converted into [QPointF][QPointF]'s. Values stored as [QList][QList]<[QPointF][QPointF]> *will not** be returned. | ||
| 934 | + | ||
| 935 | +* **function definition:** | ||
| 936 | + | ||
| 937 | + QList<QPointF> namedPoints() const | ||
| 938 | + | ||
| 939 | +* **parameters:** NONE | ||
| 940 | +* **output:** ([QList][QList]<[QPointF][QPointF]>) Returns a list of points that can be converted from [metadata](members.md#m_metadata) values. | ||
| 941 | +* **example:** | ||
| 942 | + | ||
| 943 | + File file; | ||
| 944 | + file.set("Key1", QVariant::fromValue<QPointF>(QPointF(1, 1))); | ||
| 945 | + file.set("Key2", QVariant::fromValue<QPointF>(QPointF(2, 2))); | ||
| 946 | + file.set("Points", QVariant::fromValue<QPointF>(QPointF(3, 3))) | ||
| 947 | + | ||
| 948 | + f.namedPoints(); // returns [QPointF(1, 1), QPointF(2, 2), QPointF(3, 3)] | ||
| 949 | + | ||
| 950 | + file.setPoints(QList<QPointF>() << QPointF(3, 3)); // changes metadata["Points"] to QList<QPointF> | ||
| 951 | + f.namedPoints(); // returns [QPointF(1, 1), QPointF(2, 2)] | ||
| 952 | + | ||
| 953 | + | ||
| 954 | +## [QList][QList]<[QPointF][QPointF]> points() {: #points } | ||
| 955 | + | ||
| 956 | +Get values stored in the [metadata](members.md#m_metadata) with key "Points". It is expected that this field holds a [QList][QList]<[QPointf][QPointF]>>. | ||
| 957 | + | ||
| 958 | +* **function definition:** | ||
| 959 | + | ||
| 960 | + QList<QPointF> points() const | ||
| 961 | + | ||
| 962 | +* **parameters:** NONE | ||
| 963 | +* **output:** ([QList][QList]<[QPointf][QPointF]>>) Returns a list of points stored at [metadata](members.md#m_metadata)["Points"] | ||
| 964 | +* **see:** [appendPoint](#appendpoint), [appendPoints](#appendpoints), [clearPoints](#clearpoints), [setPoints](#setpoints) | ||
| 965 | +* **example:** | ||
| 966 | + | ||
| 967 | + File file; | ||
| 968 | + file.set("Points", QVariant::fromValue<QPointF>(QPointF(1, 1))); | ||
| 969 | + file.points(); // returns [] (point is not in a list) | ||
| 970 | + | ||
| 971 | + file.setPoints(QList<QPointF>() << QPointF(2, 2)); | ||
| 972 | + file.points(); // returns [QPointF(2, 2)] | ||
| 973 | + | ||
| 974 | + | ||
| 975 | +## void appendPoint(const [QPointF][QPointF] &point) {: #appendpoint } | ||
| 976 | + | ||
| 977 | +Append a point to the [QList][QList]<[QPointF][QPointF]> stored at [metadata](members.md#m_metadata)["Points"]. | ||
| 978 | + | ||
| 979 | +* **function definition:** | ||
| 980 | + | ||
| 981 | + void appendPoint(const QPointF &point) | ||
| 982 | + | ||
| 983 | +* **parameters:** | ||
| 984 | + | ||
| 985 | + Parameter | Type | Description | ||
| 986 | + --- | --- | --- | ||
| 987 | + point | const [QPoint][QPoint] & | Point to be appended | ||
| 988 | + | ||
| 989 | +* **output:** (void) | ||
| 990 | +* **example:** | ||
| 991 | + | ||
| 992 | + File file; | ||
| 993 | + file.points(); // returns [] | ||
| 994 | + | ||
| 995 | + file.appendPoint(QPointF(1, 1)); | ||
| 996 | + file.points(); // returns [QPointF(1, 1)] | ||
| 997 | + | ||
| 998 | + | ||
| 999 | +## void appendPoints(const [QList][QList]<[QPointF][QPointF]> &points) {: #appendpoints } | ||
| 1000 | + | ||
| 1001 | +Append a list of points to the [QList][QList]<[QPointF][QPointF]> stored at [metadata](members.md#m_metadata)["Points"]. | ||
| 1002 | + | ||
| 1003 | +* **function definition:** | ||
| 1004 | + | ||
| 1005 | + void appendPoints(const QList<QPointF> &points) | ||
| 1006 | + | ||
| 1007 | +* **parameters:** | ||
| 1008 | + | ||
| 1009 | + Parameter | Type | Description | ||
| 1010 | + --- | --- | --- | ||
| 1011 | + points | const [QList][QList]<[QPointF][QPointF]> & | List of points to be appended | ||
| 1012 | + | ||
| 1013 | +* **output:** (void) | ||
| 1014 | +* **example:** | ||
| 1015 | + | ||
| 1016 | + File file; | ||
| 1017 | + file.points(); // returns [] | ||
| 1018 | + | ||
| 1019 | + file.appendPoints(QList<QPointF>() << QPointF(1, 1) << QPointF(2, 2)); | ||
| 1020 | + file.points(); // returns [QPointF(1, 1), QPointF(2, 2)] | ||
| 1021 | + | ||
| 1022 | + | ||
| 1023 | +## void clearPoints() {: #clearpoints } | ||
| 1024 | + | ||
| 1025 | +Remove all points stored at [metadata](members.md#m_metadata)["Points"]. | ||
| 1026 | + | ||
| 1027 | +* **function definition:** | ||
| 1028 | + | ||
| 1029 | + inline void clearPoints() | ||
| 1030 | + | ||
| 1031 | +* **parameters:** NONE | ||
| 1032 | +* **output:** (void) | ||
| 1033 | +* **example:** | ||
| 1034 | + | ||
| 1035 | + File file; | ||
| 1036 | + file.appendPoints(QList<QPointF>() << QPointF(1, 1) << QPointF(2, 2)); | ||
| 1037 | + file.points(); // returns [QPointF(1, 1), QPointF(2, 2)] | ||
| 1038 | + | ||
| 1039 | + file.clearPoints(); | ||
| 1040 | + file.points(); // returns [] | ||
| 1041 | + | ||
| 1042 | + | ||
| 1043 | +## void setPoints(const [QList][QList]<[QPointF][QPointF]> &points) {: #setpoints } | ||
| 1044 | + | ||
| 1045 | +Replace the points stored at [metadata](members.md#m_metadata)["Points"] | ||
| 1046 | + | ||
| 1047 | +* **function definition:** | ||
| 1048 | + | ||
| 1049 | + inline void setPoints(const QList<QPointF> &points) | ||
| 1050 | + | ||
| 1051 | +* **parameters:** | ||
| 1052 | + | ||
| 1053 | + Parameter | Type | Description | ||
| 1054 | + --- | --- | --- | ||
| 1055 | + points | const [QList][QList]<[QPointF][QPointF]> & | Points to overwrite [metadata](members.md#m_metadata) with | ||
| 1056 | + | ||
| 1057 | +* **output:** (void) | ||
| 1058 | +* **example:** | ||
| 1059 | + | ||
| 1060 | + File file; | ||
| 1061 | + file.appendPoints(QList<QPointF>() << QPointF(1, 1) << QPointF(2, 2)); | ||
| 1062 | + file.points(); // returns [QPointF(1, 1), QPointF(2, 2)] | ||
| 1063 | + | ||
| 1064 | + file.setPoints(QList<QPointF>() << QPointF(3, 3) << QPointF(4, 4)); | ||
| 1065 | + file.points(); // returns [QPointF(3, 3), QPointF(4, 4)] | ||
| 1066 | + | ||
| 1067 | + | ||
| 1068 | +## [QList][QList]<[QRectF][QRectF]> namedRects() {: #namedrects } | ||
| 1069 | + | ||
| 1070 | +Find values in the [metadata](members.md#m_metadata) that can be converted into [QRectF][QRectF]'s. Values stored as [QList][QList]<[QRectF][QRectF]> *will not** be returned. | ||
| 1071 | + | ||
| 1072 | +* **function definition:** | ||
| 1073 | + | ||
| 1074 | + QList<QRectF> namedRects() const | ||
| 1075 | + | ||
| 1076 | +* **parameters:** NONE | ||
| 1077 | +* **output:** ([QList][QList]<[QRectF][QRectF]>) Returns a list of rects that can be converted from [metadata](members.md#m_metadata) values. | ||
| 1078 | +* **example:** | ||
| 1079 | + | ||
| 1080 | + File file; | ||
| 1081 | + file.set("Key1", QVariant::fromValue<QRectF>(QRectF(1, 1, 5, 5))); | ||
| 1082 | + file.set("Key2", QVariant::fromValue<QRectF>(QRectF(2, 2, 5, 5))); | ||
| 1083 | + file.set("Rects", QVariant::fromValue<QRectF>(QRectF(3, 3, 5, 5))); | ||
| 1084 | + | ||
| 1085 | + f.namedRects(); // returns [QRectF(1, 1, 5x5), QRectF(2, 2, 5x5), QRectF(3, 3, 5x5)] | ||
| 1086 | + | ||
| 1087 | + file.setRects(QList<QRectF>() << QRectF(3, 3, 5x5)); // changes metadata["Rects"] to QList<QRectF> | ||
| 1088 | + f.namedRects(); // returns [QRectF(1, 1, 5x5), QRectF(2, 2, 5x5)] | ||
| 1089 | + | ||
| 1090 | + | ||
| 1091 | +## [QList][QList]<[QRectF][QRectF]> rects() {: #rects } | ||
| 1092 | + | ||
| 1093 | +Get values stored at [metadata](members.md#m_metadata)["Rects"]. It is expected that this field holds a [QList][QList]<[QRectf][QRectF]>>. | ||
| 1094 | + | ||
| 1095 | +* **function definition:** | ||
| 1096 | + | ||
| 1097 | + QList<QRectF> points() const | ||
| 1098 | + | ||
| 1099 | +* **parameters:** NONE | ||
| 1100 | +* **output:** ([QList][QList]<[QRectf][QRectF]>>) Returns a list of rects stored at [metadata](members.md#m_metadata)["Rects"] | ||
| 1101 | +* **see:** [appendRect](#appendrect-1), [appendRects](#appendrects-1), [clearRects](#clearrects), [setRects](#setrects-1) | ||
| 1102 | +* **example:** | ||
| 1103 | + | ||
| 1104 | + File file; | ||
| 1105 | + file.set("Rects", QVariant::fromValue<QRectF>(QRectF(1, 1, 5, 5))); | ||
| 1106 | + file.rects(); // returns [] (rect is not in a list) | ||
| 1107 | + | ||
| 1108 | + file.setRects(QList<QRectF>() << QRectF(2, 2, 5, 5)); | ||
| 1109 | + file.rects(); // returns [QRectF(2, 2, 5x5)] | ||
| 1110 | + | ||
| 1111 | + | ||
| 1112 | +## void appendRect(const [QRectF][QRectF] &rect) {: #appendrect-1 } | ||
| 1113 | + | ||
| 1114 | +Append a rect to the [QList][QList]<[QRectF][QRectF]> stored at [metadata](members.md#m_metadata)["Rects"]. | ||
| 1115 | + | ||
| 1116 | +* **function definition:** | ||
| 1117 | + | ||
| 1118 | + void appendRect(const QRectF &rect) | ||
| 1119 | + | ||
| 1120 | +* **parameters:** | ||
| 1121 | + | ||
| 1122 | + Parameter | Type | Description | ||
| 1123 | + --- | --- | --- | ||
| 1124 | + rect | const [QRect][QRect] & | Rect to be appended | ||
| 1125 | + | ||
| 1126 | +* **output:** (void) | ||
| 1127 | +* **example:** | ||
| 1128 | + | ||
| 1129 | + File file; | ||
| 1130 | + file.rects(); // returns [] | ||
| 1131 | + | ||
| 1132 | + file.appendRect(QRectF(1, 1, 5, 5)); | ||
| 1133 | + file.rects(); // returns [QRectF(1, 1, 5x5)] | ||
| 1134 | + | ||
| 1135 | + | ||
| 1136 | +## void appendRect(const [Rect][Rect] &rect) {: #appendrect-2 } | ||
| 1137 | + | ||
| 1138 | +Append an OpenCV-style [Rect][Rect] to the [QList][QList]<[QRectF][QRectF]> stored at [metadata](members.md#m_metadata)["Rects"]. Supplied OpenCV-style rects are converted to [QRectF][QRectF] before being appended. | ||
| 1139 | + | ||
| 1140 | +* **function definition:** | ||
| 1141 | + | ||
| 1142 | + void appendRect(const Rect &rect) | ||
| 1143 | + | ||
| 1144 | +* **parameters:** | ||
| 1145 | + | ||
| 1146 | + Parameter | Type | Description | ||
| 1147 | + --- | --- | --- | ||
| 1148 | + rect | const [Rect][Rect] & | OpenCV-style rect to be appended | ||
| 1149 | + | ||
| 1150 | +* **output:** (void) | ||
| 1151 | +* **example:** | ||
| 1152 | + | ||
| 1153 | + File file; | ||
| 1154 | + file.rects(); // returns [] | ||
| 1155 | + | ||
| 1156 | + file.appendRect(cv::Rect(1, 1, 5, 5)); // automatically converted to QRectF | ||
| 1157 | + file.rects(); // returns [QRectF(1, 1, 5x5)] | ||
| 1158 | + | ||
| 1159 | + | ||
| 1160 | +## void appendRects(const [QList][QList]<[QRectF][QRectF]> &rects) {: #appendrects-1 } | ||
| 1161 | + | ||
| 1162 | +Append a list of rects to the [QList][QList]<[QRectF][QRectF]> stored at [metadata](members.md#m_metadata)["Rects"]. | ||
| 1163 | + | ||
| 1164 | +* **function definition:** | ||
| 1165 | + | ||
| 1166 | + void appendRects(const QList<QRectF> &rects) | ||
| 1167 | + | ||
| 1168 | +* **parameters:** | ||
| 1169 | + | ||
| 1170 | + Parameter | Type | Description | ||
| 1171 | + --- | --- | --- | ||
| 1172 | + rects | const [QList][QList]<[QRectF][QRectF]> & | List of rects to be appended | ||
| 1173 | + | ||
| 1174 | +* **output:** (void) | ||
| 1175 | +* **example:** | ||
| 1176 | + | ||
| 1177 | + File file; | ||
| 1178 | + file.rects(); // returns [] | ||
| 1179 | + | ||
| 1180 | + file.appendRects(QList<QRectF>() << QRectF(1, 1, 5, 5) << QRectF(2, 2, 5, 5)); | ||
| 1181 | + file.rects(); // returns [QRectF(1, 1, 5x5), QRectF(2, 2, 5x5)] | ||
| 1182 | + | ||
| 1183 | + | ||
| 1184 | +## void appendRects(const [QList][QList]<[QRectF][QRectF]> &rects) {: #appendrects-2 } | ||
| 1185 | + | ||
| 1186 | +Append a list of OpenCV-style [Rects][Rect] to the [QList][QList]<[QRectF][QRectF]> stored at [metadata](members.md#m_metadata)["Rects"]. Supplied OpenCV-style rects are converted to [QRectF][QRectF] before being appended. | ||
| 1187 | + | ||
| 1188 | +* **function definition:** | ||
| 1189 | + | ||
| 1190 | + void appendRects(const QList<QRectF> &rects) | ||
| 1191 | + | ||
| 1192 | +* **parameters:** | ||
| 1193 | + | ||
| 1194 | + Parameter | Type | Description | ||
| 1195 | + --- | --- | --- | ||
| 1196 | + rects | const [QList][QList]<[Rect][Rect]> & | List of OpenCV-style rects to be appended | ||
| 1197 | + | ||
| 1198 | +* **output:** (void) | ||
| 1199 | +* **example:** | ||
| 1200 | + | ||
| 1201 | + File file; | ||
| 1202 | + file.rects(); // returns [] | ||
| 1203 | + | ||
| 1204 | + file.appendRects(QList<Rect>() << Rect(1, 1, 5, 5) << Rect(2, 2, 5, 5)); | ||
| 1205 | + file.rects(); // returns [QRectF(1, 1, 5x5), QRectF(2, 2, 5x5)] | ||
| 1206 | + | ||
| 1207 | +## void clearRects() {: #clearrects } | ||
| 1208 | + | ||
| 1209 | +Remove all points stored at [metadata](members.md#m_metadata)["Rects"]. | ||
| 1210 | + | ||
| 1211 | +* **function definition:** | ||
| 1212 | + | ||
| 1213 | + inline void clearRects() | ||
| 1214 | + | ||
| 1215 | +* **parameters:** NONE | ||
| 1216 | +* **output:** (void) | ||
| 1217 | +* **example:** | ||
| 1218 | + | ||
| 1219 | + File file; | ||
| 1220 | + file.appendRects(QList<QRectF>() << QRectF(1, 1, 5, 5) << QRectF(2, 2, 5, 5)); | ||
| 1221 | + file.rects(); // returns [QRectF(1, 1, 5x5), QRectF(2, 2, 5x5)] | ||
| 1222 | + | ||
| 1223 | + file.clearRects(); | ||
| 1224 | + file.rects(); // returns [] | ||
| 1225 | + | ||
| 1226 | + | ||
| 1227 | +## void setRects(const [QList][QList]<[QRectF][QRectF]> &rects) {: #setrects-1 } | ||
| 1228 | + | ||
| 1229 | +Replace the rects stored at [metadata](members.md#m_metadata) with a provided list of rects. | ||
| 1230 | + | ||
| 1231 | +* **function definition:** | ||
| 1232 | + | ||
| 1233 | + inline void setRects(const QList<QRectF> &rects) | ||
| 1234 | + | ||
| 1235 | +* **parameters:** | ||
| 1236 | + | ||
| 1237 | + Parameter | Type | Description | ||
| 1238 | + --- | --- | --- | ||
| 1239 | + rects | const [QList][QList]<[QRectF][QRectF]> & | Rects to overwrite [metadata](members.md#m_metadata)["Rects"] with | ||
| 1240 | + | ||
| 1241 | +* **output:** (void) | ||
| 1242 | +* **example:** | ||
| 1243 | + | ||
| 1244 | + File file; | ||
| 1245 | + file.appendRects(QList<QRectF>() << QRectF(1, 1, 5, 5) << QRectF(2, 2, 5, 5)); | ||
| 1246 | + file.rects(); // returns [QRectF(1, 1, 5x5), QRectF(2, 2, 5x5)] | ||
| 1247 | + | ||
| 1248 | + file.setRects(QList<QRectF>() << QRectF(3, 3, 5, 5) << QRectF(4, 4, 5, 5)); | ||
| 1249 | + file.rects(); // returns [QRectF(3, 3, 5x5), QRectF(4, 4, 5x5)] | ||
| 1250 | + | ||
| 1251 | + | ||
| 1252 | +## void setRects(const [QList][QList]<[Rect][Rect]> &rects) {: #setrects-2 } | ||
| 1253 | + | ||
| 1254 | +Replace the rects stored at [metadata](members.md#m_metadata) with a provided list of OpenCV-style [Rects][Rect]. | ||
| 1255 | + | ||
| 1256 | +* **function definition:** | ||
| 1257 | + | ||
| 1258 | + inline void setRects(const QList<Rect> &rects) | ||
| 1259 | + | ||
| 1260 | +* **parameters:** | ||
| 1261 | + | ||
| 1262 | + Parameter | Type | Description | ||
| 1263 | + --- | --- | --- | ||
| 1264 | + rects | const [QList][QList]<[Rect][Rect]> & | OpenCV-style rects to overwrite [metadata](members.md#m_metadata)["Rects"] with | ||
| 1265 | + | ||
| 1266 | +* **output:** (void) | ||
| 1267 | +* **example:** | ||
| 1268 | + | ||
| 1269 | + File file; | ||
| 1270 | + file.appendRects(QList<cv::Rect>() << cv::Rect(1, 1, 5, 5) << cv::Rect(2, 2, 5, 5)); | ||
| 1271 | + file.rects(); // returns [QRectF(1, 1, 5x5), QRectF(2, 2, 5x5)] | ||
| 1272 | + | ||
| 1273 | + file.setRects(QList<cv::Rect>() << cv::Rect(3, 3, 5, 5) << cv::Rect(4, 4, 5, 5)); | ||
| 1274 | + file.rects(); // returns [QRectF(3, 3, 5x5), QRectF(4, 4, 5x5)] | ||
| 1275 | + | ||
| 1276 | +<!-- Links --> | ||
| 1277 | +[Qt]: http://qt-project.org/ "Qt" | ||
| 1278 | +[QApplication]: http://doc.qt.io/qt-5/qapplication.html "QApplication" | ||
| 1279 | +[QCoreApplication]: http://doc.qt.io/qt-5/qcoreapplication.html "QCoreApplication" | ||
| 1280 | +[QObject]: http://doc.qt.io/qt-5/QObject.html "QObject" | ||
| 1281 | +[Qt Property System]: http://doc.qt.io/qt-5/properties.html "Qt Property System" | ||
| 1282 | + | ||
| 1283 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 1284 | +[QStringList]: http://doc.qt.io/qt-5/qstringlist.html "QStringList" | ||
| 1285 | + | ||
| 1286 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 1287 | +[QMap]: http://doc.qt.io/qt-5/qmap.html "QMap" | ||
| 1288 | +[QHash]: http://doc.qt.io/qt-5/qhash.html "QHash" | ||
| 1289 | + | ||
| 1290 | +[QRectF]: http://doc.qt.io/qt-5/qrectf.html "QRectF" | ||
| 1291 | +[QPoint]: http://doc.qt.io/qt-5/qpoint.html "QPoint" | ||
| 1292 | +[QPointF]: http://doc.qt.io/qt-5/qpointf.html "QPointF" | ||
| 1293 | + | ||
| 1294 | +[QVariant]: http://doc.qt.io/qt-5/qvariant.html "QVariant" | ||
| 1295 | +[QVariantList]: http://doc.qt.io/qt-5/qvariant.html#QVariantList-typedef "QVariantList" | ||
| 1296 | +[QVariantMap]: http://doc.qt.io/qt-5/qvariant.html#QVariantMap-typedef "QVariantMap" | ||
| 1297 | + | ||
| 1298 | +[QRegExp]: http://doc.qt.io/qt-5/QRegExp.html "QRegExp" | ||
| 1299 | +[QThread]: http://doc.qt.io/qt-5/qthread.html "QThread" | ||
| 1300 | +[QFile]: http://doc.qt.io/qt-5/qfile.html "QFile" | ||
| 1301 | + | ||
| 1302 | +[QSharedPointer]: http://doc.qt.io/qt-5/qsharedpointer.html "QSharedPointer" | ||
| 1303 | + | ||
| 1304 | +[QTime]: http://doc.qt.io/qt-5/QTime.html "QTime" | ||
| 1305 | +[QDebug]: http://doc.qt.io/qt-5/qdebug.html "QDebug" | ||
| 1306 | +[QDataStream]: http://doc.qt.io/qt-5/qdatastream.html "QDataStream" | ||
| 1307 | +[QByteArray]: http://doc.qt.io/qt-5/qbytearray.html "QByteArray" | ||
| 1308 | + | ||
| 1309 | +[R]: http://www.r-project.org/ "R" | ||
| 1310 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" | ||
| 1311 | +[Rect]: http://docs.opencv.org/modules/core/doc/basic_structures.html#rect "Rect" | ||
| 1312 | +[InputArray]: http://docs.opencv.org/modules/core/doc/basic_structures.html#inputarray "InputArray" | ||
| 1313 | +[OutputArray]: http://docs.opencv.org/modules/core/doc/basic_structures.html#outputarray "OutputArray" | ||
| 1314 | +[OpenCV Image Formats]: http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imread#imread "OpenCV Image Formats" |
docs/docs/api_docs/cpp_api/file/members.md
0 → 100644
| 1 | +Member | Type | Description | ||
| 2 | +--- | --- | --- | ||
| 3 | +<a class="table-anchor" id="name"></a>name | [QString][QString] | Path to a file on disk | ||
| 4 | +<a class="table-anchor" id=fte></a>fte | bool | Failed to enroll. If true this file failed to be processed somewhere in the template enrollment algorithm | ||
| 5 | +<a class="table-anchor" id=m_metadata></a>m_metadata | [QVariantMap][QVariantMap] | Map for storing metadata. It is a [QString][QString], [QVariant][QVariant] key value pairing. | ||
| 6 | + | ||
| 7 | +<!-- Links --> | ||
| 8 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 9 | +[QVariant]: http://doc.qt.io/qt-5/qvariant.html "QVariant" | ||
| 10 | +[QVariantMap]: http://doc.qt.io/qt-5/qvariant.html#QVariantMap-typedef "QVariantMap" |
docs/docs/api_docs/cpp_api/file/statics.md
0 → 100644
| 1 | +## [QVariant][QVariant] parse(const [QString][QString] &value) {: #parse } | ||
| 2 | + | ||
| 3 | +Try to convert a given value to a [QPointF][QPointF], [QRectF][QRectF], int or float. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static QVariant parse(const QString &value); | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + value | const [QString][QString] & | String value to be converted. | ||
| 14 | + | ||
| 15 | +* **output:** ([QVariant][QVariant]) The converted file if a conversion was possible. Otherwise the unconverted string is returned. | ||
| 16 | +* **example:** | ||
| 17 | + | ||
| 18 | + QString point = "(1, 1)"; | ||
| 19 | + QString rect = "(1, 1, 5, 5)"; | ||
| 20 | + QString integer = "1"; | ||
| 21 | + QString fp = "1.0"; | ||
| 22 | + QString string = "Hello World"; | ||
| 23 | + | ||
| 24 | + File::parse(point); // returns QVariant(QPointF, QPointF(1, 1)) | ||
| 25 | + File::parse(rect); // returns QVariant(QRectF, QRectF(1, 1, 5x5)) | ||
| 26 | + File::parse(integer); // returns QVariant(int, 1) | ||
| 27 | + File::parse(fp); // returns QVariant(float, 1.0f) | ||
| 28 | + File::parse(string); // returns QVariant(QString, "Hello World") | ||
| 29 | + | ||
| 30 | + | ||
| 31 | +## [QList][QList]<[QVariant][QVariant]> values(const [QList][QList]<U> &fileList, const [QString][QString] &key) {: #values } | ||
| 32 | + | ||
| 33 | +Gather a list of [QVariant][QVariant] values associated with a metadata key from a provided list of files. | ||
| 34 | + | ||
| 35 | +* **function definition:** | ||
| 36 | + | ||
| 37 | + template<class U> static [QList<QVariant> values(const QList<U> &fileList, const QString &key) | ||
| 38 | + | ||
| 39 | +* **parameters:** | ||
| 40 | + | ||
| 41 | + Parameter | Type | Description | ||
| 42 | + --- | --- | --- | ||
| 43 | + fileList | const [QList][QList]<U> & | A list of files to parse for values. A type is required for <tt>U</tt>. Valid options are: <ul> <li>[File](file.md)</li> <li>[QString][QString]</li> </ul> | ||
| 44 | + key | const [QString][QString] & | A metadata key used to lookup the values. | ||
| 45 | + | ||
| 46 | +* **output:** ([QList][QList]<[QVariant][QVariant]>) A list of [QVariant][QVariant] values associated with the given key in each of the provided files. | ||
| 47 | +* **example:** | ||
| 48 | + | ||
| 49 | + File f1, f2; | ||
| 50 | + f1.set("Key1", QVariant::fromValue<float>(1)); | ||
| 51 | + f1.set("Key2", QVariant::fromValue<float>(2)); | ||
| 52 | + f2.set("Key1", QVariant::fromValue<float>(3)); | ||
| 53 | + | ||
| 54 | + File::values<File>(QList<File>() << f1 << f2, "Key1"); // returns [QVariant(float, 1), | ||
| 55 | + // QVariant(float, 3)] | ||
| 56 | + | ||
| 57 | + | ||
| 58 | +## [QList][QList]<T> get(const [QList][QList]<U> &fileList, const [QString][QString] &key) {: #get-1 } | ||
| 59 | + | ||
| 60 | +Gather a list of <tt>T</tt> values associated with a metadata key from a provided list of files. <tt>T</tt> is a user provided type. If the key does not exist in the metadata of *any* file an error is thrown. | ||
| 61 | + | ||
| 62 | +* **function definition:** | ||
| 63 | + | ||
| 64 | + template<class T, class U> static QList<T> get(const QList<U> &fileList, const QString &key) | ||
| 65 | + | ||
| 66 | +* **parameters:** | ||
| 67 | + | ||
| 68 | + Parameter | Type | Description | ||
| 69 | + --- | --- | --- | ||
| 70 | + fileList | const [QList][QList]<U> & | A list of files to parse for values. A type is required for U. Valid options are: <ul> <li>[File](file.md)</li> <li>[QString][QString]</li> </ul> | ||
| 71 | + key | const [QString][QString] & | A metadata key used to lookup the values. | ||
| 72 | + | ||
| 73 | +* **output:** ([QList][QList]<T>) A list of the values of type <tt>T</tt> associated with the given key. A type is required for <tt>T</tt>. | ||
| 74 | +* **example:** | ||
| 75 | + | ||
| 76 | + File f1, f2; | ||
| 77 | + f1.set("Key1", QVariant::fromValue<float>(1)); | ||
| 78 | + f1.set("Key2", QVariant::fromValue<float>(2)); | ||
| 79 | + f2.set("Key1", QVariant::fromValue<float>(3)); | ||
| 80 | + | ||
| 81 | + File::get<float, File>(QList<File>() << f1 << f2, "Key1"); // returns [1., 3.] | ||
| 82 | + File::get<float, File>(QList<File>() << f1 << f2, "Key2"); // Error: Key doesn't exist in f2 | ||
| 83 | + File::get<QRectF, File>(QList<File>() << f1 << f2, "Key1"); // Error: float is not convertable to QRectF | ||
| 84 | + | ||
| 85 | + | ||
| 86 | +## [QList][QList]<T> get(const [QList][QList]<U> &fileList, const [QString][QString] &key, const T &defaultValue) {: #get-2 } | ||
| 87 | + | ||
| 88 | +Gather a list of <tt>T</tt> values associated with a metadata key from a provided list of files. <tt>T</tt> is a user provided type. If the key does not exist in the metadata of *any* file the provided **defaultValue** is used. | ||
| 89 | + | ||
| 90 | +* **function definition:** | ||
| 91 | + | ||
| 92 | + template<class T, class U> static QList<T> get(const QList<U> &fileList, const QString &key, const T &defaultValue) | ||
| 93 | + | ||
| 94 | +* **parameters:** | ||
| 95 | + | ||
| 96 | + Parameter | Type | Description | ||
| 97 | + --- | --- | --- | ||
| 98 | + fileList | const [QList][QList]<U> & | A list of files to parse for values. A type is required for U. Valid options are: <ul> <li>[File](file.md)</li> <li>[QString][QString]</li> </ul> | ||
| 99 | + key | const [QString][QString] & | A metadata key used to lookup the values. | ||
| 100 | + defaultValue | const T & | The default value if the key is not in a file's metadata. A type is required for T. All types are valid. | ||
| 101 | + | ||
| 102 | +* **output:** ([QList][QList]<T>) A list of the values of type <tt>T</tt> associated with the given key. A type is required for <tt>T</tt>. | ||
| 103 | +* **example:** | ||
| 104 | + | ||
| 105 | + File f1, f2; | ||
| 106 | + f1.set("Key1", QVariant::fromValue<float>(1)); | ||
| 107 | + f1.set("Key2", QVariant::fromValue<float>(2)); | ||
| 108 | + f2.set("Key1", QVariant::fromValue<float>(3)); | ||
| 109 | + | ||
| 110 | + File::get<float, File>(QList<File>() << f1 << f2, "Key1"); // returns [1., 3.] | ||
| 111 | + File::get<float, File>(QList<File>() << f1 << f2, "Key2", QList<float>() << 1); // returns [1.] | ||
| 112 | + File::get<QRectF, File>(QList<File>() << f1 << f2, "Key1, QList<QRectF>()"); // returns [] | ||
| 113 | + | ||
| 114 | + | ||
| 115 | +## [QDebug][QDebug] operator <<([QDebug][QDebug] dbg, const [File](file.md) &file) {: #dbg-operator-ltlt } | ||
| 116 | + | ||
| 117 | +Calls [flat](functions.md#flat) on the given file and then streams that file to stderr. | ||
| 118 | + | ||
| 119 | +* **function definition:** | ||
| 120 | + | ||
| 121 | + QDebug operator <<(QDebug dbg, const File &file) | ||
| 122 | + | ||
| 123 | +* **parameter:** | ||
| 124 | + | ||
| 125 | + Parameter | Type | Description | ||
| 126 | + --- | --- | --- | ||
| 127 | + dbg | [QDebug][QDebug] | The debug stream | ||
| 128 | + file | const [File](file.md) & | File to stream | ||
| 129 | + | ||
| 130 | +* **output:** ([QDebug][QDebug] &) returns a reference to the updated debug stream | ||
| 131 | +* **example:** | ||
| 132 | + | ||
| 133 | + File file("../path/to/pictures/picture.jpg"); | ||
| 134 | + file.set("Key", QString("Value")); | ||
| 135 | + | ||
| 136 | + qDebug() << file; // "../path/to/pictures/picture.jpg[Key=Value]" streams to stderr | ||
| 137 | + | ||
| 138 | + | ||
| 139 | +## [QDataStream][QDataStream] &operator <<([QDataStream][QDatastream] &stream, const [File](file.md) &file) {: #stream-operator-ltlt } | ||
| 140 | + | ||
| 141 | +Serialize a file to a data stream. | ||
| 142 | + | ||
| 143 | +* **function definition:** | ||
| 144 | + | ||
| 145 | + QDataStream &operator <<(QDataStream &stream, const File &file) | ||
| 146 | + | ||
| 147 | +* **parameters:** | ||
| 148 | + | ||
| 149 | + Parameter | Type | Description | ||
| 150 | + --- | --- | --- | ||
| 151 | + stream | [QDataStream][QDataStream] | The data stream | ||
| 152 | + file | const [File](file.md) & | File to stream | ||
| 153 | + | ||
| 154 | +* **output:** ([QDataStream][QDataStream] &) returns a reference to the updated data stream | ||
| 155 | +* **example:** | ||
| 156 | + | ||
| 157 | + void store(QDataStream &stream) | ||
| 158 | + { | ||
| 159 | + File file("../path/to/pictures/picture.jpg"); | ||
| 160 | + file.set("Key", QString("Value")); | ||
| 161 | + | ||
| 162 | + stream << file; // "../path/to/pictures/picture.jpg[Key=Value]" serialized to the stream | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + | ||
| 166 | +## [QDataStream][QDataStream] &operator >>([QDataStream][QDataStream] &stream, const [File](file.md) &file) {: #stream-operator-gtgt } | ||
| 167 | + | ||
| 168 | +Deserialize a file from a data stream. | ||
| 169 | + | ||
| 170 | +* **function definition:** | ||
| 171 | + | ||
| 172 | + QDataStream &operator >>(QDataStream &stream, const File &file) | ||
| 173 | + | ||
| 174 | +* **parameters:** | ||
| 175 | + | ||
| 176 | + Parameter | Type | Description | ||
| 177 | + --- | --- | --- | ||
| 178 | + stream | [QDataStream][QDataStream] | The data stream | ||
| 179 | + file | const [File](file.md) & | File to stream | ||
| 180 | + | ||
| 181 | +* **output:** ([QDataStream][QDataStream] &) returns a reference to the updated data stream | ||
| 182 | +* **example:** | ||
| 183 | + | ||
| 184 | + void load(QDataStream &stream) | ||
| 185 | + { | ||
| 186 | + File in("../path/to/pictures/picture.jpg"); | ||
| 187 | + in.set("Key", QString("Value")); | ||
| 188 | + | ||
| 189 | + stream << in; // "../path/to/pictures/picture.jpg[Key=Value]" serialized to the stream | ||
| 190 | + | ||
| 191 | + File out; | ||
| 192 | + stream >> out; | ||
| 193 | + | ||
| 194 | + out.name; // returns "../path/to/pictures/picture.jpg" | ||
| 195 | + out.flat(); // returns "../path/to/pictures/picture.jpg[Key=Value]" | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | +<!-- Links --> | ||
| 199 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 200 | +[QVariant]: http://doc.qt.io/qt-5/qvariant.html "QVariant" | ||
| 201 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 202 | +[QDebug]: http://doc.qt.io/qt-5/qdebug.html "QDebug" | ||
| 203 | +[QDataStream]: http://doc.qt.io/qt-5/qdatastream.html "QDataStream" | ||
| 204 | +[QRectF]: http://doc.qt.io/qt-5/qrectf.html "QRectF" | ||
| 205 | +[QPointF]: http://doc.qt.io/qt-5/qpointf.html "QPointF" |
docs/docs/api_docs/cpp_api/filegallery/constructors.md
0 → 100644
docs/docs/api_docs/cpp_api/filegallery/filegallery.md
0 → 100644
| 1 | +<!-- FILE GALLERY --> | ||
| 2 | + | ||
| 3 | +Inherits [Gallery](../gallery/gallery.md) | ||
| 4 | + | ||
| 5 | +A [Gallery](../gallery/gallery.md) that handles data stored on disk (as opposed to data already in memory). | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Members](members.md) | ||
| 10 | +* [Constructors](constructors.md) | ||
| 11 | +* [Functions](functions.md) | ||
| 12 | + | ||
| 13 | +[FileGalleries](filegallery.md) are the base abstraction for all [Galleries](../gallery/gallery.md) that handle I/O with the hard drive. They automatically track the size and current position of a file and also provide convienience opererators for opening them for reading and writing. |
docs/docs/api_docs/cpp_api/filegallery/functions.md
0 → 100644
| 1 | +## void init() {: #init } | ||
| 2 | + | ||
| 3 | +Initialize the [FileGallery](filegallery.md). This sets [f](members.md#f) using the file name from [file](../object/members.md#file). It also calls [Gallery](../gallery/gallery.md)::[init](../object/functions.md#init). | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + void init() | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** (void) | ||
| 11 | + | ||
| 12 | +## qint64 totalSize() {: #totalsize } | ||
| 13 | + | ||
| 14 | +Get the total size of the file. This is useful for estimating progress. | ||
| 15 | + | ||
| 16 | +* **function definition:** | ||
| 17 | + | ||
| 18 | + qint64 totalSize() | ||
| 19 | + | ||
| 20 | +* **parameters:** NONE | ||
| 21 | +* **output:** (qint64) Returns the total size of the file in bytes | ||
| 22 | + | ||
| 23 | +## qint64 position() {: #pos } | ||
| 24 | + | ||
| 25 | +Get the current index in the file. This is useful for reading and writing blocks of data | ||
| 26 | + | ||
| 27 | +* **function definition:** | ||
| 28 | + | ||
| 29 | + qint64 position() | ||
| 30 | + | ||
| 31 | +* **parameters:** NONE | ||
| 32 | +* **output:** (qint64) Returns the current position in the file | ||
| 33 | + | ||
| 34 | +## bool readOpen() {: #readopen } | ||
| 35 | + | ||
| 36 | +Open [f](members.md#f) in read-only mode | ||
| 37 | + | ||
| 38 | +* **function definition:** | ||
| 39 | + | ||
| 40 | + bool readOpen() | ||
| 41 | + | ||
| 42 | +* **parameters:** NONE | ||
| 43 | +* **output:** (bool) Returns true if the file was opened successfully, false otherwise | ||
| 44 | + | ||
| 45 | +## void writeOnly() {: #writeonly } | ||
| 46 | + | ||
| 47 | +Open [f](members.md#f) in write-only mode | ||
| 48 | + | ||
| 49 | +* **function definition:** | ||
| 50 | + | ||
| 51 | + void writeOpen() | ||
| 52 | + | ||
| 53 | +* **parameters:** NONE | ||
| 54 | +* **output:** (void) |
docs/docs/api_docs/cpp_api/filegallery/members.md
0 → 100644
docs/docs/api_docs/cpp_api/filelist/constructors.md
0 → 100644
| 1 | +Constructor | Description | ||
| 2 | +--- | --- | ||
| 3 | +FileList() | Default constructor. Doesn't do anything. | ||
| 4 | +FileList(int n) | Intialize the [FileList](filelist.md) with n empty [Files](../file/file.md) | ||
| 5 | +FileList(const [QStringList][QStringList] &files) | Initialize the [FileList](filelist.md) with a list of strings. Each string should have the format "filename[key1=value1, key2=value2, ... keyN=valueN]" | ||
| 6 | +FileList(const [QList][QList]<[File](../file/file.md)> &files) | Initialize the [FileList](filelist.md) from a list of [files](../file/file.md). | ||
| 7 | + | ||
| 8 | +<!-- Links --> | ||
| 9 | +[QStringList]: http://doc.qt.io/qt-5/qstringlist.html "QStringList" | ||
| 10 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" |
docs/docs/api_docs/cpp_api/filelist/filelist.md
0 → 100644
| 1 | +Inherits [QList][QList]<[File](../file/file.md)>. | ||
| 2 | + | ||
| 3 | +See: | ||
| 4 | + | ||
| 5 | +* [Constructors](constructors.md) | ||
| 6 | +* [Static Functions](statics.md) | ||
| 7 | +* [Functions](functions.md) | ||
| 8 | + | ||
| 9 | +A convenience class for dealing with lists of files. | ||
| 10 | + | ||
| 11 | +<!-- Links --> | ||
| 12 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" |
docs/docs/api_docs/cpp_api/filelist/functions.md
0 → 100644
| 1 | +## [QStringList][QStringList] flat() const {: #flat } | ||
| 2 | + | ||
| 3 | +Calls [flat](../file/functions.md#flat) on every [File](../file/file.md) in the list and returns the resulting strings as a [QStringList][QStringList]. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + QStringList flat() const | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** ([QStringList][QStringList]) Returns a list of the output of calling [flat](../file/functions.md#flat) on each [File](../file/file.md) | ||
| 11 | +* **example:** | ||
| 12 | + | ||
| 13 | + File f1("picture1.jpg"), f2("picture2.jpg"); | ||
| 14 | + f1.set("Key", QString("Value")); | ||
| 15 | + | ||
| 16 | + FileList fList(QList<File>() << f1 << f2); | ||
| 17 | + fList.flat(); // returns ["picture1.jpg[Key=Value]", "picture2.jpg"] | ||
| 18 | + | ||
| 19 | + | ||
| 20 | +## [QStringList][QStringList] names() const {: #names } | ||
| 21 | + | ||
| 22 | +Get the [names](../file/members.md#name) of every [File](../file/file.md) in the list. | ||
| 23 | + | ||
| 24 | +* **function definition:** | ||
| 25 | + | ||
| 26 | + QStringList names() const | ||
| 27 | + | ||
| 28 | +* **parameters:** NONE | ||
| 29 | +* **output:** ([QStringList][QStringList]) Returns the [name](../file/members.md#name) of every [File](../file/file.md) in the list | ||
| 30 | +* **example:** | ||
| 31 | + | ||
| 32 | + File f1("picture1.jpg"), f2("picture2.jpg"); | ||
| 33 | + f1.set("Key", QString("Value")); | ||
| 34 | + | ||
| 35 | + FileList fList(QList<File>() << f1 << f2); | ||
| 36 | + fList.names(); // returns ["picture1.jpg", "picture2.jpg"] | ||
| 37 | + | ||
| 38 | + | ||
| 39 | +## void sort(const [QString][QString] &key) {: #sort } | ||
| 40 | + | ||
| 41 | +Sort the [FileList](filelist.md) based on the values associated with a provided key in each [File](../file/file.md). | ||
| 42 | + | ||
| 43 | +* **function definition:** | ||
| 44 | + | ||
| 45 | + void sort(const QString &key) | ||
| 46 | + | ||
| 47 | +* **parameters:** | ||
| 48 | + | ||
| 49 | + Parameter | Type | Description | ||
| 50 | + --- | --- | --- | ||
| 51 | + key | const [QString][QString] & | Key to look up desired values in each [Files](../file/file.md) [metadata](../file/members.md#m_metadata) | ||
| 52 | + | ||
| 53 | +* **output:** (void) | ||
| 54 | +* **example:** | ||
| 55 | + | ||
| 56 | + File f1("1"), f2("2"), f3("3"); | ||
| 57 | + f1.set("Key", QVariant::fromValue<float>(3)); | ||
| 58 | + f2.set("Key", QVariant::fromValue<float>(1)); | ||
| 59 | + f3.set("Key", QVariant::fromValue<float>(2)); | ||
| 60 | + | ||
| 61 | + FileList fList(QList<File>() << f1 << f2 << f3); | ||
| 62 | + fList.names(); // returns ["1", "2", "3"] | ||
| 63 | + | ||
| 64 | + fList.sort("Key"); | ||
| 65 | + fList.names(); // returns ["2", "3", "1"] | ||
| 66 | + | ||
| 67 | + | ||
| 68 | +## [QList][QList]<int> crossValidationPartitions() const {: #crossvalidationpartitions } | ||
| 69 | + | ||
| 70 | +Get the cross-validation partion of each [File](../file/file.md) in the list. The partition is stored in each [File](../file/file.md) at [metadata](../file/members.md#m_metadata)["Partition"]. | ||
| 71 | + | ||
| 72 | +* **function definition:** | ||
| 73 | + | ||
| 74 | + QList<int> crossValidationPartitions() const | ||
| 75 | + | ||
| 76 | +* **parameters:** NONE | ||
| 77 | +* **output:** ([QList][QList]<int>) Returns the cross-validation partion of each [File](../file/file.md) as a list. If a [File](../file/file.md) does not have the "Partition" field in it's [metadata](../file/members.md#m_metadata) 0 is used. | ||
| 78 | +* **example:** | ||
| 79 | + | ||
| 80 | + File f1, f2, f3; | ||
| 81 | + f1.set("Partition", QVariant::fromValue<int>(1)); | ||
| 82 | + f3.set("Partition", QVariant::fromValue<int>(3)); | ||
| 83 | + | ||
| 84 | + FileList fList(QList<File>() << f1 << f2 << f3); | ||
| 85 | + fList.crossValidationPartitions(); // returns [1, 0, 3] | ||
| 86 | + | ||
| 87 | + | ||
| 88 | +## int failures() const {: #failures } | ||
| 89 | + | ||
| 90 | +Get the number of [Files](../file/file.md) in the list that have [failed to enroll](../file/members.md#fte). | ||
| 91 | + | ||
| 92 | +* **function definition:** | ||
| 93 | + | ||
| 94 | + int failures() const | ||
| 95 | + | ||
| 96 | +* **parameters:** NONE | ||
| 97 | +* **output:** (int) Returns the number of [Files](../file/file.md) that have [fte](../file/members.md#fte) equal true. | ||
| 98 | +* **example:** | ||
| 99 | + | ||
| 100 | + File f1, f2, f3; | ||
| 101 | + f1.fte = false; | ||
| 102 | + f2.fte = true; | ||
| 103 | + f3.fte = true; | ||
| 104 | + | ||
| 105 | + FileList fList(QList<File>() << f1 << f2 << f3); | ||
| 106 | + fList.failures(); // returns 2 | ||
| 107 | + | ||
| 108 | +<!-- Links --> | ||
| 109 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 110 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 111 | +[QStringList]: http://doc.qt.io/qt-5/qstringlist.html "QStringList" |
docs/docs/api_docs/cpp_api/filelist/statics.md
0 → 100644
| 1 | +## [FileList](filelist.md) fromGallery(const [File](../file/file.md) &gallery, bool cache = false) {: #fromgallery } | ||
| 2 | + | ||
| 3 | +Create a [FileList](filelist.md) from a [Gallery](../gallery/gallery.md). Galleries store one or more [Templates](../template/template.md) on disk. Common formats include **csv**, **xml**, and **gal**, which is a unique OpenBR format. Read more about this in the [Gallery](../gallery/gallery.md) section. This function creates a [FileList](filelist.md) by parsing the stored gallery based on its format. Cache determines whether the gallery should be stored for faster reading later. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static FileList fromGallery(const File &gallery, bool cache = false) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + gallery | const [File](../file/file.md) & | Gallery file to be enrolled | ||
| 14 | + cache | bool | (Optional) Retain the gallery in memory. Default is false. | ||
| 15 | + | ||
| 16 | +* **output:** ([FileList](filelist.md)) Returns the filelist that the gallery was enrolled into | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + File gallery("gallery.csv"); | ||
| 20 | + | ||
| 21 | + FileList fList = FileList::fromGallery(gallery); | ||
| 22 | + fList.flat(); // returns all the files that have been loaded from disk. It could | ||
| 23 | + // be 1 or 100 depending on what was stored. |
docs/docs/api_docs/cpp_api/format/constructors.md
0 → 100644
docs/docs/api_docs/cpp_api/format/format.md
0 → 100644
| 1 | +<!-- FORMAT --> | ||
| 2 | + | ||
| 3 | +Inherits [Object](../object/object.md) | ||
| 4 | + | ||
| 5 | +Plugin base class for reading a template from disk. | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Constructors](constructors.md) | ||
| 10 | +* [Static Functions](statics.md) | ||
| 11 | +* [Functions](functions.md) | ||
| 12 | + | ||
| 13 | +A *format* is a [File](../file/file.md) representing a [Template](../template/template.md) on disk. [File](../file/file.md)::[suffix](../file/functions.md#suffix) is used to determine which derived format plugin should handle a file. Currently supported extensions are: | ||
| 14 | + | ||
| 15 | +* [OpenCV image formats][OpenCV Image Formats] | ||
| 16 | +* xml | ||
| 17 | +* scores | ||
| 18 | +* url | ||
| 19 | +* raw | ||
| 20 | +* post | ||
| 21 | +* null | ||
| 22 | +* mtx | ||
| 23 | +* mask | ||
| 24 | +* mat | ||
| 25 | +* lffs | ||
| 26 | +* ebts | ||
| 27 | +* csv | ||
| 28 | +* binary | ||
| 29 | + | ||
| 30 | +Many of these extensions are unique to OpenBR. Please look at the relevant [Format plugin](../../../plugin_docs/format.md) for information on formatting and other concerns. | ||
| 31 | + | ||
| 32 | +<!-- Links --> | ||
| 33 | +[OpenCV Image Formats]: http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imread#imread "OpenCV Image Formats" |
docs/docs/api_docs/cpp_api/format/functions.md
0 → 100644
| 1 | +## [Template](../template/template.md) read() {: #read } | ||
| 2 | + | ||
| 3 | +This is a pure virtual function. Read a template from disk at [file](../object/members.md#file). | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + virtual Template read() const = 0 | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** ([Template](../template/template.md)) Returns a template loaded from disk | ||
| 11 | +* **example:** | ||
| 12 | + | ||
| 13 | + Format *format = Factory::make<Format>("picture.jpg") | ||
| 14 | + format->read(); // returns a template loaded from "picture.jpg" | ||
| 15 | + | ||
| 16 | +## void write(const [Template](../template/template.md) &t) {: #write } | ||
| 17 | + | ||
| 18 | +This is a pure virtual function. Write a provide template to disk at [file](../object/members.md#file) | ||
| 19 | + | ||
| 20 | +* **function definition:** | ||
| 21 | + | ||
| 22 | + virtual void write(const Template &t) const = 0 | ||
| 23 | + | ||
| 24 | +* **parameters:** | ||
| 25 | + | ||
| 26 | + Parameter | Type | Description | ||
| 27 | + --- | --- | --- | ||
| 28 | + t | const [Template](../template/template.md) & | [Template](../template/template.md) to write to disk | ||
| 29 | + | ||
| 30 | +* **output:** (void) | ||
| 31 | +* **example:** | ||
| 32 | + | ||
| 33 | + Format *format = Factory::make<Format>("new_pic_location.jpg"); | ||
| 34 | + | ||
| 35 | + Template t("picture.jpg"); | ||
| 36 | + format->write(t); // write t to "new_pic_location" |
docs/docs/api_docs/cpp_api/format/statics.md
0 → 100644
| 1 | +## [Template](../template/template.md) read(const [QString][QString] &file) {: #read } | ||
| 2 | + | ||
| 3 | +Read a [Template](../template/template.md) from disk at the provide file location. A derived class format is chosen based on the suffix of the provided file. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | +static Template read(const QString &file) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + file | const [QString][QString] & | File to load a [Template](../template/template.md) from. | ||
| 14 | + | ||
| 15 | +* **output:** ([Template](../template/template.md)) Returns a [Template](../template/template.md) loaded from disk. | ||
| 16 | +* **example:** | ||
| 17 | + | ||
| 18 | + Format::read("picture.jpg"); // returns a template loaded from "picture.jpg". The proper Format to load jpg images is selected automatically | ||
| 19 | + | ||
| 20 | + | ||
| 21 | +## void write(const [QString][QString] &file, const [Template](../template/template.md) &t) {: #write } | ||
| 22 | + | ||
| 23 | +Write a template to disk at the provided file location. | ||
| 24 | + | ||
| 25 | +* **function definition:** | ||
| 26 | + | ||
| 27 | + static void write(const QString &file, const Template &t) | ||
| 28 | + | ||
| 29 | +* **parameters:** | ||
| 30 | + | ||
| 31 | + Parameter | Type | Description | ||
| 32 | + --- | --- | --- | ||
| 33 | + file | const [QString][QString] & | File to write a [Template](../template/template.md) to | ||
| 34 | + t | const [Template](../template/template.md) & | [Template](../template/template.md) to write to disk | ||
| 35 | + | ||
| 36 | +* **output:** (void) | ||
| 37 | +* **example:** | ||
| 38 | + | ||
| 39 | + Template t("picture.jpg"); | ||
| 40 | + | ||
| 41 | + Format::write("new_pic_location.jpg", t); // Write t to "new_pic_location.jpg" | ||
| 42 | + | ||
| 43 | +<!-- Links --> | ||
| 44 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" |
docs/docs/api_docs/cpp_api/gallery/constructors.md
0 → 100644
docs/docs/api_docs/cpp_api/gallery/functions.md
0 → 100644
| 1 | +## [TemplateList](../templatelist/templatelist.md) read() {: #read } | ||
| 2 | + | ||
| 3 | +Read all of them templates stored in the [Gallery](gallery.md) from disk into memory. For incremental reads see [readBlock](#readblock) | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + TemplateList read() | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** ([TemplateList](../templatelist/templatelist.md)) Returns a list of all of the templates read from disk | ||
| 11 | +* **example:** | ||
| 12 | + | ||
| 13 | + Gallery *gallery = Gallery::make("gallery_file.xml"); | ||
| 14 | + gallery->read(); // returns a TemplateList of every template stored in the gallery | ||
| 15 | + | ||
| 16 | +<!--no italics*--> | ||
| 17 | + | ||
| 18 | +## [FileList](../filelist/filelist.md) files() {: #files } | ||
| 19 | + | ||
| 20 | +Read all of the filese stored in the [Gallery](gallery.md) from disk into memory. | ||
| 21 | + | ||
| 22 | +* **function definition:** | ||
| 23 | + | ||
| 24 | + FileList files() | ||
| 25 | + | ||
| 26 | +* **parameters:** NONE | ||
| 27 | +* **output:** ([FileList](../filelist/filelist.md)) Returns a list of all of the files read from disk | ||
| 28 | +* **example:** | ||
| 29 | + | ||
| 30 | + Gallery *gallery = Gallery::make("gallery_file.xml"); | ||
| 31 | + gallery->files(); // returns a FileList of every file stored in the gallery | ||
| 32 | + | ||
| 33 | +<!--no italics*--> | ||
| 34 | + | ||
| 35 | +## [TemplateList](../templatelist/templatelist.md) readBlock(bool \*done) {: #readblock } | ||
| 36 | + | ||
| 37 | +This is a pure virtual function. Incrementally read a block of templates from disk into memory. The size of the block is set by [readBlockSize](properties.md#readblocksize). | ||
| 38 | + | ||
| 39 | +* **function definition:** | ||
| 40 | + | ||
| 41 | + virtual TemplateList readBlock(bool *done) = 0 | ||
| 42 | + | ||
| 43 | +* **parameters:** | ||
| 44 | + | ||
| 45 | + Parameter | Type | Description | ||
| 46 | + --- | --- | --- | ||
| 47 | + done | bool \* | Set to true by the function if the last block has been read, false otherwise | ||
| 48 | + | ||
| 49 | +* **output:** ([TemplateList](../templatelist/templatelist.md)) Returns a block of templates loaded from disk | ||
| 50 | +* **example:** | ||
| 51 | + | ||
| 52 | + Gallery *gallery = Gallery::make("gallery_file.xml"); | ||
| 53 | + | ||
| 54 | + bool done = false | ||
| 55 | + while(!done) | ||
| 56 | + gallery->readBlock(&done); // Each iteration of the loop reads a new block until the end of the gallery is reached | ||
| 57 | + | ||
| 58 | +<!--no italics*--> | ||
| 59 | + | ||
| 60 | +## void writeBlock(const [TemplateList](../templatelist/templatelist.md) &templates) {: #writeblock } | ||
| 61 | + | ||
| 62 | +Write the provided templates to disk. This function calls [write](#write) which should be overloaded by all derived classes. If the gallery is a linked list (see [make](statics.md#make)) each gallery writes the provided templates sequentially. | ||
| 63 | + | ||
| 64 | +* **function definition:** | ||
| 65 | + | ||
| 66 | + void writeBlock(const TemplateList &templates) | ||
| 67 | + | ||
| 68 | +* **parameters:** | ||
| 69 | + | ||
| 70 | + Parameter | Type | Description | ||
| 71 | + --- | --- | --- | ||
| 72 | + templates | const [TemplateList](../templatelist/templatelist.md) & | List of templates to write to disk | ||
| 73 | + | ||
| 74 | +* **output:** (void) | ||
| 75 | +* **example:** | ||
| 76 | + | ||
| 77 | + Template t1("picture1.jpg"); | ||
| 78 | + t1.file.set("property", 1); | ||
| 79 | + Template t2("picture2.jpg"); | ||
| 80 | + t2.file.set("property", 2) | ||
| 81 | + | ||
| 82 | + TemplateList tList = TemplateList() << t1 << t2; | ||
| 83 | + | ||
| 84 | + Gallery *gallery = Gallery::make("gallery_file.xml"); | ||
| 85 | + gallery->writeBlock(tList); // write the templatelist to disk | ||
| 86 | + | ||
| 87 | +<!--no italics*--> | ||
| 88 | + | ||
| 89 | +## void write(const [Template](../template/template.md) &t) {: #write } | ||
| 90 | + | ||
| 91 | +This is a pure virtual function. Write a single template to disk. | ||
| 92 | + | ||
| 93 | +* **function definition:** | ||
| 94 | + | ||
| 95 | + virtual void write(const Template &t) = 0 | ||
| 96 | + | ||
| 97 | +* **parameters:** | ||
| 98 | + | ||
| 99 | + Parameter | Type | Description | ||
| 100 | + --- | --- | --- | ||
| 101 | + t | const [Template](../template/template.md) & | Template to write to disk | ||
| 102 | + | ||
| 103 | +* **output:** (void) | ||
| 104 | +* **example:** | ||
| 105 | + | ||
| 106 | + Template t1("picture1.jpg"); | ||
| 107 | + t1.file.set("property", 1); | ||
| 108 | + Template t2("picture2.jpg"); | ||
| 109 | + t2.file.set("property", 2) | ||
| 110 | + | ||
| 111 | + Gallery *gallery = Gallery::make("gallery_file.xml"); | ||
| 112 | + gallery->write(t1); // write template1 to disk | ||
| 113 | + gallery->write(t2); // write template2 to disk | ||
| 114 | + | ||
| 115 | +## qint64 totalSize() {: #totalsize } | ||
| 116 | + | ||
| 117 | +This is a virtual function. Get the total size of the gallery. Default implementation returns <tt>INT_MAX</tt>. | ||
| 118 | + | ||
| 119 | +* **function definition:** | ||
| 120 | + | ||
| 121 | + virtual qint64 totalSize() | ||
| 122 | + | ||
| 123 | +* **parameters:** NONE | ||
| 124 | +* **output:** (qint64) Returns the total size of the gallery in bytes | ||
| 125 | + | ||
| 126 | + | ||
| 127 | +## qint64 position() {: #position } | ||
| 128 | + | ||
| 129 | +This is a virtual function. Get the current position of the read index in the gallery. The next call to [readBlock](#readblock) will read starting at the reported position. | ||
| 130 | + | ||
| 131 | +* **function output:** | ||
| 132 | + | ||
| 133 | + virtual qint64 position() | ||
| 134 | + | ||
| 135 | +* **parameters:** NONE | ||
| 136 | +* **output:** (qint64) Returns the current read position in the gallery | ||
| 137 | +* **example:** | ||
| 138 | + | ||
| 139 | + Gallery *gallery = Gallery::make("gallery_file.xml"); | ||
| 140 | + | ||
| 141 | + gallery->position(); // returns 0 | ||
| 142 | + bool done; gallery->readBlock(&done); | ||
| 143 | + gallery->position(); // returns readBlockSize |
docs/docs/api_docs/cpp_api/gallery/gallery.md
0 → 100644
| 1 | +<!-- GALLERY --> | ||
| 2 | + | ||
| 3 | +Inherits [Object](../object/object.md) | ||
| 4 | + | ||
| 5 | +Plugin base class for storing a list of enrolled templates. | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Properties](properties.md) | ||
| 10 | +* [Constructors](constructors.md) | ||
| 11 | +* [Static Functions](statics.md) | ||
| 12 | +* [Functions](functions.md) | ||
| 13 | + | ||
| 14 | +A *gallery* is a file representing a [TemplateList](../templatelist/templatelist.md) serialized to disk. [File](../file/file.md)::[suffix](../file/functions.md#suffix) is used to determine which plugin should handle the gallery. The currently supported extensions are | ||
| 15 | + | ||
| 16 | +* xml | ||
| 17 | +* avi | ||
| 18 | +* wmv | ||
| 19 | +* mp4 | ||
| 20 | +* webcam | ||
| 21 | +* vbb (OpenCV format) | ||
| 22 | +* txt | ||
| 23 | +* turk | ||
| 24 | +* template | ||
| 25 | +* stat | ||
| 26 | +* seq | ||
| 27 | +* post | ||
| 28 | +* mem (**NOTE:** Mem galleries live only in RAM; they should be used for caching and not for normal I/O) | ||
| 29 | +* matrix | ||
| 30 | +* landmarks | ||
| 31 | |||
| 32 | +* flat | ||
| 33 | +* FDDB | ||
| 34 | +* db | ||
| 35 | +* csv | ||
| 36 | +* crawl | ||
| 37 | +* gal | ||
| 38 | +* ut | ||
| 39 | +* url | ||
| 40 | +* json | ||
| 41 | +* arff | ||
| 42 | + | ||
| 43 | +Many of these extensions are unique to OpenBR. Please look at the relevant [Gallery plugin](../../../plugin_docs/gallery.md) for information on formatting and other concerns. |
docs/docs/api_docs/cpp_api/gallery/properties.md
0 → 100644
docs/docs/api_docs/cpp_api/gallery/statics.md
0 → 100644
| 1 | +## [Gallery](gallery.md) \*make(const [File](../file/file.md) &file) {: #make } | ||
| 2 | + | ||
| 3 | +Make a [Gallery](gallery.md) from a string. The provided file is first split using [File](../file/file.md)::[split](../file/functions.md#split-1) and each resulting file is turned into a [Gallery](gallery.md) that is stored in a linked-list. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static Gallery *make(const File &file) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + file | const [File](../file/file.md) & | File describing the gallery or galleries to construct | ||
| 14 | + | ||
| 15 | +* **output:** ([Gallery](gallery.md) \*) Returns a pointer to the first gallery in the linked list | ||
| 16 | +* **example:** | ||
| 17 | + | ||
| 18 | + Gallery *gallery1 = Gallery::make("gallery_file.xml"); // returns a pointer to the gallery | ||
| 19 | + Gallery *gallery2 = Gallery::make("gallery_file1.xml;gallery_file2.xml"); // returns a pointer to the gallery created with "gallery_file1.xml" with a pointer to the gallery created with "gallery_file2.xml" |
docs/docs/api_docs/cpp_api/initializer/constructors.md
0 → 100644
docs/docs/api_docs/cpp_api/initializer/functions.md
0 → 100644
| 1 | +## void initialize() {: #initialize } | ||
| 2 | + | ||
| 3 | +This is a pure virtual function. It is called once at the end of [initialize](../context/statics.md#initialize). Any global initialization that needs to occur should occur within this function. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + virtual void initialize() const = 0 | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** (void) | ||
| 11 | + | ||
| 12 | +## void finalize() {: #finalize } | ||
| 13 | + | ||
| 14 | +This is a virtual function. It is called once at the beginning of [finalize](../context/statics.md#finalize). Any global finalization should occur within this function. This includes deallocating anything that was allocated in [initialize](#initialize) | ||
| 15 | + | ||
| 16 | +* **function definition**: | ||
| 17 | + | ||
| 18 | + virtual void finalize() const | ||
| 19 | + | ||
| 20 | +* **parameters:** NONE | ||
| 21 | +* **output:** (void) |
docs/docs/api_docs/cpp_api/initializer/initializer.md
0 → 100644
| 1 | +<!-- INITIALIZER --> | ||
| 2 | + | ||
| 3 | +Inherits [Object](../object/object.md) | ||
| 4 | + | ||
| 5 | +See: | ||
| 6 | + | ||
| 7 | +* [Constructors](constructors.md) | ||
| 8 | +* [Functions](functions.md) | ||
| 9 | + | ||
| 10 | +Plugin base class for initializing resources. On startup (the call to [Context](../context/context.md)::[initialize](../context/statics.md#initialize)), OpenBR will call [initialize](functions.md#initialize) on every Initializer that has been registered with the [Factory](../factory/factory.md). On shutdown (the call to [Context](../context/context.md)::[finalize](../context/statics.md#finalize), OpenBR will call [finalize](functions.md#finalize) on every registered initializer. | ||
| 11 | + | ||
| 12 | +The general use case for initializers is to launch shared contexts for third party integrations into OpenBR. These cannot be launched during [Transform](../transform/transform.md)::[init](../object/functions.md#init) for example, because multiple instances of the [Transform](../transform/transform.md) object could exist across multiple threads. |
docs/docs/api_docs/cpp_api/matrixoutput/functions.md
0 → 100644
| 1 | +## [QString][QString] toString(int row, int column) {: #tostring} | ||
| 2 | + | ||
| 3 | +Get a value in [data](members.md#data) as a string using a provided row and column index. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + QString toString(int row, int column) const | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + row | int | Row index of value | ||
| 14 | + column | int | Column index of value | ||
| 15 | + | ||
| 16 | +* **output:** ([QString][QString]) Returns the value stored at (row, column) as a string | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + TemplateList targets = TemplateList() << Template("target1.jpg") << Template("target2.jpg") << Template("target3.jpg"); | ||
| 20 | + TemplateList queries = TemplateList() << Template("query1.jpg") << Template("query2.jpg"); | ||
| 21 | + | ||
| 22 | + MatrixOutput *output = MatrixOutput::make(targets, queries); | ||
| 23 | + output->set(10.0, 1, 2); | ||
| 24 | + output->toString(1, 2); // Returns "10" | ||
| 25 | + output->toString(2, 2); // ERROR: row index is out of range | ||
| 26 | + | ||
| 27 | +## void initialize(const [FileList](../filelist/filelist.md) &targetFiles, const [FileList](../filelist/filelist.md) &queryFiles) {: #initialize} | ||
| 28 | + | ||
| 29 | +Initialize the output. This function calls [initialize](../output/functions.md#initialize) which should be overloaded by derived classes that need to be initialized. After calling [initialize](../output/functions.md#initialize), [data](members.md#data) is initialized to be of size queryFiles.size() x targetFiles.size(). | ||
| 30 | + | ||
| 31 | +* **function definition:** | ||
| 32 | + | ||
| 33 | + void initialize(const FileList &targetFiles, const FileList &queryFiles) | ||
| 34 | + | ||
| 35 | +* **parameters:** | ||
| 36 | + | ||
| 37 | + Parameter | Type | Description | ||
| 38 | + --- | --- | --- | ||
| 39 | + targetFiles | const [FileList](../filelist/filelist.md) & | List of target files for initialization | ||
| 40 | + queryFiles | const [FileList](../filelist/filelist.md) & | List of query files for initialization | ||
| 41 | + | ||
| 42 | +* **output:** (void) | ||
| 43 | + | ||
| 44 | + | ||
| 45 | +## void set(float value, int i, int j) {: #set} | ||
| 46 | + | ||
| 47 | +Set a value in [data](members.md#data) at the provided row and column indices. | ||
| 48 | + | ||
| 49 | +* **function definition:** | ||
| 50 | + | ||
| 51 | + void set(float value, int i, int j) | ||
| 52 | + | ||
| 53 | +* **parameters:** | ||
| 54 | + | ||
| 55 | + Parameter | Type | Description | ||
| 56 | + --- | --- | --- | ||
| 57 | + value | float | Value to be set | ||
| 58 | + i | int | Row index into [data](members.md#data) | ||
| 59 | + j | int | Column index into [data](members.md#data) | ||
| 60 | + | ||
| 61 | +* **output:** (void) | ||
| 62 | +* **example:** | ||
| 63 | + | ||
| 64 | + TemplateList targets = TemplateList() << Template("target1.jpg") << Template("target2.jpg") << Template("target3.jpg"); | ||
| 65 | + TemplateList queries = TemplateList() << Template("query1.jpg") << Template("query2.jpg"); | ||
| 66 | + | ||
| 67 | + MatrixOutput *output = MatrixOutput::make(targets, queries); | ||
| 68 | + output->set(6.0, 0, 1); | ||
| 69 | + output->toString(0, 1); // Returns "6.0" | ||
| 70 | + | ||
| 71 | + output->set(10.0, 1, 2); | ||
| 72 | + output->toString(1, 2); // Returns "10.0" | ||
| 73 | + | ||
| 74 | +<!-- Links --> | ||
| 75 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" |
docs/docs/api_docs/cpp_api/matrixoutput/matrixoutput.md
0 → 100644
docs/docs/api_docs/cpp_api/matrixoutput/members.md
0 → 100644
docs/docs/api_docs/cpp_api/matrixoutput/statics.md
0 → 100644
| 1 | +## static [MatrixOutput](matrixoutput.md) \*make(const [FileList](../filelist/filelist.md) &targetFiles, const [FileList](../filelist/filelist.md) &queryFiles) {: #make} | ||
| 2 | + | ||
| 3 | +Make an [MatrixOutput](matrixoutput.md) from lists of target and query files. This function calls [Output](../output/output.md)::[make](../output/statics.md#make) using the string "Matrix". [Output](../output/output.md)::[make](../output/statics.md#make) in turn calls [initialize](functions.md#initialize). Initialize calls [initialize](../output/functions.md#initialize) which should be overloaded by derived classes to handle initialization. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static MatrixOutput *make(const FileList &targetFiles, const FileList &queryFiles) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + targetFiles | const [FileList](../filelist/filelist.md) & | List of files representing the target templates | ||
| 14 | + queryFiles | const [FileList](../filelist/filelist.md) & | List of files representing the query templates | ||
| 15 | + | ||
| 16 | +* **output:** ([MatrixOutput](matrixoutput.md) \*) Returns a pointer to the first output in the linked list | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + TemplateList targets = TemplateList() << Template("target1.jpg") << Template("target2.jpg") << Template("target3.jpg"); | ||
| 20 | + TemplateList queries = TemplateList() << Template("query1.jpg") << Template("query2.jpg"); | ||
| 21 | + | ||
| 22 | + MatrixOutput *output = MatrixOutput::make(targets, queries); // returns a pointer to a MatrixOutput |
docs/docs/api_docs/cpp_api/metadatatransform/constructors.md
0 → 100644
| 1 | +Constructor / Destructor | Description | ||
| 2 | +--- | --- | ||
| 3 | +MetadataTransform(bool trainable = true) | Construct a [MetadataTransform](metadatatransform.md). This constructor calls the [Transform](../transform/transform.md) [constructor](../transform/constructors.md) with the provided value for [trainable](../transform/members.md#trainable) and [independent](../transform/members.md#independent) set to false. | ||
| 0 | \ No newline at end of file | 4 | \ No newline at end of file |
docs/docs/api_docs/cpp_api/metadatatransform/functions.md
0 → 100644
| 1 | +## void projectMetadata(const [File](../file/file.md) &src, [File](../file/file.md) &dst) {: #projectmetadata } | ||
| 2 | + | ||
| 3 | +This is a pure virtual function. It must be overloaded by all derived classes. Project a [Template's](../template/template.md) [metadata](../template/members.md#file) through the transform, modifying its contents in some way and storing the modified data in **dst**. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + virtual void projectMetadata(const File &src, File &dst) const = 0 | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + src | const [File](../file/file.md) & | Input File. It is immutable | ||
| 14 | + dst | [File](../file/file.md) & | Output File. Should contain the modified data from the input template. | ||
| 15 | + | ||
| 16 | +* **output:** (void) | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + class IncrementPropertyTransform : public MetadataTransform | ||
| 20 | + { | ||
| 21 | + Q_OBJECT | ||
| 22 | + Q_PROPERTY(QString key READ get_key WRITE set_key RESET reset_key STORED false) | ||
| 23 | + BR_PROPERTY(QString, key, "") | ||
| 24 | + | ||
| 25 | + void projectMetadata(const File &src, File &dst) const | ||
| 26 | + { | ||
| 27 | + dst = src; | ||
| 28 | + dst.set(key, src.get<int>(key, 0) + 1); | ||
| 29 | + } | ||
| 30 | + }; | ||
| 31 | + | ||
| 32 | + BR_REGISTER(Transform, IncrementPropertyTransform) | ||
| 33 | + | ||
| 34 | + MetadataTransform *m_transform = (MetadataTransform *)Transform::make("IncrementProperty(property1)", NULL); | ||
| 35 | + | ||
| 36 | + File in("picture.jpg"), out; | ||
| 37 | + in.set("property1", 10); | ||
| 38 | + | ||
| 39 | + m_transform->projectMetadata(in, out); | ||
| 40 | + out.flat(); // Returns "picture.jpg[property1=11]" | ||
| 41 | + | ||
| 42 | + | ||
| 43 | +## void project(const [Template](../template/template.md) &src, [Template](../template/template.md) &dst) {: #project } | ||
| 44 | + | ||
| 45 | +Project a [Template](../template/template.md) through the transform by passing its [metadata](../template/members.md#file) through [projectMetadata](#projectmetadata) and storing the result in dst. All matrices in src are passed unchanged to dst. | ||
| 46 | + | ||
| 47 | +* **function definition:** | ||
| 48 | + | ||
| 49 | + void project(const Template &src, Template &dst) const | ||
| 50 | + | ||
| 51 | +* **parameters:** | ||
| 52 | + | ||
| 53 | + Parameter | Type | Description | ||
| 54 | + --- | --- | --- | ||
| 55 | + src | const [Template](../template/template.md) & | Input Template. It is immutable | ||
| 56 | + dst | [Template](../template/template.md) & | Output Template. Should contain the modified data from the input template. | ||
| 57 | + | ||
| 58 | +* **output:** (void) |
docs/docs/api_docs/cpp_api/metadatatransform/metadatatransform.md
0 → 100644
| 1 | +<!-- METADATA TRANSFORM --> | ||
| 2 | + | ||
| 3 | +Inherits [Transform](../transform/transform.md) | ||
| 4 | + | ||
| 5 | +A [Transform](../transform/transform.md) that requires only [Template](../template/template.md) [metadata](../template/members.md#file) | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Constructors](constructors.md) | ||
| 10 | +* [Functions](functions.md) | ||
| 11 | + | ||
| 12 | +[MetadataTransforms](metadatatransform.md) are [Transforms](../transform/transform.md) that operate soley on textual [metadata](../template/members.md#file). They are *not* [independent](../transform/members.md#independent) because [Templates](../template/template.md) can only every have one collection of [metadata](../template/members.md#file). |
docs/docs/api_docs/cpp_api/metatransform/constructors.md
0 → 100644
| 1 | +Constructor / Destructor | Description | ||
| 2 | +--- | --- | ||
| 3 | +MetaTransform() | Construct a [MetaTransform](metatransform.md). This constructor calls the [Transform](../transform/transform.md) [constructor](../transform/constructors.md) with [independent](../transform/members.md#independent) set to false. |
docs/docs/api_docs/cpp_api/metatransform/metatransform.md
0 → 100644
| 1 | +<!-- META TRANSFORM --> | ||
| 2 | + | ||
| 3 | +Inherits [Transform](../transform/transform.md) | ||
| 4 | + | ||
| 5 | +A [Transform](../transform/transform.md) that expect multiple matrices per [Template](../template/template.md) | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Constructors](constructors.md) | ||
| 10 | + | ||
| 11 | +[MetaTransforms](metatransform.md) are [Transforms](../transform/transform.md) that are not [independent](../transform/members.md#independent). This means they expect more then one matrix in each input [Template](../template/template.md) and a new instance of the transform should not be created for each matrix. |
docs/docs/api_docs/cpp_api/object/functions.md
0 → 100644
| 1 | + | ||
| 2 | +## void init() {: #init } | ||
| 3 | + | ||
| 4 | +This is a virtual function. It is meant to be overloaded by derived classes if they need to initialize internal variables. The default constructor of derived objects should *never* be overloaded. | ||
| 5 | + | ||
| 6 | +* **function definition:** | ||
| 7 | + | ||
| 8 | + virtual void init() | ||
| 9 | + | ||
| 10 | +* **parameters:** NONE | ||
| 11 | +* **output:** (void) | ||
| 12 | + | ||
| 13 | +--- | ||
| 14 | + | ||
| 15 | +## void store([QDataStream][QDataStream] &stream) {: #store } | ||
| 16 | + | ||
| 17 | +This is a virtual function. Serialize an object to a [QDataStream][QDataStream]. The default implementation serializes each property and its value to disk. | ||
| 18 | + | ||
| 19 | +* **function definition:** | ||
| 20 | + | ||
| 21 | + virtual void store(QDataStream &stream) const | ||
| 22 | + | ||
| 23 | +* **parameters:** | ||
| 24 | + | ||
| 25 | + Parameter | Type | Description | ||
| 26 | + --- | --- | --- | ||
| 27 | + stream | [QDataStream][QDataStream] & | Stream to store serialized data | ||
| 28 | + | ||
| 29 | +* **output:** (void) | ||
| 30 | + | ||
| 31 | +--- | ||
| 32 | + | ||
| 33 | +## void load([QDataStream][QDataStream] &stream) {: #load } | ||
| 34 | + | ||
| 35 | +This is a virtual function. Deserialize an item from a [QDataStream][QDataStream]. Elements can be deserialized in the same order in which they were serialized. The default implementation deserializes a value for each property and then calls [init](#init). | ||
| 36 | + | ||
| 37 | +* **function definition:** | ||
| 38 | + | ||
| 39 | + virtual void load(QDataStream &stream); | ||
| 40 | + | ||
| 41 | +* **parameters:** | ||
| 42 | + | ||
| 43 | + Parameter | Type | Description | ||
| 44 | + --- | --- | --- | ||
| 45 | + stream | [QDataStream][QDataStream] & | Stream to deserialize data from | ||
| 46 | + | ||
| 47 | +* **output:** (void) | ||
| 48 | + | ||
| 49 | +--- | ||
| 50 | + | ||
| 51 | +## void serialize([QDataStream][QDataStream] &stream) {: #serialize } | ||
| 52 | + | ||
| 53 | +This is a virtual function. Serialize an entire plugin to a [QDataStream][QDataStream]. This function is larger in scope then [store](#store). It stores the string describing the plugin and then calls [store](#store) to serialize its parameters. This has the benefit of being able to deserialize an entire plugin (or series of plugins) from a stored model file. | ||
| 54 | + | ||
| 55 | +* **function definition:** | ||
| 56 | + | ||
| 57 | + virtual void serialize(QDataStream &stream) const | ||
| 58 | + | ||
| 59 | +* **parameters:** | ||
| 60 | + | ||
| 61 | + Parameter | Type | Description | ||
| 62 | + --- | --- | --- | ||
| 63 | + stream | [QDataStream][QDataStream] & | Stream to store serialized data | ||
| 64 | + | ||
| 65 | +* **output:** (void) | ||
| 66 | + | ||
| 67 | +--- | ||
| 68 | + | ||
| 69 | +## [QStringList][QStringList] parameters() {: #parameters } | ||
| 70 | + | ||
| 71 | +Get a string describing the parameters of the object | ||
| 72 | + | ||
| 73 | +* **function definition:** | ||
| 74 | + | ||
| 75 | + QStringList parameters() const | ||
| 76 | + | ||
| 77 | +* **parameters:** NONE | ||
| 78 | +* **output:** ([QStringList][QStringList]) Returns a list of the parameters to a function | ||
| 79 | +* **example:** | ||
| 80 | + | ||
| 81 | + class ExampleTransform : public Transform | ||
| 82 | + { | ||
| 83 | + Q_OBJECT | ||
| 84 | + | ||
| 85 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 86 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 87 | + Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) | ||
| 88 | + BR_PROPERTY(int, property1, 1) | ||
| 89 | + BR_PROPERTY(float, property2, 2.5) | ||
| 90 | + BR_PROPERTY(QString, property3, "Value") | ||
| 91 | + | ||
| 92 | + ... | ||
| 93 | + }; | ||
| 94 | + | ||
| 95 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 96 | + | ||
| 97 | + Factory<Transform>::make(".Example")->parameters(); // returns ["int property1 = 1", "float property2 = 2.5", "QString property3 = Value"] | ||
| 98 | + | ||
| 99 | +--- | ||
| 100 | + | ||
| 101 | +## [QStringList][QStringList] prunedArguments(bool expanded = false) {: #prunedarguments } | ||
| 102 | + | ||
| 103 | +Get a string describing the user-specified parameters of the object. This means that parameters using their default value are not returned. | ||
| 104 | + | ||
| 105 | +* **function definition:** | ||
| 106 | + | ||
| 107 | + QStringList prunedArguments(bool expanded = false) const | ||
| 108 | + | ||
| 109 | +* **parameters:** | ||
| 110 | + | ||
| 111 | + Parameter | Type | Description | ||
| 112 | + --- | --- | --- | ||
| 113 | + expanded | bool | (Optional) If true, expand all abbreviations or model files into their full description strings. Default is false. | ||
| 114 | + | ||
| 115 | +* **output:** ([QStringList][QStringList]) Returns a list of all of the user specified parameters of the object | ||
| 116 | +* **example:** | ||
| 117 | + | ||
| 118 | + class ExampleTransform : public Transform | ||
| 119 | + { | ||
| 120 | + Q_OBJECT | ||
| 121 | + | ||
| 122 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 123 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 124 | + Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) | ||
| 125 | + BR_PROPERTY(int, property1, 1) | ||
| 126 | + BR_PROPERTY(float, property2, 2.5) | ||
| 127 | + BR_PROPERTY(QString, property3, "Value") | ||
| 128 | + | ||
| 129 | + ... | ||
| 130 | + }; | ||
| 131 | + | ||
| 132 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + Factory<Transform>::make(".Example")->prunedArguments(); // returns [] | ||
| 136 | + Factory<Transform>::make(".Example(property1=10)")->prunedArguments(); // returns ["property1=10"] | ||
| 137 | + Factory<Transform>::make(".Example(property1=10,property3=NewValue)")->prunedArguments(); // returns ["property1=10", "property3=NewValue"] | ||
| 138 | + | ||
| 139 | +--- | ||
| 140 | + | ||
| 141 | +## [QString][QString] argument(int index, bool expanded) {: #argument } | ||
| 142 | + | ||
| 143 | +Get a string value of the argument at a provided index. An index of 0 returns the name of the object. | ||
| 144 | + | ||
| 145 | +* **function definition:** | ||
| 146 | + | ||
| 147 | + QString argument(int index, bool expanded) const | ||
| 148 | + | ||
| 149 | +* **parameters:** | ||
| 150 | + | ||
| 151 | + Parameter | Type | Description | ||
| 152 | + --- | --- | --- | ||
| 153 | + index | int | Index of the parameter to look up | ||
| 154 | + expanded | bool | If true, expand all abbreviations or model files into their full description strings. | ||
| 155 | + | ||
| 156 | +* **output:** ([QString][QString]) Returns a string value for the lookup argument | ||
| 157 | +* **example:** | ||
| 158 | + | ||
| 159 | + class ExampleTransform : public Transform | ||
| 160 | + { | ||
| 161 | + Q_OBJECT | ||
| 162 | + | ||
| 163 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 164 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 165 | + Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) | ||
| 166 | + BR_PROPERTY(int, property1, 1) | ||
| 167 | + BR_PROPERTY(float, property2, 2.5) | ||
| 168 | + BR_PROPERTY(QString, property3, "Value") | ||
| 169 | + | ||
| 170 | + ... | ||
| 171 | + }; | ||
| 172 | + | ||
| 173 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 174 | + | ||
| 175 | + Factory<Transform>::make(".Example")->argument(0, false); // returns "Example" | ||
| 176 | + Factory<Transform>::make(".Example")->argument(1, false); // returns "1" | ||
| 177 | + Factory<Transform>::make(".Example")->argument(2, false); // returns "2.5" | ||
| 178 | + | ||
| 179 | +--- | ||
| 180 | + | ||
| 181 | +## [QString][QString] description(bool expanded = false) {: #description } | ||
| 182 | + | ||
| 183 | +This is a virtual function. Get a description of the object. The description includes the name and any user-defined parameters of the object. Parameters that retain their default value are not included. | ||
| 184 | + | ||
| 185 | +* **function definition:** | ||
| 186 | + | ||
| 187 | + virtual QString description(bool expanded = false) const | ||
| 188 | + | ||
| 189 | +* **parameters:** | ||
| 190 | + | ||
| 191 | + Parameter | Type | Description | ||
| 192 | + --- | --- | --- | ||
| 193 | + expanded | bool | (Optional) If true, expand all abbreviations or model files into their full description strings. Default is false. | ||
| 194 | + | ||
| 195 | +* **output:** ([QString][QString]) Returns a string describing the object | ||
| 196 | +* **example:** | ||
| 197 | + | ||
| 198 | + class ExampleTransform : public Transform | ||
| 199 | + { | ||
| 200 | + Q_OBJECT | ||
| 201 | + | ||
| 202 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 203 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 204 | + Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) | ||
| 205 | + BR_PROPERTY(int, property1, 1) | ||
| 206 | + BR_PROPERTY(float, property2, 2.5) | ||
| 207 | + BR_PROPERTY(QString, property3, "Value") | ||
| 208 | + | ||
| 209 | + ... | ||
| 210 | + }; | ||
| 211 | + | ||
| 212 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 213 | + | ||
| 214 | + Factory<Transform>::make(".Example")->description(); // returns "Example" | ||
| 215 | + qDebug() << Factory<Transform>::make(".Example(property3=NewValue)")->description(); // returns "Example(property3=NewValue)" | ||
| 216 | + | ||
| 217 | +--- | ||
| 218 | + | ||
| 219 | +## void setProperty(const [QString][QString] &name, [QVariant][QVariant] value) {: #setproperty } | ||
| 220 | + | ||
| 221 | +Set a property with a provided name to a provided value. This function overloads [QObject][QObject]::setProperty so that it can handle OpenBR data types. If the provided name is not a property of the object nothing happens. If the provided name is a property but the provided value is not a valid type an error is thrown. | ||
| 222 | + | ||
| 223 | +* **function definition:** | ||
| 224 | + | ||
| 225 | + void setProperty(const QString &name, QVariant value) | ||
| 226 | + | ||
| 227 | +* **parameters:** | ||
| 228 | + | ||
| 229 | + Parameter | Type | Description | ||
| 230 | + --- | --- | --- | ||
| 231 | + name | const [QString][QString] & | Name of the property to set | ||
| 232 | + value | [QVariant][QVariant] | Value to set the property to | ||
| 233 | + | ||
| 234 | +* **output:** (void) | ||
| 235 | +* **see:** [setPropertyRecursive](#setpropertyrecursive), [setExistingProperty](#setexistingproperty) | ||
| 236 | +* **example:** | ||
| 237 | + | ||
| 238 | + class ExampleTransform : public Transform | ||
| 239 | + { | ||
| 240 | + Q_OBJECT | ||
| 241 | + | ||
| 242 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 243 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 244 | + Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) | ||
| 245 | + BR_PROPERTY(int, property1, 1) | ||
| 246 | + BR_PROPERTY(float, property2, 2.5) | ||
| 247 | + BR_PROPERTY(QString, property3, "Value") | ||
| 248 | + | ||
| 249 | + ... | ||
| 250 | + }; | ||
| 251 | + | ||
| 252 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 253 | + | ||
| 254 | + QScopedPointer<Transform> transform(Factory<Transform>::make(".Example")); | ||
| 255 | + transform->parameters(); // returns ["int property1 = 1", "float property2 = 2.5", "QString property3 = Value"] | ||
| 256 | + | ||
| 257 | + transform->setProperty("property1", QVariant::fromValue<int>(10)); | ||
| 258 | + transform->parameters(); // returns ["int property1 = 10", "float property2 = 2.5", "QString property3 = Value"] | ||
| 259 | + | ||
| 260 | + transform->setProperty("property1", QVariant::fromValue<QString>("Value")); // ERROR: incorrect type | ||
| 261 | + | ||
| 262 | +--- | ||
| 263 | + | ||
| 264 | +## bool setPropertyRecursive(const [QString][QString] &name, [QVariant][QVariant] value) {: #setpropertyrecursive } | ||
| 265 | + | ||
| 266 | +Set a property of the object or the object's children to a provided value. The recursion is only single level; the children of the the objects children will not be affected. Only the first property found is set. This means that if a parent and a child have the same property only the parent's property is set. | ||
| 267 | + | ||
| 268 | +* **function definition:** | ||
| 269 | + | ||
| 270 | + virtual bool setPropertyRecursive(const QString &name, QVariant value) | ||
| 271 | + | ||
| 272 | +* **parameters:** | ||
| 273 | + | ||
| 274 | + Parameter | Type | Description | ||
| 275 | + --- | --- | --- | ||
| 276 | + name | const [QString][QString] & | Name of the property to set | ||
| 277 | + value | [QVariant][QVariant] | Value to set the property to | ||
| 278 | + | ||
| 279 | +* **output:** (bool) Returns true if the property is set in either the object or its children | ||
| 280 | +* **see:** [setProperty](#setproperty), [setExistingProperty](#setexistingproperty), [getChildren](#getchildren-2) | ||
| 281 | +* **example:** | ||
| 282 | + | ||
| 283 | + class ChildTransform : public Transform | ||
| 284 | + { | ||
| 285 | + Q_OBJECT | ||
| 286 | + | ||
| 287 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 288 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 289 | + BR_PROPERTY(int, property1, 2) | ||
| 290 | + BR_PROPERTY(int, property2, 2.5) | ||
| 291 | + | ||
| 292 | + ... | ||
| 293 | + }; | ||
| 294 | + | ||
| 295 | + BR_REGISTER(Transform, ChildTransform) | ||
| 296 | + | ||
| 297 | + class ParentTransform : public Transform | ||
| 298 | + { | ||
| 299 | + Q_OBJECT | ||
| 300 | + | ||
| 301 | + Q_PROPERTY(br::Transform *child READ get_child WRITE set_child RESET reset_child STORED false) | ||
| 302 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 303 | + BR_PROPERTY(br::Transform*, child, Factory<Transform>::make(".Child")) | ||
| 304 | + BR_PROPERTY(int, property1, 1) | ||
| 305 | + | ||
| 306 | + ... | ||
| 307 | + }; | ||
| 308 | + | ||
| 309 | + QScopedPointer<Transform> parent(Factory<Transform>::make(".Parent")); | ||
| 310 | + parent->parameters(); // returns ["br::Transform* child = ", "int property1 = 1"] | ||
| 311 | + parent->getChildren<Transform>().first()->parameters(); // returns ["int property1 = 2", "float property2 = 2"] | ||
| 312 | + | ||
| 313 | + parent->setPropertyRecursive("property1", QVariant::fromValue<int>(10)); | ||
| 314 | + parent->parameters(); // returns ["br::Transform* child = ", "int property1 = 10"] | ||
| 315 | + parent->getChildren<Transform>().first()->parameters(); // returns ["int property1 = 2", "float property2 = 2"] | ||
| 316 | + | ||
| 317 | + parent->setPropertyRecursive("property2", QVariant::fromValue<float>(10.5)); | ||
| 318 | + parent->parameters(); // returns ["br::Transform* child = ", "int property1 = 10"] | ||
| 319 | + parent->getChildren<Transform>().first()->parameters(); // returns ["int property1 = 2", "float property2 = 10"] | ||
| 320 | + | ||
| 321 | +--- | ||
| 322 | + | ||
| 323 | +## bool setExistingProperty(const [QString][QString] &name, [QVariant][QVariant] value) {: #setexistingproperty } | ||
| 324 | + | ||
| 325 | +Attempt to set a property to a provided value. If the provided value is not a valid type for the given property an error is thrown. | ||
| 326 | + | ||
| 327 | +* **function definition:** | ||
| 328 | + | ||
| 329 | + bool setExistingProperty(const QString &name, QVariant value) | ||
| 330 | + | ||
| 331 | +* **parameters:** | ||
| 332 | + | ||
| 333 | + Parameter | Type | Description | ||
| 334 | + --- | --- | --- | ||
| 335 | + name | const [QString][QString] & | Name of the property to set | ||
| 336 | + value | [QVariant][QVariant] | Value to set the property to | ||
| 337 | + | ||
| 338 | +* **output:** (bool) Returns true if the provided property exists and can be set to the provided value, otherwise returns false | ||
| 339 | +* **example:** | ||
| 340 | + | ||
| 341 | + class ExampleTransform : public Transform | ||
| 342 | + { | ||
| 343 | + Q_OBJECT | ||
| 344 | + | ||
| 345 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 346 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 347 | + BR_PROPERTY(int, property1, 2) | ||
| 348 | + BR_PROPERTY(int, property2, 2.5) | ||
| 349 | + | ||
| 350 | + ... | ||
| 351 | + }; | ||
| 352 | + | ||
| 353 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 354 | + | ||
| 355 | + QScopedPointer<Transform> transform(Factory<Transform>::make(".Child")); | ||
| 356 | + transform->setExistingProperty("property1", QVariant::fromValue<int>(10)); // returns true | ||
| 357 | + transform->parameters(); // returns ["int property1 = 10", "float property2 = 2"] | ||
| 358 | + | ||
| 359 | + transform->setExistingProperty("property3", QVariant::fromValue<int>(10)); // returns false | ||
| 360 | + transform->setExistingProperty("property1", QVariant::fromValue<QString>("Hello")); // ERROR: incorrect type | ||
| 361 | + | ||
| 362 | +--- | ||
| 363 | + | ||
| 364 | +## [QList][QList]<[Object](object.md) \*> getChildren() {: #getchildren-1 } | ||
| 365 | + | ||
| 366 | +This is a virtual function. Get all of the children of the object. The default implementation looks for children in the properties of the object. A derived object should overload this function if it needs to provide children from a different source. | ||
| 367 | + | ||
| 368 | +* **function definition:** | ||
| 369 | + | ||
| 370 | + virtual QList<Object *> getChildren() const | ||
| 371 | + | ||
| 372 | +<!-- no italics* --> | ||
| 373 | + | ||
| 374 | +* **parameters:** NONE | ||
| 375 | +* **output:** ([QList][QList]<[Object](object.md) \*>) Returns a list of all of the children of the object | ||
| 376 | +* **example:** | ||
| 377 | + | ||
| 378 | + class ChildTransform : public Transform | ||
| 379 | + { | ||
| 380 | + Q_OBJECT | ||
| 381 | + | ||
| 382 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 383 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 384 | + BR_PROPERTY(int, property1, 2) | ||
| 385 | + BR_PROPERTY(int, property2, 2.5) | ||
| 386 | + | ||
| 387 | + ... | ||
| 388 | + }; | ||
| 389 | + | ||
| 390 | + BR_REGISTER(Transform, ChildTransform) | ||
| 391 | + | ||
| 392 | + class ParentTransform : public Transform | ||
| 393 | + { | ||
| 394 | + Q_OBJECT | ||
| 395 | + | ||
| 396 | + Q_PROPERTY(br::Transform *child READ get_child WRITE set_child RESET reset_child STORED false) | ||
| 397 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 398 | + BR_PROPERTY(br::Transform *, child, Factory<Transform>::make(".Child")) | ||
| 399 | + BR_PROPERTY(int, property1, 1) | ||
| 400 | + | ||
| 401 | + ... | ||
| 402 | + }; | ||
| 403 | + | ||
| 404 | + BR_REGISTER(Transform, ParentTransform) | ||
| 405 | + | ||
| 406 | + QScopedPointer<Transform> transform(Factory<Transform>::make(".Parent")); | ||
| 407 | + transform->getChildren(); // returns [br::ChildTransform(0x7fc10bf01050, name = "Child")] | ||
| 408 | + transform->getChildren().first()->parameters(); // returns ["int property1 = 2", "float property2 = 2"] | ||
| 409 | + | ||
| 410 | +--- | ||
| 411 | + | ||
| 412 | +## [QList][QList]<T \*> getChildren() {: #getchildren-2 } | ||
| 413 | + | ||
| 414 | +Provides a wrapper on [getChildren](#getchildren-1) as a convenience to allow the return type (<tt>T</tt>) to be specified. <tt>T</tt> must be a derived class of [Object](object.md). | ||
| 415 | + | ||
| 416 | +* **function definition:** | ||
| 417 | + | ||
| 418 | + template<typename T> | ||
| 419 | + QList<T *> getChildren() const | ||
| 420 | + | ||
| 421 | +* **parameters:** NONE | ||
| 422 | +* **output:** ([QList][QList]<<tt>T</tt> \*>) Returns a list of all of the children of the object, casted to type <tt>T</tt>. <tt>T</tt> must be a derived class of [Object](object.md) | ||
| 423 | +* **example:** | ||
| 424 | + | ||
| 425 | + class ChildTransform : public Transform | ||
| 426 | + { | ||
| 427 | + Q_OBJECT | ||
| 428 | + | ||
| 429 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 430 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 431 | + BR_PROPERTY(int, property1, 2) | ||
| 432 | + BR_PROPERTY(int, property2, 2.5) | ||
| 433 | + | ||
| 434 | + ... | ||
| 435 | + }; | ||
| 436 | + | ||
| 437 | + BR_REGISTER(Transform, ChildTransform) | ||
| 438 | + | ||
| 439 | + class ParentTransform : public Transform | ||
| 440 | + { | ||
| 441 | + Q_OBJECT | ||
| 442 | + | ||
| 443 | + Q_PROPERTY(br::Transform *child READ get_child WRITE set_child RESET reset_child STORED false) | ||
| 444 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 445 | + BR_PROPERTY(br::Transform *, child, Factory<Transform>::make(".Child")) | ||
| 446 | + BR_PROPERTY(int, property1, 1) | ||
| 447 | + | ||
| 448 | + ... | ||
| 449 | + }; | ||
| 450 | + | ||
| 451 | + BR_REGISTER(Transform, ParentTransform) | ||
| 452 | + | ||
| 453 | + QScopedPointer<Transform> transform(Factory<Transform>::make(".Parent")); | ||
| 454 | + transform->getChildren<Transform>(); // returns [br::ChildTransform(0x7fc10bf01050, name = "Child")] | ||
| 455 | + transform->getChildren<Transform>().first()->parameters(); // returns ["int property1 = 2", "float property2 = 2"] | ||
| 456 | + | ||
| 457 | +<!-- Links --> | ||
| 458 | +[QDataStream]: http://doc.qt.io/qt-5/qdatastream.html "QDataStream" | ||
| 459 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 460 | +[QStringList]: http://doc.qt.io/qt-5/qstringlist.html "QStringList" | ||
| 461 | +[QVariant]: http://doc.qt.io/qt-5/qvariant.html "QVariant" | ||
| 462 | +[QObject]: http://doc.qt.io/qt-5/QObject.html "QObject" | ||
| 463 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" |
docs/docs/api_docs/cpp_api/object/macros.md
0 → 100644
| 1 | +## BR_PROPERTY {: #br_property } | ||
| 2 | + | ||
| 3 | +This macro provides an extension to the [Qt Property System][Qt Property System]. It's purpose is to set default values for each property in an object. Every call to <tt>BR_PROPERTY</tt> should have a corresponding call to <tt>Q_PROPERTY</tt>. | ||
| 4 | + | ||
| 5 | +* **macro definition:** | ||
| 6 | + | ||
| 7 | + #define BR_PROPERTY(TYPE,NAME,DEFAULT) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Description | ||
| 12 | + --- | --- | ||
| 13 | + TYPE | The type of the property (int, float etc.) | ||
| 14 | + NAME | The name of the property | ||
| 15 | + DEFAULT | The default value of the property | ||
| 16 | + | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + class ExampleTransform : public Transform | ||
| 20 | + { | ||
| 21 | + Q_OBJECT | ||
| 22 | + | ||
| 23 | + Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) | ||
| 24 | + Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) | ||
| 25 | + Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) | ||
| 26 | + BR_PROPERTY(int, property1, 1) // sets default value of "property1" to 1 | ||
| 27 | + BR_PROPERTY(float, property2, 2.5) // sets default value of "property2" to 2.5 | ||
| 28 | + BR_PROPERTY(QString, property3, "Value") // sets default value of "property3" to "Value" | ||
| 29 | + | ||
| 30 | + ... | ||
| 31 | + }; | ||
| 32 | + | ||
| 33 | +<!-- Links --> | ||
| 34 | +[Qt Property System]: http://doc.qt.io/qt-5/properties.html "Qt Property System" |
docs/docs/api_docs/cpp_api/object/members.md
0 → 100644
| 1 | +Member | Type | Description | ||
| 2 | +--- | --- | --- | ||
| 3 | +<a class="table-anchor" id="file"></a>file | [File](../file/file.md) | The [File](../file/file.md) used to construct the plugin. | ||
| 4 | +<a class="table-anchor" id="firstavailablepropertyidx"></a>firstAvailablePropertyIdx | int | Index of the first property of the object that can be set via command line arguments | ||
| 0 | \ No newline at end of file | 5 | \ No newline at end of file |
docs/docs/api_docs/cpp_api/object/object.md
0 → 100644
| 1 | +<!-- OBJECT --> | ||
| 2 | + | ||
| 3 | +Inherits from [QObject][QObject] | ||
| 4 | + | ||
| 5 | +See: | ||
| 6 | + | ||
| 7 | +* [Members](members.md) | ||
| 8 | +* [Macros](macros.md) | ||
| 9 | +* [Static Functions](statics.md) | ||
| 10 | +* [Functions](functions.md) | ||
| 11 | + | ||
| 12 | +This is the base class of all OpenBR plugins. [Objects](object.md) are constructed from [Files](../file/file.md). The [File's](../file/file.md) [name](../file/members.md#name) specifies which plugin to construct and the [File's](../file/file.md) [metadata](../file/members.md#m_metadata) provides initialization values for the plugin's properties. | ||
| 13 | + | ||
| 14 | +<!-- Links --> | ||
| 15 | +[QObject]: http://doc.qt.io/qt-5/QObject.html "QObject" |
docs/docs/api_docs/cpp_api/object/statics.md
0 → 100644
| 1 | +## [QStringList][QStringList] parse(const [QString][QString] &string, char split = ',') {: #parse } | ||
| 2 | + | ||
| 3 | +Split the provided string using the provided split character. Lexical scoping of <tt>()</tt>, <tt>[]</tt>, <tt>\<\></tt>, and <tt>{}</tt> is respected. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static QStringList parse(const QString &string, char split = ','); | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + string | const [QString][QString] & | String to be split | ||
| 14 | + split | char | (Optional) The character to split the string on. Default is ',' | ||
| 15 | + | ||
| 16 | +* **output:** ([QStringList][QStringList]) Returns a list of the split strings | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + Object::parse("Transform1(p1=v1,p2=v2),Transform2(p1=v3,p2=v4)"); // returns ["Transform1(p1=v1,p2=v2)", "Transform2(p1=v3,p2=v4)"] | ||
| 20 | + | ||
| 21 | +<!-- Links --> | ||
| 22 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 23 | +[QStringList]: http://doc.qt.io/qt-5/qstringlist.html "QStringList" |
docs/docs/api_docs/cpp_api/output/constructors.md
0 → 100644
docs/docs/api_docs/cpp_api/output/functions.md
0 → 100644
| 1 | +## void initialize(const [FileList](../filelist/filelist.md) &targetFiles, const [FileList](../filelist/filelist.md) &queryFiles) {: #initialize } | ||
| 2 | + | ||
| 3 | +This is a virtual function. Initialize the output with provided target and query files. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + virtual void initialize(const [FileList](../filelist/filelist.md) &targetFiles, const [FileList](../filelist/filelist.md) &queryFiles) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + targetFiles | const [FileList](../filelist/filelist.md) & | Target files to initialize the Output with | ||
| 14 | + queryFiles | const [FileList](../filelist/filelist.md) & | Query files to initialize the Output with | ||
| 15 | + | ||
| 16 | +* **output:** (void) | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + TemplateList targets = TemplateList() << Template("target1.jpg") << Template("target2.jpg") << Template("target3.jpg"); | ||
| 20 | + TemplateList queries = TemplateList() << Template("query1.jpg") << Template("query2.jpg"); | ||
| 21 | + | ||
| 22 | + Output *output = Factory::make<Output>("output.mtx"); | ||
| 23 | + output->initialize(targets, queries); // This is the same as calling Output::make("output.mtx", targets, queries) | ||
| 24 | + | ||
| 25 | +## void setBlock(int rowBlock, int columnBlock) {: #setblock } | ||
| 26 | + | ||
| 27 | +This is a virtual function. Set the read offset of the Output. | ||
| 28 | + | ||
| 29 | +* **function definition:** | ||
| 30 | + | ||
| 31 | + virtual void setBlock(int rowBlock, int columnBlock) | ||
| 32 | + | ||
| 33 | +* **parameters:** | ||
| 34 | + | ||
| 35 | + Parameter | Type | Description | ||
| 36 | + --- | --- | --- | ||
| 37 | + rowBlock | int | Row position of the offset | ||
| 38 | + columnBlock | int | Column position of the offset | ||
| 39 | + | ||
| 40 | +* **output:** (void) | ||
| 41 | + | ||
| 42 | +## void setRelative(float value, int i, int j) {: #setrelative } | ||
| 43 | + | ||
| 44 | +This is a virtual function. Set a value in the Output. **i** and **j** are *relative* to the current block. | ||
| 45 | + | ||
| 46 | +* **function definition:** | ||
| 47 | + | ||
| 48 | + virtual void setRelative(float value, int i, int j) | ||
| 49 | + | ||
| 50 | +* **parameters:** | ||
| 51 | + | ||
| 52 | + Parameter | Type | Description | ||
| 53 | + --- | --- | --- | ||
| 54 | + value | float | Value to set in the output | ||
| 55 | + i | int | Row value relative to the current block | ||
| 56 | + j | int | Column value relative to the current block | ||
| 57 | + | ||
| 58 | +* **output:** (void) | ||
| 59 | + | ||
| 60 | + | ||
| 61 | +## void set(float value, int i, int j) {: #set } | ||
| 62 | + | ||
| 63 | +This is a pure virtual function. Set a value in the output. | ||
| 64 | + | ||
| 65 | +* **function definition:** | ||
| 66 | + | ||
| 67 | + virtual void set(float value, int i, int j) = 0 | ||
| 68 | + | ||
| 69 | +* **parameters:** | ||
| 70 | + | ||
| 71 | + Parameter | Type | Description | ||
| 72 | + --- | --- | --- | ||
| 73 | + value | float | Value to be inserted into the output | ||
| 74 | + i | int | Row index to insert at | ||
| 75 | + j | int | Column index to insert at | ||
| 76 | + | ||
| 77 | +* **output:** (void) |
docs/docs/api_docs/cpp_api/output/members.md
0 → 100644
| 1 | +Member | Type | Description | ||
| 2 | +--- | --- | --- | ||
| 3 | +<a class="table-anchor" id=targetfiles></a>targetFiles | [FileList](../filelist/filelist.md) | List of files representing the target templates | ||
| 4 | +<a class="table-anchor" id=queryfiles></a>queryFiles | [FileList](../filelist/filelist.md) | List of files representing the query templates | ||
| 5 | +<a class="table-anchor" id=selfsimilar></a>selfSimilar | bool | True if targetFiles == queryFiles, false otherwise |
docs/docs/api_docs/cpp_api/output/output.md
0 → 100644
| 1 | +<!-- OUTPUT --> | ||
| 2 | + | ||
| 3 | +Inherits from [Object](../object/object.md) | ||
| 4 | + | ||
| 5 | +Plugin base class for storing template comparison results. | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Members](members.md) | ||
| 10 | +* [Constructors](constructors.md) | ||
| 11 | +* [Static Functions](statics.md) | ||
| 12 | +* [Functions](functions.md) | ||
| 13 | + | ||
| 14 | +An *Output* is a [File](../file/file.md) representing the result comparing templates. [File](../file/file.md)::[suffix](../file/functions.md#suffix) is used to determine which plugin should handle the output. The currently supported extensions are: | ||
| 15 | + | ||
| 16 | +* txt | ||
| 17 | +* tail | ||
| 18 | +* rr | ||
| 19 | +* rank | ||
| 20 | +* null | ||
| 21 | +* mtx | ||
| 22 | +* melt | ||
| 23 | +* hist | ||
| 24 | +* heat | ||
| 25 | +* eval | ||
| 26 | +* csv | ||
| 27 | +* best | ||
| 28 | + | ||
| 29 | +Many of these extensions are unique to OpenBR. Please look at the relevant [Output plugin](../../../plugin_docs/output.md) for information on formatting and other concerns. |
docs/docs/api_docs/cpp_api/output/properties.md
0 → 100644
| 1 | +Property | Type | Description | ||
| 2 | +--- | --- | --- | ||
| 3 | +<a class="table-anchor" id=blockrows></a>blockRows | int | Row count for incremental writing block | ||
| 4 | +<a class="table-anchor" id=blockcols></a>blockCols | int | Column count for incremental writing block | ||
| 0 | \ No newline at end of file | 5 | \ No newline at end of file |
docs/docs/api_docs/cpp_api/output/statics.md
0 → 100644
| 1 | +## Output \*make(const [File](../file/file.md) &file, const [FileList](../filelist/filelist.md) &targetFiles, const [FileList](../filelist/filelist.md) &queryFiles) {: #make} | ||
| 2 | + | ||
| 3 | +Make an [Output](output.md) from a string and lists of target and query files. This function calls [initialize](functions.md#initialize), which should be overloaded by derived classes to handle initialization. The provided file is first split using [File](../file/file.md)::[split](../file/functions.md#split-1) and each resulting file is turned into an [Output](output.md) that is stored in a linked-list. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static Output *make(const File &file, const FileList &targetFiles, const FileList &queryFiles) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + file | const [File](../file/file.md) & | File describing the output or outputs to construct | ||
| 14 | + targetFiles | const [FileList](../filelist/filelist.md) & | List of files representing the target templates | ||
| 15 | + queryFiles | const [FileList](../filelist/filelist.md) & | List of files representing the query templates | ||
| 16 | + | ||
| 17 | +* **output:** ([Output](output.md) \*) Returns a pointer to the first output in the linked list | ||
| 18 | +* **example:** | ||
| 19 | + | ||
| 20 | + TemplateList targets = TemplateList() << Template("target1.jpg") << Template("target2.jpg") << Template("target3.jpg"); | ||
| 21 | + TemplateList queries = TemplateList() << Template("query1.jpg") << Template("query2.jpg"); | ||
| 22 | + | ||
| 23 | + Output *output1 = Output::make("output.mtx", targets, queries); // returns a pointer to an Output at "output.mtx" | ||
| 24 | + Output *output2 = Output::make("output1.mtx;output2.mtx", targets, queries); // returns a pointer to the output created with "output1.mtx" with a pointer to the output created with "output2.mtx" |
docs/docs/api_docs/cpp_api/representation/constructors.md
0 → 100644
docs/docs/api_docs/cpp_api/representation/functions.md
0 → 100644
| 1 | +## [Mat][Mat] preprocess(const [Mat][Mat] &image) {: #preprocess } | ||
| 2 | + | ||
| 3 | +This is a virtual function. Preprocess an image into the desired format for the representation. Default implementation returns the image unmodified. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + virtual Mat preprocess(const Mat &image) const | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + image | const [Mat][Mat] & | Image to be preprocessed | ||
| 14 | + | ||
| 15 | +* **output:** ([Mat][Mat]) Returns the preprocessed image | ||
| 16 | +* **example:** | ||
| 17 | + | ||
| 18 | + Template in("picture.jpg"); | ||
| 19 | + | ||
| 20 | + Representation *rep = Representation::make("RepresentationThatRequiresGrayscale"); | ||
| 21 | + rep->preprocess(in); // returns the original image converted to grayscale | ||
| 22 | + | ||
| 23 | +## void train(const [QList][QList]<[Mat][Mat]> &images, const [QList][QList]<float> &labels) {: #train } | ||
| 24 | + | ||
| 25 | +This is a virtual function. Train the representation using the provided images and associated labels. Default implementation does no training. | ||
| 26 | + | ||
| 27 | +* **function definition:** | ||
| 28 | + | ||
| 29 | + virtual void train(const QList<Mat> &images, const QList<float> &labels) | ||
| 30 | + | ||
| 31 | +* **parameters:** | ||
| 32 | + | ||
| 33 | + Parameter | Type | Description | ||
| 34 | + --- | --- | --- | ||
| 35 | + images | const [QList][QList]<[Mat][Mat]> & | Training images | ||
| 36 | + labels | const [QList][QList]<float> & | Training labels | ||
| 37 | + | ||
| 38 | +* **output:** (void) | ||
| 39 | +* **example:** | ||
| 40 | + | ||
| 41 | + // Create data for a 2-class classification problem | ||
| 42 | + QList<Mat> images = QList<Mat>() << Template("training_pic1.jpg").m() | ||
| 43 | + << Template("training_pic2.jpg").m() | ||
| 44 | + << Template("training_pic3.jpg").m() | ||
| 45 | + << Template("training_pic4.jpg").m(); | ||
| 46 | + | ||
| 47 | + QList<float> labels = QList<float>() << 0 << 0 << 1 << 1; | ||
| 48 | + | ||
| 49 | + Representation *rep = Representation::make("Representation"); | ||
| 50 | + rep->train(images, labels); | ||
| 51 | + | ||
| 52 | +## [Mat][Mat] evaluate(const [Mat][Mat] &image, const [QList][QList]<int> &indices = [QList][QList]<int>()) {: #evaluate } | ||
| 53 | + | ||
| 54 | +This is a pure virtual function. For a provided input image calculate only the feature responses associated with the provided indices. The indices are expected relative to the entire feature space. If the indices list is empty the response of the entire feature space is calculated. | ||
| 55 | + | ||
| 56 | +* **function definition:** | ||
| 57 | + | ||
| 58 | + virtual cv::Mat evaluate(const Mat &image, const QList<int> &indices = QList<int>()) const = 0 | ||
| 59 | + | ||
| 60 | +* **parameters:** | ||
| 61 | + | ||
| 62 | + Parameter | Type | Description | ||
| 63 | + --- | --- | --- | ||
| 64 | + image | const [Mat][Mat] & | The image to be converted | ||
| 65 | + indices | const [QList][QList]<int> & | (Optional) A list of indices corresponding to the desired features to calculate. If the list is empty all features are calculated. | ||
| 66 | + | ||
| 67 | +* **output:** ([Mat][Mat]) Returns a 1xN feature vector where N is the number of indices provided. If no indices are provided N equals the size of the feature space. | ||
| 68 | +* **example:** | ||
| 69 | + | ||
| 70 | + Template image("picture.jpg"); | ||
| 71 | + | ||
| 72 | + Representation *rep = Representation::make("Representation"); | ||
| 73 | + rep->evaluate(image, QList<int>() << 7 << 10 << 72 ); // returns a 1x3 Mat feature vector | ||
| 74 | + | ||
| 75 | +## int numFeatures() {: #numfeatures } | ||
| 76 | + | ||
| 77 | +This is a pure virtual function. Get the size of the feature space. | ||
| 78 | + | ||
| 79 | +* **function definition:** | ||
| 80 | + | ||
| 81 | + virtual int numFeatures() const = 0 | ||
| 82 | + | ||
| 83 | +* **parameters:** NONE | ||
| 84 | +* **output:** (int) Returns the size of the feature space | ||
| 85 | +* **example:** | ||
| 86 | + | ||
| 87 | + Representation *rep1 = Representation::make("RepresentationWith1000features"); | ||
| 88 | + Representation *rep2 = Representation::make("RepresentationWith25643features"); | ||
| 89 | + | ||
| 90 | + rep1->numFeatures(); // returns 1000 | ||
| 91 | + rep2->numFeatures(); // returns 25643 | ||
| 92 | + | ||
| 93 | +<!-- Links --> | ||
| 94 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 95 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" |
docs/docs/api_docs/cpp_api/representation/representation.md
0 → 100644
| 1 | +<!-- REPRESENTATION --> | ||
| 2 | + | ||
| 3 | +Inherits [Object](../object/object.md). | ||
| 4 | + | ||
| 5 | +Plugin base class for converting images into feature vectors | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Constructors](constructors.md) | ||
| 10 | +* [Static Functions](statics.md) | ||
| 11 | +* [Functions](functions.md) | ||
| 12 | + | ||
| 13 | +[Representations](representation.md) are used to convert images to feature vectors lazily (only when necessary). They are similar to [Transforms](../transform/transform.md) in many respects but differ in a few key areas. [Transforms](../transform/transform.md) should be used to construct feature vectors if it is desirable to construct a vector before evaluation that encompasses the entire feature space (or a smaller subset learned during training). [Representations](representation.md) should be used if their is a large *possible* feature space but a few select features are necessary for a particular computation. This is often the case in tree architectures, where each node has an associated feature. The *possible* feature space is all of the features associated with all of the nodes, but the *required* features are only the features associated with nodes that are actually visited. The purpose of [Representations](representation.md) is to allow these features to be calculated as needed instead of calculating all of the features before hand, which is less efficient. |
docs/docs/api_docs/cpp_api/representation/statics.md
0 → 100644
| 1 | +## [Representation](representation.md) \*make([QString][QString] str, [QObject][QObject] \*parent) {: #make } | ||
| 2 | + | ||
| 3 | +Make a [Representation](representation.md) from a string. The string is passed to [Factory](../factory/factory.md)::[make](../factory/statics.md#make) to be turned into a representation. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static Representation *make(QString str, QObject *parent) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + str | [QString][QString] | String describing the representation | ||
| 14 | + parent | [QObject][QObject] \* | Parent of the object to be created | ||
| 15 | + | ||
| 16 | +* **output:** ([Representation](representation.md) \*) Returns a pointer to the [Representation](representation.md) described by the string | ||
| 17 | +* **see:** [Factory::make](../factory/statics.md#make) | ||
| 18 | +* **example:** | ||
| 19 | + | ||
| 20 | + Representation *rep = Representation::make("Representation(property1=value1)"); | ||
| 21 | + rep->description(); // Returns "Representation(property1=value1)" | ||
| 22 | + | ||
| 23 | +<!-- Links --> | ||
| 24 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 25 | +[QObject]: http://doc.qt.io/qt-5/QObject.html "QObject" |
docs/docs/api_docs/cpp_api/template/constructors.md
0 → 100644
| 1 | +Constructor | Description | ||
| 2 | +--- | --- | ||
| 3 | +Template() | The default template constructor. It doesn't do anything. | ||
| 4 | +Template(const [File](../file/file.md) &file) | Sets [file](members.md#file) to the given [File](../file/file.md). | ||
| 5 | +Template(const [File](../file/file.md) &file, const [Mat][Mat] &mat) | Sets [file](members.md#file) to the given [File](../file/file.md) and appends the given [Mat][Mat] to itself. | ||
| 6 | +Template(const [Mat][Mat] &mat) | Appends the given [Mat][Mat] to itself | ||
| 7 | + | ||
| 8 | +<!-- Links --> | ||
| 9 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" |
docs/docs/api_docs/cpp_api/template/functions.md
0 → 100644
| 1 | +## operator const [File](../file/file.md) &() const {: #operator-file } | ||
| 2 | + | ||
| 3 | +Idiom to treat the template like a [File](../file/file.md). | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + inline operator const File &() const | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** ([File](../file/file.md) Returns [file](members.md#file). | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +## const [Mat][Mat] &m() const {: #m-1 } | ||
| 14 | + | ||
| 15 | +Idiom to treat the template like a [Mat][Mat]. | ||
| 16 | + | ||
| 17 | +* **function definition:** | ||
| 18 | + | ||
| 19 | + inline const Mat &m() const | ||
| 20 | + | ||
| 21 | +* **parameters:** NONE | ||
| 22 | +* **output:** ([Mat][Mat]) Returns the last [Mat][Mat] in the list. If the list is empty an empty [Mat][Mat] is returned. | ||
| 23 | +* **example:** | ||
| 24 | + | ||
| 25 | + Template t; | ||
| 26 | + t.m(); // returns empty mat | ||
| 27 | + | ||
| 28 | + Mat m1; | ||
| 29 | + t.append(m1); | ||
| 30 | + t.m(); // returns m1; | ||
| 31 | + | ||
| 32 | + Mat m2; | ||
| 33 | + t.append(m2); | ||
| 34 | + t.m(); // returns m2; | ||
| 35 | + | ||
| 36 | + | ||
| 37 | +## [Mat][Mat] &m() {: #m-2 } | ||
| 38 | + | ||
| 39 | +Idiom to treat the template like a [Mat][Mat]. | ||
| 40 | + | ||
| 41 | +* **function definition:** | ||
| 42 | + | ||
| 43 | + inline Mat &m() | ||
| 44 | + | ||
| 45 | +* **parameters:** NONE | ||
| 46 | +* **output:** ([Mat][Mat]) Returns the last [Mat][Mat] in the list. If the list is empty an empty [Mat][Mat] is returned. | ||
| 47 | +* **example:** | ||
| 48 | + | ||
| 49 | + Template t; | ||
| 50 | + t.m(); // returns empty mat | ||
| 51 | + | ||
| 52 | + Mat m1; | ||
| 53 | + t.append(m1); | ||
| 54 | + t.m(); // returns m1; | ||
| 55 | + | ||
| 56 | + Mat m2; | ||
| 57 | + t.append(m2); | ||
| 58 | + t.m(); // returns m2; | ||
| 59 | + | ||
| 60 | + | ||
| 61 | +## operator const [Mat][Mat] &() {: #operator-mat-1 } | ||
| 62 | + | ||
| 63 | +Idiom to treat the template like a [Mat][Mat]. Makes a call to [m()](#m-1). | ||
| 64 | + | ||
| 65 | +* **function definition:** | ||
| 66 | + | ||
| 67 | + inline operator const Mat&() const | ||
| 68 | + | ||
| 69 | +* **parameters:** NONE | ||
| 70 | +* **output:** ([Mat][Mat]) Returns the last [Mat][Mat] in the list. If the list is empty an empty [Mat][Mat] is returned. | ||
| 71 | +* **see:** [m](#m-1) | ||
| 72 | + | ||
| 73 | + | ||
| 74 | +## operator [Mat][Mat] &() {: #operator-mat-2 } | ||
| 75 | + | ||
| 76 | +Idiom to treat the template like a [Mat][Mat]. Makes a call to [m()](#m-1). | ||
| 77 | + | ||
| 78 | +* **function definition:** | ||
| 79 | + | ||
| 80 | + inline operator Mat&() | ||
| 81 | + | ||
| 82 | +* **parameters:** NONE | ||
| 83 | +* **output:** ([Mat][Mat]) Returns the last [Mat][Mat] in the list. If the list is empty an empty [Mat][Mat] is returned. | ||
| 84 | +* **see:** [m](#m-1) | ||
| 85 | + | ||
| 86 | + | ||
| 87 | +## operator [_InputArray][InputArray] &() {: #operator-inputarray } | ||
| 88 | + | ||
| 89 | +Idiom to treat the template like an [_InputArray][InputArray]. Makes a call to [m()](#m-1). | ||
| 90 | + | ||
| 91 | +* **function definition:** | ||
| 92 | + | ||
| 93 | + inline operator _InputArray() const | ||
| 94 | + | ||
| 95 | +<!-- _no italics_--> | ||
| 96 | +* **parameters:** NONE | ||
| 97 | +* **output:** ([_InputArray][InputArray]) Returns the last [Mat][Mat] in the list. If the list is empty an empty [Mat][Mat] is returned. | ||
| 98 | +* **see:** [m](#m-1) | ||
| 99 | + | ||
| 100 | + | ||
| 101 | +## operator [_OutputArray][OutputArray] &() {: #operator-outputarray } | ||
| 102 | + | ||
| 103 | +Idiom to treat the template like an [_OutputArray][InputArray]. Makes a call to [m()](#m-1). | ||
| 104 | + | ||
| 105 | +* **function definition:** | ||
| 106 | + | ||
| 107 | + inline operator _OutputArray() | ||
| 108 | + | ||
| 109 | +* **parameters:** NONE | ||
| 110 | +* **output:** ([_OutputArray][OutputArray]) Returns the last [Mat][Mat] in the list. If the list is empty an empty [Mat][Mat] is returned. | ||
| 111 | +* **see:** [m](#m-1) | ||
| 112 | + | ||
| 113 | + | ||
| 114 | +## [Mat][Mat] &operator =(const [Mat][Mat] &other) {: #operator-e } | ||
| 115 | + | ||
| 116 | +Idiom to treat the template like a [Mat][Mat]. Set the result of [m()](#m-1) equal to other. | ||
| 117 | + | ||
| 118 | +* **function definition:** | ||
| 119 | + | ||
| 120 | + inline Mat &operator=(const Mat &other) | ||
| 121 | + | ||
| 122 | +* **parameters:** | ||
| 123 | + | ||
| 124 | + Parameter | Type | Description | ||
| 125 | + --- | --- | --- | ||
| 126 | + other | const Mat & | Mat to overwrite value of [m](#m-1) | ||
| 127 | + | ||
| 128 | +* **output**: ([Mat][Mat] &) Returns a reference to the updated [Mat][Mat] | ||
| 129 | + | ||
| 130 | + | ||
| 131 | +## bool isNull() const {: #isnull } | ||
| 132 | + | ||
| 133 | +Check if the template is NULL. | ||
| 134 | + | ||
| 135 | +* **function definition:** | ||
| 136 | + | ||
| 137 | + inline bool isNull() const | ||
| 138 | + | ||
| 139 | +* **parameters:** NONE | ||
| 140 | +* **output:** (bool) Returns true if the template is empty *or* if [m](#m-1) has no data. | ||
| 141 | +* **example:** | ||
| 142 | + | ||
| 143 | + Template t; | ||
| 144 | + t.isNull(); // returns true | ||
| 145 | + | ||
| 146 | + t.append(Mat()); | ||
| 147 | + t.isNull(); // returns true | ||
| 148 | + | ||
| 149 | + t.append(Mat::ones(1, 1, CV_8U)); | ||
| 150 | + t.isNull(); // returns false | ||
| 151 | + | ||
| 152 | + | ||
| 153 | +## void merge(const [Template](template.md) &other) {: #merge } | ||
| 154 | + | ||
| 155 | +Append the contents of another template. The [files](members.md#file) are appended using [append](../file/functions.md#append-1). | ||
| 156 | + | ||
| 157 | +* **function definition:** | ||
| 158 | + | ||
| 159 | + inline void merge(const Template &other) | ||
| 160 | + | ||
| 161 | +* **parameters:** | ||
| 162 | + | ||
| 163 | + Parameter | Type | Description | ||
| 164 | + --- | --- | --- | ||
| 165 | + other | const [Template](template.md) & | Template to be merged | ||
| 166 | + | ||
| 167 | +* **output:** (void) | ||
| 168 | +* **example:** | ||
| 169 | + | ||
| 170 | + Template t1("picture1.jpg"), t2("picture2.jpg"); | ||
| 171 | + Mat m1, m2; | ||
| 172 | + | ||
| 173 | + t1.append(m1); | ||
| 174 | + t2.append(m2); | ||
| 175 | + | ||
| 176 | + t1.merge(t2); | ||
| 177 | + | ||
| 178 | + t1.file; // returns picture1.jpg;picture2.jpg[seperator=;] | ||
| 179 | + t1; // returns [m1, m2] | ||
| 180 | + | ||
| 181 | + | ||
| 182 | +## size_t bytes() const {: #bytes } | ||
| 183 | + | ||
| 184 | +Get the total number of bytes in the template | ||
| 185 | + | ||
| 186 | +* **function definition:** | ||
| 187 | + | ||
| 188 | + size_t bytes() const | ||
| 189 | + | ||
| 190 | +* **parameters:** None | ||
| 191 | +* **output:** (int) Returns the sum of the bytes in each [Mat][Mat] in the [Template](template.md) | ||
| 192 | +* **example:** | ||
| 193 | + | ||
| 194 | + Template t; | ||
| 195 | + | ||
| 196 | + Mat m1 = Mat::ones(1, 1, CV_8U); // 1 byte | ||
| 197 | + Mat m2 = Mat::ones(2, 2, CV_8U); // 4 bytes | ||
| 198 | + Mat m3 = Mat::ones(3, 3, CV_8U); // 9 bytes | ||
| 199 | + | ||
| 200 | + t << m1 << m2 << m3; | ||
| 201 | + | ||
| 202 | + t.bytes(); // returns 14 | ||
| 203 | + | ||
| 204 | + | ||
| 205 | +## Template clone() const {: #clone } | ||
| 206 | + | ||
| 207 | +Clone the template | ||
| 208 | + | ||
| 209 | +* **function definition:** | ||
| 210 | + | ||
| 211 | + Template clone() const | ||
| 212 | + | ||
| 213 | +* **parameters:** NONE | ||
| 214 | +* **output:** ([Template](template.md)) Returns a new [Template](template.md) with copies of the [file](members.md#file) and each [Mat][Mat] that was in the original. | ||
| 215 | +* **example:** | ||
| 216 | + | ||
| 217 | + Template t1("picture.jpg"); | ||
| 218 | + t1.append(Mat::ones(1, 1, CV_8U)); | ||
| 219 | + | ||
| 220 | + Template t2 = t1.clone(); | ||
| 221 | + | ||
| 222 | + t2.file; // returns "picture.jpg" | ||
| 223 | + t2; // returns ["1"] | ||
| 224 | + | ||
| 225 | +<!-- Links --> | ||
| 226 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" | ||
| 227 | +[InputArray]: http://docs.opencv.org/modules/core/doc/basic_structures.html#inputarray "InputArray" | ||
| 228 | +[OutputArray]: http://docs.opencv.org/modules/core/doc/basic_structures.html#outputarray "OutputArray" |
docs/docs/api_docs/cpp_api/template/members.md
0 → 100644
docs/docs/api_docs/cpp_api/template/statics.md
0 → 100644
| 1 | +## [QDataStream][QDataStream] &operator<<([QDataStream][QDataStream] &stream, const [Template](template.md) &t) {: #operator-ltlt } | ||
| 2 | + | ||
| 3 | +Serialize a template | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + QDataStream &operator<<(QDataStream &stream, const Template &t) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + stream | [QDataStream][QDataStream] & | The stream to serialize to | ||
| 14 | + t | const [Template](template.md) & | The template to serialize | ||
| 15 | + | ||
| 16 | +* **output:** ([QDataStream][QDataStream] &) Returns the updated stream | ||
| 17 | +* **example:** | ||
| 18 | + | ||
| 19 | + void store(QDataStream &stream) | ||
| 20 | + { | ||
| 21 | + Template t("picture.jpg"); | ||
| 22 | + t.append(Mat::ones(1, 1, CV_8U)); | ||
| 23 | + | ||
| 24 | + stream << t; // "["1"]picture.jpg" serialized to the stream | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | +## [QDataStream][QDataStream] &operator>>([QDataStream][QDataStream] &stream, [Template](template.md) &t) {: #operator-gtgt } | ||
| 28 | + | ||
| 29 | +Deserialize a template | ||
| 30 | + | ||
| 31 | +* **function definition:** | ||
| 32 | + | ||
| 33 | + QDataStream &operator>>(QDataStream &stream, Template &t) | ||
| 34 | + | ||
| 35 | +* **parameters:** | ||
| 36 | + | ||
| 37 | + Parameter | Type | Description | ||
| 38 | + --- | --- | --- | ||
| 39 | + stream | [QDataStream][QDataStream] & | The stream to deserialize to | ||
| 40 | + t | const [Template](template.md) & | The template to deserialize | ||
| 41 | + | ||
| 42 | +* **output:** ([QDataStream][QDataStream] &) Returns the updated stream | ||
| 43 | +* **example:** | ||
| 44 | + | ||
| 45 | + void load(QDataStream &stream) | ||
| 46 | + { | ||
| 47 | + Template in("picture.jpg"); | ||
| 48 | + in.append(Mat::ones(1, 1, CV_8U)); | ||
| 49 | + | ||
| 50 | + stream << in; // "["1"]picture.jpg" serialized to the stream | ||
| 51 | + | ||
| 52 | + Template out; | ||
| 53 | + stream >> out; | ||
| 54 | + | ||
| 55 | + out.file; // returns "picture.jpg" | ||
| 56 | + out; // returns ["1"] | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | +<!-- Links --> | ||
| 60 | +[QDataStream]: http://doc.qt.io/qt-5/qdatastream.html "QDataStream" |
docs/docs/api_docs/cpp_api/template/template.md
0 → 100644
| 1 | +<!-- TEMPLATE --> | ||
| 2 | + | ||
| 3 | +Inherits [QList][QList]<[Mat][Mat]>. | ||
| 4 | + | ||
| 5 | +A list of matrices associated with a file. | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Members](members.md) | ||
| 10 | +* [Constructors](constructors.md) | ||
| 11 | +* [Static Functions](statics.md) | ||
| 12 | +* [Functions](functions.md) | ||
| 13 | + | ||
| 14 | +The Template is one of two important data structures in OpenBR (the [File](../file/file.md) is the other). | ||
| 15 | +A template represents a biometric at various stages of enrollment and can be modified by [Transforms](../transform/transform.md) and compared to other [templates](template.md) with [Distances](../distance/distance.md). | ||
| 16 | + | ||
| 17 | +While there exist many cases (ex. video enrollment, multiple face detects, per-patch subspace learning, ...) where the template will contain more than one matrix, | ||
| 18 | +in most cases templates have exactly one matrix in their list representing a single image at various stages of enrollment. | ||
| 19 | +In the cases where exactly one image is expected, the template provides the function m() as an idiom for treating it as a single matrix. | ||
| 20 | +Casting operators are also provided to pass the template into image processing functions expecting matrices. | ||
| 21 | + | ||
| 22 | +Metadata related to the template that is computed during enrollment (ex. bounding boxes, eye locations, quality metrics, ...) should be assigned to the template's [File](members.md#file) member. | ||
| 23 | + | ||
| 24 | +<!-- Links --> | ||
| 25 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 26 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" |
docs/docs/api_docs/cpp_api/templatelist/constructors.md
0 → 100644
| 1 | +Constructor | Description | ||
| 2 | +--- | --- | ||
| 3 | +TemplateList() | The default [TemplateList](templatelist.md) constructor. Doesn't do anything. | ||
| 4 | +TemplateList(const [QList][QList]<[Template](../template/template.md)> &templates) | Initialize the [TemplateList](templatelist.md) with a list of templates. The given list is appended | ||
| 5 | +TemplateList(const [QList][QList]<[File](../file/file.md)> &files) | Initialize the [TemplateList](templatelist.md) with a list of [Files](../file/file.md). Each [File](../file/file.md) is treated like a template and appended. | ||
| 6 | + | ||
| 7 | +<!-- Links --> | ||
| 8 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" |
docs/docs/api_docs/cpp_api/templatelist/functions.md
0 → 100644
| 1 | +## [QList][QList]<int> indexProperty(const [QString][QString] &propName, [QHash][QHash]<[QString][QString], int> &valueMap, [QHash][QHash]<int, [QVariant][QVariant]> &reverseLookup) const {: #indexproperty-1 } | ||
| 2 | + | ||
| 3 | +Convert [metadata](../file/members.md#m_metadata) values associated with **propName** to integers. Each unique value gets its own integer. This is useful in many classification problems where nominal data (e.g "Male", "Female") needs to represented with integers ("Male" = 0, "Female" = 1). **valueMap** and **reverseLookup** are created to allow easy conversion to the integer replacements and back. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + QList<int> indexProperty(const QString &propName, QHash<QString, int> &valueMap, QHash<int, QVariant> &reverseLookup) const | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + propName | const [QString][QString] & | [Metadata](../file/members.md#m_metadata) key | ||
| 14 | + valueMap | [QHash][QHash]<[QString][QString], int> & | A mapping from [metadata](../file/members.md#m_metadata) values to the equivalent unique index. [QStrings][QString] are used instead of [QVariant][QVariant] so comparison operators can be used. This is filled in by the function and can be provided empty. | ||
| 15 | + reverseLookup | [QHash][QHash]<int, [QVariant][QVariant]> & | A mapping from the unique index to the original value. This is the *reverse* mapping of the **valueMap**. This is filled in by the function and can be provided empty. | ||
| 16 | + | ||
| 17 | +* **output:** ([QList][QList]<int>) Returns a list of unique integers that can be mapped to the [metadata](../file/members.md#m_metadata) values associated with **propName**. The integers can be mapped to their respective values using **valueMap** and the values can be mapped to the integers using **reverseLookup**. | ||
| 18 | +* **example:** | ||
| 19 | + | ||
| 20 | + Template t1, t2, t3, t4; | ||
| 21 | + | ||
| 22 | + t1.file.set("Key", QString("Class 1")); | ||
| 23 | + t2.file.set("Key", QString("Class 2")); | ||
| 24 | + t3.file.set("Key", QString("Class 3")); | ||
| 25 | + t4.file.set("Key", QString("Class 1")); | ||
| 26 | + | ||
| 27 | + TemplateList tList(QList<Template>() << t1 << t2 << t3 << t4); | ||
| 28 | + | ||
| 29 | + QHash<QString, int> valueMap; | ||
| 30 | + QHash<int, QVariant> reverseLookup; | ||
| 31 | + tList.indexProperty("Key", valueMap, reverseLookup); // returns [0, 1, 2, 0] | ||
| 32 | + valueMap; // returns QHash(("Class 1", 0)("Class 2", 1)("Class 3", 2)) | ||
| 33 | + reverseLookup; // QHash((0, QVariant(QString, "Class 1")) (2, QVariant(QString, "Class 3")) (1, QVariant(QString, "Class 2"))) | ||
| 34 | + | ||
| 35 | + | ||
| 36 | +## [QList][QList]<int> indexProperty(const [QString][QString] &propName, [QHash][QHash]<[QString][QString], int> \*valueMap=NULL, [QHash][QHash]<int, [QVariant][QVariant]> \*reverseLookup=NULL) const {: #indexproperty-2 } | ||
| 37 | + | ||
| 38 | +Shortcut to call [indexProperty](#indexproperty-1) without **valueMap** or **reverseLookup** arguments. | ||
| 39 | + | ||
| 40 | +* **function definition:** | ||
| 41 | + | ||
| 42 | + QList<int> indexProperty(const QString &propName, QHash<QString, int> * valueMap=NULL,QHash<int, QVariant> * reverseLookup = NULL) const | ||
| 43 | + | ||
| 44 | +* **parameters:** | ||
| 45 | + | ||
| 46 | + Parameter | Type | Description | ||
| 47 | + --- | --- | --- | ||
| 48 | + propName | const [QString][QString] & | [Metadata](../file/members.md#m_metadata) key | ||
| 49 | + valueMap | [QHash][QHash]<[QString][QString], int> \* | (Optional) A mapping from [metadata](../file/members.md#m_metadata) values to the equivalent unique index. [QStrings][QString] are used instead of [QVariant][QVariant] so comparison operators can be used. This is filled in by the function and can be provided empty. | ||
| 50 | + reverseLookup | [QHash][QHash]<int, [QVariant][QVariant]> \* | (Optional) A mapping from the unique index to the original value. This is the *reverse* mapping of the **valueMap**. This is filled in by the function and can be provided empty. | ||
| 51 | + | ||
| 52 | +* **output:** ([QList][QList]<int>) Returns a list of unique integers that can be mapped to the [metadata](../file/members.md#m_metadata) values associated with **propName**. The integers can be mapped to their respective values using **valueMap** (if provided) and the values can be mapped to the integers using **reverseLookup** (if provided). | ||
| 53 | + | ||
| 54 | + | ||
| 55 | +## [QList][QList]<int> applyIndex(const [QString][QString] &propName, const [QHash][QHash]<[QString][QString], int> &valueMap) const {: #applyindex } | ||
| 56 | + | ||
| 57 | +Apply a mapping to convert non-integer values to integers. [Metadata](../file/members.md#m_metadata) values associated with **propName** are mapped through the given **valueMap**. | ||
| 58 | + | ||
| 59 | +* **function definition:** | ||
| 60 | + | ||
| 61 | + QList<int> applyIndex(const QString &propName, const QHash<QString, int> &valueMap) const | ||
| 62 | + | ||
| 63 | +* **parameters:** | ||
| 64 | + | ||
| 65 | + Parameter | Type | Description | ||
| 66 | + --- | --- | --- | ||
| 67 | + propName | const [QString][QString] & | [Metadata](../file/members.md#m_metadata) key | ||
| 68 | + valueMap | const [QHash][QHash]<[QString][QString], int> & | (Optional) A mapping from [metadata](../file/members.md#m_metadata) values to the equivalent unique index. [QStrings][QString] are used instead of [QVariant][QVariant] so comparison operators can be used. | ||
| 69 | + | ||
| 70 | +* **output:** ([Qlist][QList]<int>) Returns a list of integer values. The values are ordered in the same order as the [Templates](../template/template.md) in the list. The values are calculated like so: | ||
| 71 | + | ||
| 72 | + 1. If the value *is* found in the **valueMap**, its integer mapping is appened to the list. | ||
| 73 | + 2. If the value *is not* found in the **valueMap**, -1 is appened to the list. | ||
| 74 | + | ||
| 75 | +* **example:** | ||
| 76 | + | ||
| 77 | + Template t1, t2, t3, t4; | ||
| 78 | + | ||
| 79 | + t1.file.set("Key", QString("Class 1")); | ||
| 80 | + t2.file.set("Key", QString("Class 2")); | ||
| 81 | + t3.file.set("Key", QString("Class 3")); | ||
| 82 | + t4.file.set("Key", QString("Class 1")); | ||
| 83 | + | ||
| 84 | + TemplateList tList(QList<Template>() << t1 << t2 << t3 << t4); | ||
| 85 | + | ||
| 86 | + QHash<QString, int> valueMap; | ||
| 87 | + valueMap.insert("Class 1", 0); | ||
| 88 | + valueMap.insert("Class 2", 1); | ||
| 89 | + | ||
| 90 | + tList.applyIndex("Key", valueMap); // returns [0, 1, -1, 0] | ||
| 91 | + | ||
| 92 | + | ||
| 93 | +## <tt>T</tt> bytes() const {: #bytes } | ||
| 94 | + | ||
| 95 | +Get the total number of bytes in the [TemplateList](templatelist.md). | ||
| 96 | + | ||
| 97 | +* **function definition:** | ||
| 98 | + | ||
| 99 | + template <typename T> T bytes() const | ||
| 100 | + | ||
| 101 | +* **parameters:** NONE | ||
| 102 | +* **output:** (<tt>T</tt>) Returns the sum of the bytes in each of the [Templates](../template/template.md) in the list. <tt>T</tt> is a user specified type. It is expected to be numeric (int, float etc.) | ||
| 103 | +* **see:** [bytes](../template/functions.md#bytes) | ||
| 104 | +* **example:** | ||
| 105 | + | ||
| 106 | + Template t1, t2; | ||
| 107 | + | ||
| 108 | + t1.append(Mat::ones(1, 1, CV_8U)); // 1 byte | ||
| 109 | + t1.append(Mat::ones(2, 2, CV_8U)); // 4 bytes | ||
| 110 | + t2.append(Mat::ones(3, 3, CV_8U)); // 9 bytes | ||
| 111 | + t2.append(Mat::ones(4, 4, CV_8U)); // 16 bytes | ||
| 112 | + | ||
| 113 | + TemplateList tList(QList<Template>() << t1 << t2); | ||
| 114 | + tList.bytes(); // returns 30 | ||
| 115 | + | ||
| 116 | + | ||
| 117 | +## [QList][QList]<[Mat][Mat]> data(int index = 0) const {: #data } | ||
| 118 | + | ||
| 119 | +Get a list of matrices compiled from each [Template](../template/template.md) in the list. | ||
| 120 | + | ||
| 121 | +* **function definition:** | ||
| 122 | + | ||
| 123 | + QList<cv::Mat> data(int index = 0) const | ||
| 124 | + | ||
| 125 | +* **parameters:** | ||
| 126 | + | ||
| 127 | + Parameter | Type | Description | ||
| 128 | + --- | --- | --- | ||
| 129 | + index | int | (Optional) Index into each [Template](../template/template.md) to select a [Mat][Mat]. Default is 0. | ||
| 130 | + | ||
| 131 | +* **output:** ([QList][QList]<[Mat][Mat]>) Returns a list of [Mats][Mat]. One [Mat][Mat] is supplied by each [Template](../template/template.md) in the image at the specified index. | ||
| 132 | +* **example:** | ||
| 133 | + | ||
| 134 | + Template t1, t2; | ||
| 135 | + | ||
| 136 | + t1.append(Mat::ones(1, 1, CV_8U)); | ||
| 137 | + t1.append(Mat::zeros(1, 1, CV_8U)); | ||
| 138 | + t2.append(Mat::ones(1, 1, CV_8U)); | ||
| 139 | + t2.append(Mat::zeros(1, 1, CV_8U)); | ||
| 140 | + | ||
| 141 | + TemplateList tList(QList<Template>() << t1 << t2); | ||
| 142 | + tList.data(); // returns ["1", "1"]; | ||
| 143 | + tList.data(1); // returns ["0", "0"]; | ||
| 144 | + | ||
| 145 | + | ||
| 146 | +## [QList][QList]<[TemplateList](templatelist.md)> partition(const [QList][QList]<int> &partitionSizes) const {: #partition } | ||
| 147 | + | ||
| 148 | +Divide the [TemplateList](templatelist.md) into a list of [TemplateLists](templatelist.md) partitions. | ||
| 149 | + | ||
| 150 | + * **function defintion:** | ||
| 151 | + | ||
| 152 | + QList<TemplateList> partition(const QList<int> &partitionSizes) const | ||
| 153 | + | ||
| 154 | +* **parameters:** | ||
| 155 | + | ||
| 156 | + Parameter | Type | Description | ||
| 157 | + --- | --- | --- | ||
| 158 | + partitionSizes | [QList][QList]<int> | A list of sizes for the partitions. The total number of partitions is equal to the length of this list. Each value in this list specifies the number of [Mats][Mat] that should be in each template of the associated partition. The sum of values in this list *must* equal the number of [Mats][Mat] in each [Template](../template/template.md) in the original [TemplateList](templatelist.md). | ||
| 159 | + | ||
| 160 | +* **output:** ([QList][QList]<[TemplateList](templatelist.md)>) Returns a [QList][QList] of [TemplateLists](templatelist.md) of partitions. Each partition has length equal to the number of templates in the original [TemplateList](templatelist.md). Each [Template](../template/template.md) has length equal to the size specified in the associated value in **partitionSizes**. | ||
| 161 | +* **example:** | ||
| 162 | + | ||
| 163 | + Template t1, t2, t3; | ||
| 164 | + | ||
| 165 | + t1.append(Mat::ones(1, 1, CV_8U)); | ||
| 166 | + t1.append(2*Mat::ones(1, 1, CV_8U)); | ||
| 167 | + t1.append(3*Mat::ones(1, 1, CV_8U)); | ||
| 168 | + | ||
| 169 | + t2.append(4*Mat::ones(1, 1, CV_8U)); | ||
| 170 | + t2.append(5*Mat::ones(1, 1, CV_8U)); | ||
| 171 | + t2.append(6*Mat::ones(1, 1, CV_8U)); | ||
| 172 | + | ||
| 173 | + t3.append(7*Mat::ones(1, 1, CV_8U)); | ||
| 174 | + t3.append(8*Mat::ones(1, 1, CV_8U)); | ||
| 175 | + t3.append(9*Mat::ones(1, 1, CV_8U)); | ||
| 176 | + | ||
| 177 | + TemplateList tList(QList<Template>() << t1 << t2 << t3); | ||
| 178 | + | ||
| 179 | + QList<TemplateList> partitions = tList.partition(QList<int>() << 1 << 2); // split into 2 partitions. 1 with 1 Mat and 1 with 2 Mats. | ||
| 180 | + | ||
| 181 | + partitions[0]; // returns [("1"), ("4"), ("7")] | ||
| 182 | + partitions[1]; // returns [("2", "3"), ("5", "6"), ("8", "9")] | ||
| 183 | + | ||
| 184 | +## [FileList](../filelist/filelist.md) files() const {: #files } | ||
| 185 | + | ||
| 186 | +Get a list of all the [Files](../file/file.md) in the [TemplateList](templatelist.md) | ||
| 187 | + | ||
| 188 | +* **function definition:** | ||
| 189 | + | ||
| 190 | + FileList files() const | ||
| 191 | + | ||
| 192 | +* **parameters:** NONE | ||
| 193 | +* **output:** ([FileList](../filelist/filelist.md)) Returns a [FileList](../filelist/filelist.md) with the [file](../template/members.md#file) of each [Template](../template/template.md) in the [TemplateList](templatelist.md). | ||
| 194 | +* **example:** | ||
| 195 | + | ||
| 196 | + Template t1("picture1.jpg"), t2("picture2.jpg"); | ||
| 197 | + | ||
| 198 | + t1.file.set("Key", QVariant::fromValue<float>(1)); | ||
| 199 | + t2.file.set("Key", QVariant::fromValue<float>(2)); | ||
| 200 | + | ||
| 201 | + TemplateList tList(QList<Template>() << t1 << t2); | ||
| 202 | + | ||
| 203 | + tList.files(); // returns ["picture1.jpg[Key=1]", "picture2.jpg[Key=2]"] | ||
| 204 | + | ||
| 205 | + | ||
| 206 | +## [FileList](../filelist/filelist.md) operator()() {: #operator-pp } | ||
| 207 | + | ||
| 208 | +Shortcut call to [files](#files) | ||
| 209 | + | ||
| 210 | +* **function definition:** | ||
| 211 | + | ||
| 212 | + FileList operator()() const | ||
| 213 | + | ||
| 214 | +* **parameters:** NONE | ||
| 215 | +* **output:** ([FileList](../filelist/filelist.md)) Returns a [FileList](../filelist/filelist.md) with the [file](../template/members.md#file) of each [Template](../template/template.md) in the [TemplateList](templatelist.md). | ||
| 216 | +* **example:** | ||
| 217 | + | ||
| 218 | + Template t1("picture1.jpg"), t2("picture2.jpg"); | ||
| 219 | + | ||
| 220 | + t1.file.set("Key", QVariant::fromValue<float>(1)); | ||
| 221 | + t2.file.set("Key", QVariant::fromValue<float>(2)); | ||
| 222 | + | ||
| 223 | + TemplateList tList(QList<Template>() << t1 << t2); | ||
| 224 | + | ||
| 225 | + tList.files(); // returns ["picture1.jpg[Key=1]", "picture2.jpg[Key=2]"] | ||
| 226 | + | ||
| 227 | + | ||
| 228 | +## [QMap][QMap]<T, int> countValues(const [QString][QString] &propName, bool excludeFailures = false) const {: #countvalues } | ||
| 229 | + | ||
| 230 | +Get the frequency of each unique value associated with a provided [metadata](../file/members.md#m_metadata) key. | ||
| 231 | + | ||
| 232 | +* **function definition:** | ||
| 233 | + | ||
| 234 | +template<typename T> QMap<T,int> countValues(const QString &propName, bool excludeFailures = false) const | ||
| 235 | + | ||
| 236 | +* **parameters:** | ||
| 237 | + | ||
| 238 | + Parameter | Type | Description | ||
| 239 | + --- | --- | --- | ||
| 240 | + propName | const [QString][QString] & | [Metadata](../file/members.md#m_metadata) key | ||
| 241 | + excludeFailures | bool | (Optional) Exclude [File](../file/file.md) [metadata](../file/members.md#m_metadata) if the [File](../file/file.md) has [fte](../file/members.md#fte) equal to true. Default is false | ||
| 242 | + | ||
| 243 | +* **output:** ([QMap][QMap]<<T, int>) Returns a mapping between unique [metadata](../file/members.md#m_metadata) and their frequency. | ||
| 244 | +* **example:** | ||
| 245 | + | ||
| 246 | + Template t1, t2, t3, t4; | ||
| 247 | + | ||
| 248 | + t1.file.set("Key", QString("Class 1")); | ||
| 249 | + t2.file.set("Key", QString("Class 2")); | ||
| 250 | + t3.file.set("Key", QString("Class 3")); | ||
| 251 | + t4.file.set("Key", QString("Class 1")); | ||
| 252 | + | ||
| 253 | + TemplateList tList(QList<Template>() << t1 << t2 << t3 << t4); | ||
| 254 | + | ||
| 255 | + tList.countValues<QString>("Key"); // returns QMap(("Class 1", 2), ("Class 2", 1), ("Class 3", 1)) | ||
| 256 | + | ||
| 257 | +## [TemplateList](templatelist.md) reduced() const {: #reduced } | ||
| 258 | + | ||
| 259 | +Reduce the [Templates](../template/template.md) in the [TemplateList](templatelist.md) by merging them together. | ||
| 260 | + | ||
| 261 | +* **function definition:** | ||
| 262 | + | ||
| 263 | + TemplateList reduced() const | ||
| 264 | + | ||
| 265 | +* **parameters:** NONE | ||
| 266 | +* **output:** ([TemplateList](templatelist.md)) Returns a [TemplateList](templatelist.md) with a single [Template](../template/template.md). The [Template](../template/template.md) is the result of calling [merge](../template/functions.md#merge) on every [Template](../template/template.md). | ||
| 267 | +* **see:** [merge](../template/functions.md#merge) | ||
| 268 | +* **example:** | ||
| 269 | + | ||
| 270 | + Template t1("picture1.jpg"), t2("picture2.jpg"); | ||
| 271 | + | ||
| 272 | + t1.file.set("Key1", QString("Value1")); | ||
| 273 | + t2.file.set("Key2", QString("Value2")); | ||
| 274 | + | ||
| 275 | + TemplateList tList(QList<Template>() << t1 << t2); | ||
| 276 | + | ||
| 277 | + TemplateList reduced = tList.reduced(); | ||
| 278 | + reduced.size(); // returns 1 | ||
| 279 | + reduced.files(); // returns ["picture1.jpg;picture2.jpg[Key1=Value1, Key2=Value2, separator=;]"] | ||
| 280 | + | ||
| 281 | +## [QList][QList]<int> find(const [QString][QString] &key, const T &value) {: #find } | ||
| 282 | + | ||
| 283 | +Get the indices of every [Template](../template/template.md) that has a provided key value pairing in its [metadata](../file/members.md#m_metadata) | ||
| 284 | + | ||
| 285 | +* **function definition:** | ||
| 286 | + | ||
| 287 | + template<typename T> QList<int> find(const QString &key, const <tt>T</tt> &value) | ||
| 288 | + | ||
| 289 | +* **parameters:** | ||
| 290 | + | ||
| 291 | + Parameter | Type | Description | ||
| 292 | + --- | --- | --- | ||
| 293 | + key | const [QString][QString] & | [Metadata](../file/members.md#m_metadata) key to search for | ||
| 294 | + value | const <tt>T</tt> & | Value to search for. Both the **key** and value must match. <tt>T</tt> is a user specified type. | ||
| 295 | + | ||
| 296 | +* **output:** ([QList][QList]<int>) Returns a list of indices for [Templates](../template/template.md) that contained the key-value pairing in their [metadata](../file/members.md#m_metadata) | ||
| 297 | +* **example:** | ||
| 298 | + | ||
| 299 | + Template t1, t2, t3; | ||
| 300 | + | ||
| 301 | + t1.file.set("Key", QString("Value1")); | ||
| 302 | + t2.file.set("Key", QString("Value2")); | ||
| 303 | + t3.file.set("Key", QString("Value2")); | ||
| 304 | + | ||
| 305 | + TemplateList tList(QList<Template>() << t1 << t2 << t3); | ||
| 306 | + tList.find<QString>("Key", "Value2"); // returns [1, 2] | ||
| 307 | + | ||
| 308 | +<!-- Links --> | ||
| 309 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 310 | +[QHash]: http://doc.qt.io/qt-5/qhash.html "QHash" | ||
| 311 | +[QMap]: http://doc.qt.io/qt-5/qmap.html "QMap" | ||
| 312 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 313 | +[QVariant]: http://doc.qt.io/qt-5/qvariant.html "QVariant" | ||
| 314 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" |
docs/docs/api_docs/cpp_api/templatelist/statics.md
0 → 100644
| 1 | +## [TemplateList](templatelist.md) fromGallery(const [File](../file/file.md) &gallery) {: #fromgallery } | ||
| 2 | + | ||
| 3 | +Create a [TemplateList](templatelist.md) from a gallery [File](../file/file.md). | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + static TemplateList fromGallery(const File &gallery) | ||
| 8 | + | ||
| 9 | +* **parameters:** | ||
| 10 | + | ||
| 11 | + Parameter | Type | Description | ||
| 12 | + --- | --- | --- | ||
| 13 | + gallery | const [File](../file/file.md) & | Gallery [file](../file/file.md) to be enrolled. | ||
| 14 | + | ||
| 15 | +* **output:** ([TemplateList](templatelist.md)) Returns a [TemplateList](templatelist.md) created by enrolling the gallery. | ||
| 16 | + | ||
| 17 | + | ||
| 18 | +## [TemplateList](templatelist.md) fromBuffer(const [QByteArray][QByteArray] &buffer) {: #frombuffer } | ||
| 19 | + | ||
| 20 | +Create a template from a memory buffer of individual templates. This is compatible with **.gal** galleries. | ||
| 21 | + | ||
| 22 | +* **function definition:** | ||
| 23 | + | ||
| 24 | + static TemplateList fromBuffer(const QByteArray &buffer) | ||
| 25 | + | ||
| 26 | +* **parameters:** | ||
| 27 | + | ||
| 28 | + Parameter | Type | Description | ||
| 29 | + --- | --- | --- | ||
| 30 | + buffer | const [QByteArray][QByteArray] & | Raw data buffer to be enrolled | ||
| 31 | + | ||
| 32 | +* **output:** ([TemplateList](templatelist.md)) Returns a [TemplateList](templatelist.md) created by enrolling the buffer | ||
| 33 | + | ||
| 34 | + | ||
| 35 | +## [TemplateList](templatelist.md) relabel(const [TemplateList](templatelist.md) &tl, const [QString][QString] &propName, bool preserveIntegers) {: #relabel } | ||
| 36 | + | ||
| 37 | +Relabel the values associated with a given key in the [metadata](../file/members.md#m_metadata) of a provided [TemplateList](templatelist.md). The values are relabeled to be between [0, numClasses-1]. If preserveIntegers is true and the [metadata](../file/members.md#m_metadata) can be converted to integers then numClasses equals the maximum value in the values. Otherwise, numClasses equals the number of unique values. The relabeled values are stored in the "Label" field of the returned [TemplateList](templatelist.md). | ||
| 38 | + | ||
| 39 | +* **function definition:** | ||
| 40 | + | ||
| 41 | + static TemplateList relabel(const TemplateList &tl, const QString &propName, bool preserveIntegers) | ||
| 42 | + | ||
| 43 | +* **parameters:** | ||
| 44 | + | ||
| 45 | + Parameter | Type | Description | ||
| 46 | + --- | --- | --- | ||
| 47 | + tl | const [TemplateList](templatelist.md) & | [TemplateList](templatelist.md) to be relabeled | ||
| 48 | + propName | const [QString][QString] & | [Metadata](../file/members.md#m_metadata) key | ||
| 49 | + preserveIntegers | bool | If true attempt to use the [metadata](../file/members.md#m_metadata) values as the relabeled values. Otherwise use the number of unique values. | ||
| 50 | + | ||
| 51 | +* **output:** ([TemplateList](templatelist.md)) Returns a [TemplateList](templatelist.md) identical to the input [TemplateList](templatelist.md) but with the new labels appended to the [metadata](../file/members.md#m_metadata) using the "Label" key. | ||
| 52 | +* **example:** | ||
| 53 | + | ||
| 54 | + Template t1, t2, t3; | ||
| 55 | + | ||
| 56 | + t1.file.set("Class", QString("1")); | ||
| 57 | + t2.file.set("Class", QString("10")); | ||
| 58 | + t3.file.set("Class", QString("100")); | ||
| 59 | + TemplateList tList(QList<Template>() << t1 << t2 << t3); | ||
| 60 | + | ||
| 61 | + TemplateList relabeled = TemplateList::relabel(tList, "Class", true); | ||
| 62 | + relabeled.files(); // returns [[Class=1, Label=1], [Class=10, Label=10], [Class=100, Label=100]] | ||
| 63 | + | ||
| 64 | + relabeled = TemplateList::relabel(tList, "Class", false); | ||
| 65 | + relabeled.files(); // returns [[Class=1, Label=0], [Class=10, Label=1], [Class=100, Label=2]] | ||
| 66 | + | ||
| 67 | +<!-- Links --> | ||
| 68 | +[QByteArray]: http://doc.qt.io/qt-5/qbytearray.html "QByteArray" | ||
| 69 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" |
docs/docs/api_docs/cpp_api/templatelist/templatelist.md
0 → 100644
| 1 | +<!-- TEMPLATELIST --> | ||
| 2 | + | ||
| 3 | +Inherits [QList][QList]<[Template](../template/template.md)>. | ||
| 4 | + | ||
| 5 | +Convenience class for working with a list of templates. | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Constructors](constructors.md) | ||
| 10 | +* [Static Functions](statics.md) | ||
| 11 | +* [Functions](functions.md) | ||
| 12 | + | ||
| 13 | +<!-- Links --> | ||
| 14 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" |
docs/docs/api_docs/cpp_api/timevaryingtransform/constructors.md
0 → 100644
| 1 | +Constructor | Description | ||
| 2 | +--- | --- | ||
| 3 | +TimeVaryingTransform(bool independent = true, bool trainable = true) | Default constructor. Calls [Transform](../transform/transform.md) [constructor](../transform/constructors.md) with the given value of [independent](../transform/members.md#independent) and [trainable](../transform/members.md#trainable). It also initializes [timeInvariantAlias](members.md#timeinvariantalias). |
docs/docs/api_docs/cpp_api/timevaryingtransform/functions.md
0 → 100644
| 1 | +## bool timeVarying() {: #timevarying } | ||
| 2 | + | ||
| 3 | +This is a virtual function. Check if the transform is time varying. This always evaluates to true. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + virtual bool timeVarying() const | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** (bool) Returns true (the transform is always time varying) | ||
| 11 | + | ||
| 12 | +## void project(const [Template](../template/template.md) &src, [Template](../template/template.md) &dst) {: #project-1 } | ||
| 13 | + | ||
| 14 | +This is a virtual function. For [TimeVaryingTransforms](timevaryingtransform.md) normal enrollment calls [projectUpdate](#projectupdate-2). It is still possible to call this version of project instead but it must be done explicitly and is **strongly** discouraged. If this function is called [timeInvariantAlias](members.md#timeinvariantalias) is used to call [projectUpdate](#projectupdate-2) in a thread safe way. | ||
| 15 | + | ||
| 16 | +* **function definition:** | ||
| 17 | + | ||
| 18 | + virtual void project(const Template &src, Template &dst) const | ||
| 19 | + | ||
| 20 | + * **parameters:** | ||
| 21 | + | ||
| 22 | + Parameter | Type | Description | ||
| 23 | + --- | --- | --- | ||
| 24 | + src | const [Template](../template/template.md) & | The input template | ||
| 25 | + dst | [Template](../template/template.md) & | The output template | ||
| 26 | + | ||
| 27 | +* **output:** (void) | ||
| 28 | + | ||
| 29 | +## void project(const [TemplateList](../templatelist/templatelist.md) &src, [TemplateList](../templatelist/templatelist.md) &dst) {: #project-2 } | ||
| 30 | + | ||
| 31 | +This is a virtual function. For [TimeVaryingTransforms](timevaryingtransform.md) normal enrollment calls [projectUpdate](#projectupdate-2). It is still possible to call this version of project instead but it must be done explicitly and is **strongly** discouraged. If this function is called [timeInvariantAlias](members.md#timeinvariantalias) is used to call [projectUpdate](#projectupdate-2) in a thread safe way. | ||
| 32 | + | ||
| 33 | +* **function definition:** | ||
| 34 | + | ||
| 35 | + virtual void project(const TemplateList &src, TemplateList &dst) const | ||
| 36 | + | ||
| 37 | + * **parameters:** | ||
| 38 | + | ||
| 39 | + Parameter | Type | Description | ||
| 40 | + --- | --- | --- | ||
| 41 | + src | const [TemplateList](../templatelist/templatelist.md) & | The input template list | ||
| 42 | + dst | [TemplateList](../templatelist/templatelist.md) & | The output template list | ||
| 43 | + | ||
| 44 | +* **output:** (void) | ||
| 45 | + | ||
| 46 | +## void projectUpdate(const [Template](../template/template.md) &src, [Template](../template/template.md) &dst) {: #projectupdate-1 } | ||
| 47 | + | ||
| 48 | +This is a virtual function. This function should never be called because it is useless to implement a Template -> Template call using project update. An error is thrown if it is called. | ||
| 49 | + | ||
| 50 | +* **function definition:** | ||
| 51 | + | ||
| 52 | + virtual void projectUpdate(const Template &src, Template &dst) | ||
| 53 | + | ||
| 54 | +* **parameters:** | ||
| 55 | + | ||
| 56 | + Parameter | Type | Description | ||
| 57 | + --- | --- | --- | ||
| 58 | + src | const [Template](../template/template.md) & | The input template | ||
| 59 | + dst | [Template](../template/template.md) & | The output template | ||
| 60 | + | ||
| 61 | +* **output:** (void) | ||
| 62 | + | ||
| 63 | +## void projectUpdate(const [Template](../template/template.md) &src, [Template](../template/template.md) &dst) {: #projectupdate-1 } | ||
| 64 | + | ||
| 65 | +This is a virtual function. This function should never be called because it is useless to implement a Template -> Template call using project update. An error is thrown if it is called. | ||
| 66 | + | ||
| 67 | +* **function definition:** | ||
| 68 | + | ||
| 69 | + virtual void projectUpdate(const Template &src, Template &dst) | ||
| 70 | + | ||
| 71 | +* **parameters:** | ||
| 72 | + | ||
| 73 | + Parameter | Type | Description | ||
| 74 | + --- | --- | --- | ||
| 75 | + src | const [Template](../template/template.md) & | The input template | ||
| 76 | + dst | [Template](../template/template.md) & | The output template | ||
| 77 | + | ||
| 78 | +* **output:** (void) | ||
| 79 | + | ||
| 80 | +## void projectUpdate(const [Template](../template/template.md) &src, [Template](../template/template.md) &dst) {: #projectupdate-1 } | ||
| 81 | + | ||
| 82 | +This is a virtual function. This function should never be called because it is useless to implement a Template -> Template call using project update. An error is thrown if it is called. | ||
| 83 | + | ||
| 84 | +* **function definition:** | ||
| 85 | + | ||
| 86 | + virtual void projectUpdate(const Template &src, Template &dst) | ||
| 87 | + | ||
| 88 | +* **parameters:** | ||
| 89 | + | ||
| 90 | + Parameter | Type | Description | ||
| 91 | + --- | --- | --- | ||
| 92 | + src | const [Template](../template/template.md) & | The input template | ||
| 93 | + dst | [Template](../template/template.md) & | The output template | ||
| 94 | + | ||
| 95 | +* **output:** (void) | ||
| 96 | + | ||
| 97 | +## void projectUpdate(const [TemplateList](../templatelist/templatelist.md) &src, [TemplateList](../templatelist/templatelist.md) &dst) {: #projectupdate-2 } | ||
| 98 | + | ||
| 99 | +This is a virtual function. This is the non-const alternative to [project](../transform/functions.md#project-1). It allows the internal state of the transform to be update at project time. | ||
| 100 | + | ||
| 101 | +* **function definition:** | ||
| 102 | + | ||
| 103 | + virtual void projectUpdate(const TemplateList &src, TemplateList &dst) | ||
| 104 | + | ||
| 105 | +* **parameters:** | ||
| 106 | + | ||
| 107 | + Parameter | Type | Description | ||
| 108 | + --- | --- | --- | ||
| 109 | + src | const [TemplateList](../templatelist/templatelist.md) & | The input template list | ||
| 110 | + dst | [TemplateList](../templatelist/templatelist.md) & | The output template list | ||
| 111 | + | ||
| 112 | +* **output:** (void) | ||
| 113 | + | ||
| 114 | +## [Transform](../transform/transform.md) \*smartCopy(bool &newTransform) {: #smartcopy } | ||
| 115 | + | ||
| 116 | +This is a virtual function. Make a smart copy of the transform. | ||
| 117 | + | ||
| 118 | +* **function definition:** | ||
| 119 | + | ||
| 120 | + virtual Transform *smartCopy(bool &newTransform) | ||
| 121 | + | ||
| 122 | +* **parameters:** | ||
| 123 | + | ||
| 124 | + Parameter | Type | Description | ||
| 125 | + --- | --- | --- | ||
| 126 | + newTransform | bool & | True if a new, simplified, transform was allocated inside this call, false otherwise | ||
| 127 | + | ||
| 128 | +* **output:** ([Transform](../transform/transform.md) \*) Returns a copy of itself by default. newTransform is set to true in this case. |
docs/docs/api_docs/cpp_api/timevaryingtransform/members.md
0 → 100644
| 1 | +Members | Type | Description | ||
| 2 | +--- | --- | --- | ||
| 3 | +<a class="table-anchor" id="timeinvariantalias"></a> timeInvariantAlias | TimeInvariantWrapperTransform | A special case helper class that ensures usually thread safe calls like [project](../transform/functions.md#project-1) can be called non-thread safe objects. In a very simplified description, this calls [projectUpdate](functions.md#projectupdate-1) instead of [project](functions.md#project-1) |
docs/docs/api_docs/cpp_api/timevaryingtransform/timevaryingtransform.md
0 → 100644
| 1 | +Inherits [Transform](../transform/transform.md) | ||
| 2 | + | ||
| 3 | +A [Transform](../transform/transform.md) that can change state at project time. | ||
| 4 | + | ||
| 5 | +See: | ||
| 6 | + | ||
| 7 | +* [Members](members.md) | ||
| 8 | +* [Constructors](constructors.md) | ||
| 9 | +* [Functions](functions.md) | ||
| 10 | + | ||
| 11 | +TimeVaryingTransforms are [Transforms](../transform/transform.md) that need to change their state at project time. This is opposed to [Transforms](../transform/transform.md) which can only change state at train time. Common examples include video processing across multiple frames, aggregate projection statistics etc. |
docs/docs/api_docs/cpp_api/transform/constructors.md
0 → 100644
| 1 | +Constructor / Destructor | Description | ||
| 2 | +--- | --- | ||
| 3 | +Transform(bool independent = true, bool trainable = true) | Default constructor for transforms. By default [independent](members.md#independent) and [trainable](members.md#trainable) are set to true. | ||
| 4 | +~Transform() | Default Destructor, it doesn't do anything |
docs/docs/api_docs/cpp_api/transform/functions.md
0 → 100644
| 1 | +## [Transform](transform.md) \*clone() {: #clone } | ||
| 2 | + | ||
| 3 | +This is a virtual function. Make a deep copy of the transform. | ||
| 4 | + | ||
| 5 | +* **function definition:** | ||
| 6 | + | ||
| 7 | + virtual Transform *clone() const | ||
| 8 | + | ||
| 9 | +* **parameters:** NONE | ||
| 10 | +* **output:** ([Transform](transform.md)) | ||
| 11 | +* **example:** | ||
| 12 | + | ||
| 13 | + class ExampleTransform : public Transform | ||
| 14 | + { | ||
| 15 | + Q_OBJECT | ||
| 16 | + | ||
| 17 | + Q_PROPERTY(int property READ get_property WRITE set_property RESET reset_property STORED false) | ||
| 18 | + BR_PROPERTY(int, property, 1) | ||
| 19 | + | ||
| 20 | + ... | ||
| 21 | + }; | ||
| 22 | + | ||
| 23 | + Transform *transform = Transform::make("Example", NULL); | ||
| 24 | + transform->parameters(); // returns ["property = 1"] | ||
| 25 | + | ||
| 26 | + Transform *clone = transform->clone(); | ||
| 27 | + clone->parameters(); // returns ["property = 1"] | ||
| 28 | + | ||
| 29 | + transform->setProperty("property", 10); | ||
| 30 | + transform->parameters(); // returns ["property = 10"] | ||
| 31 | + clone->parameters(); // returns ["property = 1"] | ||
| 32 | + | ||
| 33 | + | ||
| 34 | +## void train(const [TemplateList](../templatelist/templatelist.md) &data) {: #train-1 } | ||
| 35 | + | ||
| 36 | +This is a virtual function. Train the transform on provided training data. This function should be overloaded for any transform that needs to be trained. [Trainable](members.md#trainable) must be set to true for this function to be called. If [independent](members.md#independent) is true a new instance of the transform will be trained for each [Mat][Mat] stored in a [Template](../template/template.md) in the provided training data. Each [Template](../template/template.md) should have the same number of [Mats][Mat]. | ||
| 37 | + | ||
| 38 | +* **function definition:** | ||
| 39 | + | ||
| 40 | + virtual void train(const TemplateList &data) | ||
| 41 | + | ||
| 42 | +* **parameters:** | ||
| 43 | + | ||
| 44 | + Parameter | Type | Description | ||
| 45 | + --- | --- | --- | ||
| 46 | + data | const [TemplateList](../templatelist/templatelist.md) & | Training data. The format of the data depends on the transform to be trained. In some cases the transform requires a "Label" field in each [Template](../template/template.md) [file's](../template/members.md#file) [metadata](../file/members.md#m_metadata) (normally these are classifiers like [SVM](../../../plugin_docs/classification.md#svmtransform)). In other cases no metadata is required and training occurs on the raw image data only. | ||
| 47 | + | ||
| 48 | +* **output:** (void) | ||
| 49 | +* **example:** | ||
| 50 | + | ||
| 51 | + // Create data for a 2-class classification problem | ||
| 52 | + Template t1("training_pic1.jpg"); | ||
| 53 | + t1.file.set("Label", 0); | ||
| 54 | + Template t2("training_pic2.jpg"); | ||
| 55 | + t2.file.set("Label", 0); | ||
| 56 | + Template t3("training_pic3.jpg"); | ||
| 57 | + t3.file.set("Label", 1); | ||
| 58 | + Template t4("training_pic4.jpg"); | ||
| 59 | + t4.file.set("Label", 1); | ||
| 60 | + | ||
| 61 | + TemplateList training_data(QList<Template>() << t1 << t2 << t3 << t4); | ||
| 62 | + | ||
| 63 | + Transform *classifier = Transform::make("DataPrep+Classifier"); | ||
| 64 | + classifier->train(training_data); // The data is projected through DataPrep, assuming it is untrainable, and then passed to the train method of Classifier | ||
| 65 | + | ||
| 66 | + | ||
| 67 | +## void train(const [QList][QList]<[TemplateList](../templatelist/templatelist.md)> &data) {: #train-2 } | ||
| 68 | + | ||
| 69 | +This is a virtual function. This version of train is meant for special-case, internal, transforms and for tranforms that require a specific number of templates at project time. If a transform requires a specific number of templates at project time it should be trained in batches that have the same number of templates. For example, if a transform requires exactly 5 templates when projecting it should get a list of [TemplateLists](../templatelist/templatelist.md), each with exactly 5 templates, at train time. Each [TemplateList](../templatelist/templatelist.md) can then be treated as an individual input to the training function. | ||
| 70 | + | ||
| 71 | +* **function definition:** | ||
| 72 | + | ||
| 73 | + virtual void train(const QList<TemplateList> &data) | ||
| 74 | + | ||
| 75 | +* **parameters:** | ||
| 76 | + | ||
| 77 | + Parameter | Type | Description | ||
| 78 | + --- | --- | --- | ||
| 79 | + data | const [QList][QList]<[TemplateList](../templatelist/templatelist.md)> & | Specially formatted list of training input. Format should match what is passed to [project](#project-2). | ||
| 80 | + | ||
| 81 | +* **output:** (void) | ||
| 82 | + | ||
| 83 | + | ||
| 84 | +## void project(const [Template](../template/template.md) &src, [Template](../template/template.md) &dst) {: #project-1 } | ||
| 85 | + | ||
| 86 | +This is a pure virtual function. It must be overloaded by all derived classes. Project a template through the transform, modifying its contents in some way and storing the modified data in **dst**. This function has a strict [Template](../template/template.md) in, [Template](../template/template.md) out model. For a multiple [Template](../template/template.md) in, multiple [Template](../template/template.md) out model see [project]{: #project-2 }. | ||
| 87 | + | ||
| 88 | +* **function definition:** | ||
| 89 | + | ||
| 90 | + virtual void project(const Template &src, Template &dst) const = 0 | ||
| 91 | + | ||
| 92 | +* **parameters:** | ||
| 93 | + | ||
| 94 | + Parameter | Type | Description | ||
| 95 | + --- | --- | --- | ||
| 96 | + src | const [Template](../template/template.md) & | Input template. It is immutable | ||
| 97 | + dst | [Template](../template/template.md) & | Output template. Should contain the modified data from the input template. | ||
| 98 | + | ||
| 99 | +* **output:** (void) | ||
| 100 | +* **example:** | ||
| 101 | + | ||
| 102 | + Template src("color_picture.jpg"), dst; | ||
| 103 | + | ||
| 104 | + Transform *color_converter = Transfrom::make("Read+Cvt(Gray)"); | ||
| 105 | + color_converter->project(src, dst); // returns a grayscale image stored in dst | ||
| 106 | + | ||
| 107 | + | ||
| 108 | +## void project(const [TemplateList](../templatelist/templatelist.md) &src, [TemplateList](../templatelist/templatelist.md) &dst) {: #project-2 } | ||
| 109 | + | ||
| 110 | +This is a virtual function. Project multiple [Templates](../template/template.md) in and get multiple, modified, [Templates](../template/template.md) out. Especially useful in cases like detection where the requirement is image in, multiple objects out. The default implementation calls [project](#project-1) on each [Template](../template/template.md) in **src** and appends the results to **dst**. | ||
| 111 | + | ||
| 112 | +* **function definition:** | ||
| 113 | + | ||
| 114 | + virtual void project(const TemplateList &src, TemplateList &dst) const | ||
| 115 | + | ||
| 116 | +* **parameters:** | ||
| 117 | + | ||
| 118 | + Parameter | Type | Description | ||
| 119 | + --- | --- | --- | ||
| 120 | + src | const [TemplateList](../templatelist/templatelist.md) & | Input templates. It is immutable | ||
| 121 | + dst | [TemplateList](../templatelist/templatelist.md) & | Output templates. Should contain the modified data from the input templates | ||
| 122 | + | ||
| 123 | +* **output:** (void) | ||
| 124 | +* **example:** | ||
| 125 | + | ||
| 126 | + TemplateList src(QList<Template>() << Template("image_with_faces.jpg")), dst; | ||
| 127 | + | ||
| 128 | + Transform *face_detector = Transform::make("FaceDetector"); | ||
| 129 | + face_detector->project(src, dst); // dst will have one template for every face detected in src | ||
| 130 | + | ||
| 131 | + | ||
| 132 | +## void projectUpdate(const [Template](../template/template.md) &src, [Template](../template/template.md) &dst) {: #projectupdate-1 } | ||
| 133 | + | ||
| 134 | +This is a virtual function. Very similar to [project](#project-1) except this version is not **const** and can modify the internal state of the transform. | ||
| 135 | + | ||
| 136 | +* **function definition:** | ||
| 137 | + | ||
| 138 | + virtual void projectUpdate(const Template &src, Template &dst) | ||
| 139 | + | ||
| 140 | +* **parameters:** | ||
| 141 | + | ||
| 142 | + Parameter | Type | Description | ||
| 143 | + --- | --- | --- | ||
| 144 | + src | const [Template](../template/template.md) & | Input template. It is immutable | ||
| 145 | + dst | [Template](../template/template.md) & | Output template. Should contain the modified data from the input template. | ||
| 146 | + | ||
| 147 | +* **output:** (void) | ||
| 148 | +* **example:** | ||
| 149 | + | ||
| 150 | + class ExampleTransform : public Transform | ||
| 151 | + { | ||
| 152 | + Q_OBJECT | ||
| 153 | + | ||
| 154 | + int internalState; | ||
| 155 | + | ||
| 156 | + void projectUpdate(const Template &src, Template &dst) | ||
| 157 | + { | ||
| 158 | + dst = src; | ||
| 159 | + internalState++; | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + ... | ||
| 163 | + }; | ||
| 164 | + | ||
| 165 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 166 | + | ||
| 167 | + Template src("picture.jpg"), dst; | ||
| 168 | + | ||
| 169 | + Transform *example = Transform::make("Example"); | ||
| 170 | + example->projectUpdate(src, dst); // dst is unchanged but Example's internalState has been incremented. | ||
| 171 | + | ||
| 172 | + | ||
| 173 | +## void projectUpdate(const [TemplateList](../templatelist/templatelist.md) &src, [TemplateList](../templatelist/templatelist.md) &dst) {: #projectupdate-2 } | ||
| 174 | + | ||
| 175 | +This is a virtual function. Very similar to [project](#project-2) except this version is not **const** and can modify the internal state of the transform. | ||
| 176 | + | ||
| 177 | +* **function definition:** | ||
| 178 | + | ||
| 179 | + virtual void projectUpdate(const TemplateList &src, TemplateList &dst) | ||
| 180 | + | ||
| 181 | +* **parameters:** | ||
| 182 | + | ||
| 183 | + Parameter | Type | Description | ||
| 184 | + --- | --- | --- | ||
| 185 | + src | const [TemplateList](../templatelist/templatelist.md) & | Input templates. It is immutable | ||
| 186 | + dst | [TemplateList](../templatelist/templatelist.md) & | Output templates. Should contain the modified data from the input templates | ||
| 187 | + | ||
| 188 | +* **output:** (void) | ||
| 189 | +* **example:** | ||
| 190 | + | ||
| 191 | + class ExampleTransform : public Transform | ||
| 192 | + { | ||
| 193 | + Q_OBJECT | ||
| 194 | + | ||
| 195 | + int internalState; | ||
| 196 | + | ||
| 197 | + void projectUpdate(const TemplateList &src, TemplateList &dst) | ||
| 198 | + { | ||
| 199 | + dst = src; | ||
| 200 | + internalState++; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + ... | ||
| 204 | + }; | ||
| 205 | + | ||
| 206 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 207 | + | ||
| 208 | + TemplateList src(QList<Template>() << Template("picture.jpg")), dst; | ||
| 209 | + | ||
| 210 | + Transform *example = Transform::make("Example"); | ||
| 211 | + example->projectUpdate(src, dst); // dst is unchanged but Example's internalState has been incremented. | ||
| 212 | + | ||
| 213 | + | ||
| 214 | +## void projectUpdate([Template](../template/template.md) &srcdst) {: #projectupdate-3 } | ||
| 215 | + | ||
| 216 | +In-place version of [projectUpdate](#projectupdate-1). | ||
| 217 | + | ||
| 218 | +* **function definition:** | ||
| 219 | + | ||
| 220 | + void projectUpdate(Template &srcdst) | ||
| 221 | + | ||
| 222 | +* **parameters:** | ||
| 223 | + | ||
| 224 | + Parameter | Type | Description | ||
| 225 | + --- | --- | --- | ||
| 226 | + srcdst | [Template](../template/template.md) & | Input and output template. It is overwritten with the output value after projecting | ||
| 227 | + | ||
| 228 | +* **output:** (void) | ||
| 229 | +* **example:** | ||
| 230 | + | ||
| 231 | + class ExampleTransform : public Transform | ||
| 232 | + { | ||
| 233 | + Q_OBJECT | ||
| 234 | + | ||
| 235 | + int internalState; | ||
| 236 | + | ||
| 237 | + void projectUpdate(const Template &src, Template &dst) | ||
| 238 | + { | ||
| 239 | + dst = src; | ||
| 240 | + internalState++; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + ... | ||
| 244 | + }; | ||
| 245 | + | ||
| 246 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 247 | + | ||
| 248 | + Template src("picture.jpg"); | ||
| 249 | + | ||
| 250 | + Transform *example = Transform::make("Example"); | ||
| 251 | + example->projectUpdate(src); // src is modified in-place and Example's internalState has been incremented. | ||
| 252 | + | ||
| 253 | + | ||
| 254 | +## void projectUpdate([TemplateList](../templatelist/templatelist.md) &srcdst) {: #projectupdate-4 } | ||
| 255 | + | ||
| 256 | +In-place version of [projectUpdate](#projectupdate-2). | ||
| 257 | + | ||
| 258 | +* **function definition:** | ||
| 259 | + | ||
| 260 | + void projectUpdate(TemplateList &srcdst) | ||
| 261 | + | ||
| 262 | +* **parameters:** | ||
| 263 | + | ||
| 264 | + Parameter | Type | Description | ||
| 265 | + --- | --- | --- | ||
| 266 | + srcdst | [TemplateList](../templatelist/templatelist.md) & | Input and output templates. It is overwritten with the output value after projecting | ||
| 267 | + | ||
| 268 | +* **output:** (void) | ||
| 269 | +* **example:** | ||
| 270 | + | ||
| 271 | + class ExampleTransform : public Transform | ||
| 272 | + { | ||
| 273 | + Q_OBJECT | ||
| 274 | + | ||
| 275 | + int internalState; | ||
| 276 | + | ||
| 277 | + void projectUpdate(const TemplateList &src, TemplateList &dst) | ||
| 278 | + { | ||
| 279 | + dst = src; | ||
| 280 | + internalState++; | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + ... | ||
| 284 | + }; | ||
| 285 | + | ||
| 286 | + BR_REGISTER(Transform, ExampleTransform) | ||
| 287 | + | ||
| 288 | + TemplateList src(QList<Template>() << Template("picture.jpg")); | ||
| 289 | + | ||
| 290 | + Transform *example = Transform::make("Example"); | ||
| 291 | + example->projectUpdate(src); // src is modified in-place and Example's internalState has been incremented. | ||
| 292 | + | ||
| 293 | + | ||
| 294 | +## bool timeVarying() {: #timevarying } | ||
| 295 | + | ||
| 296 | +This is a virtual function. Check if the transform is time varying. Time varying means the internal state of the transform needs to be updated during projection. Time varying transforms should overload this function to return true and implement [projectUpdate](#projectupdate-1) instead of [project](#project-1). | ||
| 297 | + | ||
| 298 | +* **function definition:** | ||
| 299 | + | ||
| 300 | + virtual bool timeVarying() const | ||
| 301 | + | ||
| 302 | +* **parameters:** NONE | ||
| 303 | +* **output:** (bool) Returns true if the transform is time varying and false otherwise | ||
| 304 | + | ||
| 305 | + | ||
| 306 | +## [Template](../template/template.md) operator()(const [Template](../template/template.md) &src) {: #operator-pp-1 } | ||
| 307 | + | ||
| 308 | +A convenience function to call [project](#project-1) | ||
| 309 | + | ||
| 310 | +* **function definition:** | ||
| 311 | + | ||
| 312 | + inline Template operator()(const Template &src) const | ||
| 313 | + | ||
| 314 | +* **parameters:** | ||
| 315 | + | ||
| 316 | + Parameter | Type | Description | ||
| 317 | + --- | --- | --- | ||
| 318 | + src | const [Template](../template/template.md) & | Input template. It is immutable. | ||
| 319 | + | ||
| 320 | +* **output**: ([Template](../template/template.md)) Returns the result of calling [project](#project-1) | ||
| 321 | +* **example:** | ||
| 322 | + | ||
| 323 | + Template src("color_picture.jpg"); | ||
| 324 | + | ||
| 325 | + Transform *color_converter = Transfrom::make("Read+Cvt(Gray)"); | ||
| 326 | + Template dst = color_converter(src); // returns a grayscale image | ||
| 327 | + | ||
| 328 | + | ||
| 329 | +## [TemplateList](../templatelist/templatelist.md) operator()(const [TemplateList](../templatelist/templatelist.md) &src) {: #operator-pp-2 } | ||
| 330 | + | ||
| 331 | +A convenience function to call [project](#project-2) | ||
| 332 | + | ||
| 333 | +* **function definition:** | ||
| 334 | + | ||
| 335 | + inline TemplateList operator()(const TemplateList &src) const | ||
| 336 | + | ||
| 337 | +* **parameters:** | ||
| 338 | + | ||
| 339 | + Parameter | Type | Description | ||
| 340 | + --- | --- | --- | ||
| 341 | + src | const [TemplateList](../templatelist/templatelist.md) & | Input templates. It is immutable. | ||
| 342 | + | ||
| 343 | +* **output**: ([TemplateList](../templatelist/templatelist.md)) Returns the result of calling [project](#project-2) | ||
| 344 | +* **example:** | ||
| 345 | + | ||
| 346 | + TemplateList src(QList<Template>() << Template("color_picture.jpg")); | ||
| 347 | + | ||
| 348 | + Transform *color_converter = Transfrom::make("Read+Cvt(Gray)"); | ||
| 349 | + TemplateList dst = color_converter(src); // returns a list of grayscale images | ||
| 350 | + | ||
| 351 | + | ||
| 352 | +## [Transform](transform.md) \*smartCopy(bool &newTransform) {: #smartcopy-1 } | ||
| 353 | + | ||
| 354 | +This is a virtual function. Only [TimeVaryingTransforms](../timevaryingtransform/timevaryingtransform.md) need to overload this method. Similar to [clone](#clone), this function returns a deep copy of the transform. Unlike [clone](#clone), which copies everything, this function should copy the minimum amount required so that [projectUpdate](#projectupdate-1) can be called safely on the original instance and the copy returned by this function concurrently. | ||
| 355 | + | ||
| 356 | +* **function definition:** | ||
| 357 | + | ||
| 358 | + virtual Transform *smartCopy(bool &newTransform) | ||
| 359 | + | ||
| 360 | +* **parameters:** | ||
| 361 | + | ||
| 362 | + Parameter | Type | Description | ||
| 363 | + --- | --- | --- | ||
| 364 | + newTransform | bool & | True if the returned transform is newly allocated, false otherwise. This is used to handle deallocation. If newTransform is true, the caller of this function is responsible for deallocating it. If not, a [QSharedPointer][QSharedPointer] can wrap the output, and it will be deallocated elsewhere. | ||
| 365 | + | ||
| 366 | +* **output:** ([Transform](transform.md) \*) Returns a pointer to a deep, smart, copy of the transform | ||
| 367 | + | ||
| 368 | + | ||
| 369 | +## [Transform](transform.md) \*smartCopy() {: #smartcopy-2 } | ||
| 370 | + | ||
| 371 | +Convenience function to call [smartCopy](#smartcopy-1) without arguments | ||
| 372 | + | ||
| 373 | +* **function definition:** | ||
| 374 | + | ||
| 375 | + virtual Transform *smartCopy() | ||
| 376 | + | ||
| 377 | +* **parameters:** NONE | ||
| 378 | +* **output:** ([Transform](transform.md) \*) Returns a pointer, to a deep, smart, copy of the transform | ||
| 379 | + | ||
| 380 | + | ||
| 381 | +## [Transform](transform.md) \*simplify(bool &newTransform) {: #simplify } | ||
| 382 | + | ||
| 383 | +This is a virtual function. Get a simplified version of the transform for use at project time. The simplified version of the [Transform](transform.md) does not include any [Transforms](transform.md) that are only active at train time. It also removes any [LoadStore](../../../plugin_docs/core.md#loadstoretransform) transforms and keeps only their children. Transforms that only are active at train time (see [DownsampleTrainingTransform](../../../plugin_docs/core.md#downsampletrainingtransform) as an example) should overload this function and return their children if they have any or NULL if they do not. | ||
| 384 | + | ||
| 385 | +* **function definition:** | ||
| 386 | + | ||
| 387 | + virtual Transform * simplify(bool &newTransform) | ||
| 388 | + | ||
| 389 | +* **parameters:** | ||
| 390 | + | ||
| 391 | + Parameter | Type | Description | ||
| 392 | + --- | --- | --- | ||
| 393 | + newTransform | bool & | True if the simplified transform is newly allocated, false otherwise. If true, the caller of this function is responsible for deallocating the transform. | ||
| 394 | + | ||
| 395 | +* **output:** ([Transform](transform.md) \*) Returns a pointer to the simplified version of the transform | ||
| 396 | +* **example:** | ||
| 397 | + | ||
| 398 | + Transform *transform = Transform::make("DataProcessing+DownsampleTraining(Example)+<ModelFile>"); | ||
| 399 | + transfrom->description(); // returns "DataProcessing+DownsampleTraining(Example)+LoadStore(transformString=TransformFromModelFile)" | ||
| 400 | + | ||
| 401 | + bool newTransform; | ||
| 402 | + transform->simplify(newTransform)->description(); // returns "DataProcessing+Example+TransformFromModelFile" | ||
| 403 | + | ||
| 404 | + | ||
| 405 | +## [Transform](transform.md) \*make(const [QString][QString] &description) {: #make } | ||
| 406 | + | ||
| 407 | +This is a protected function. Makes a child transform from a provided description by calling [make](statics.md#make) with parent = <tt>this</tt>. | ||
| 408 | + | ||
| 409 | +* **function definition:** | ||
| 410 | + | ||
| 411 | + inline Transform *make(const QString &description) | ||
| 412 | + | ||
| 413 | +* **parameters:** | ||
| 414 | + | ||
| 415 | + Parameter | Type | Description | ||
| 416 | + --- | --- | --- | ||
| 417 | + description | const [QString][QString] & | Description of the child transform | ||
| 418 | + | ||
| 419 | +* **output:** ([Transform](transform.md) \*) Returns a pointer to the created child transform | ||
| 420 | + | ||
| 421 | +<!-- Links --> | ||
| 422 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" | ||
| 423 | +[QList]: http://doc.qt.io/qt-5/QList.html "QList" | ||
| 424 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 425 | +[QSharedPointer]: http://doc.qt.io/qt-5/qsharedpointer.html "QSharedPointer" |
docs/docs/api_docs/cpp_api/transform/members.md
0 → 100644
| 1 | +Member | Type | Description | ||
| 2 | +--- | --- | --- | ||
| 3 | +<a class="table-anchor" id=independent></a>independent | bool | True if the transform is independent, false otherwise. Independent transforms process each [Mat][Mat] in a [Template](../template/template.md) independently. This means that a new instance of the transform is created for each [Mat][Mat]. If the transform is [trainable](#trainable) and the training data has more then one [Mat][Mat] per template, each created instance of the transform is trained separately. Please see [Training Algorithms](../../../tutorials.md#training-algorithms) for more details. | ||
| 4 | +<a class="table-anchor" id=trainable></a>trainable | bool | True if the transform is trainable, false otherwise. Trainable transforms need to overload the [train](functions.md#train-1) function. | ||
| 5 | + | ||
| 6 | +<!-- Links --> | ||
| 7 | +[Mat]: http://docs.opencv.org/modules/core/doc/basic_structures.html#mat "Mat" |
docs/docs/api_docs/cpp_api/transform/statics.md
0 → 100644
| 1 | +## [Transform](transform.md) \*make([QString][QString] str, [QObject][QObject] \*parent) {: #make } | ||
| 2 | + | ||
| 3 | +Make a transform from a string. This function converts the abbreviation characters **+**, **/**, **{}**, **<\>**, and **()** into their full-length alternatives. | ||
| 4 | + | ||
| 5 | +Abbreviation | Translation | ||
| 6 | +--- | --- | ||
| 7 | +\+ | [PipeTransform](../../../plugin_docs/core.md#pipetransform). Each [Transform](transform.md) linked by a **+** is turned into a child of a single [PipeTransform](../../../plugin_docs/core.md#pipetransform). "Example1+Example2" becomes "Pipe([Example1,Example2])". [Templates](../template/template.md) are projected through the children of a pipe in series, the output of one become the input of the next. | ||
| 8 | +/ | [ForkTransform](../../../plugin_docs/core.md#forktransform). Each [Transform](transform.md) linked by a **/** is turned into a child of a single [ForkTransform](../../../plugin_docs/core.md#forktransform). "Example1/Example2" becomes "Fork([Example1,Example2])". [Templates](../template/template.md) are projected the children of a fork in parallel, each receives the same input and the outputs are merged together. | ||
| 9 | +\{\} | [CacheTransform](../../../plugin_docs/core.md#cachetransform). Can only surround a single [Transform](transform.md). "{Example}" becomes "Cache(Example)". The results of a cached [Transform](transform.md) are stored in a global cache using the [file](../object/members.md#file) name as a key. | ||
| 10 | +<> | [LoadStoreTransform](../../../plugin_docs/core.md#loadstoretransform). Can only surround a single [Transform](transform.md). "<Example>" becomes "LoadStore(Example)". Serialize and store a [Transform](transform.md) after training or deserialize and load a [Transform](transform.md) before projecting. | ||
| 11 | +() | Order of operations. Change the order of operations using parantheses. | ||
| 12 | + | ||
| 13 | +The parsed string is then passed to [Factory](../factory/factory.md)::[make](../factory/statics.md#make) to be turned into a transform. | ||
| 14 | + | ||
| 15 | +* **function definition:** | ||
| 16 | + | ||
| 17 | + static Transform *make(QString str, QObject *parent) | ||
| 18 | + | ||
| 19 | +* **parameters:** | ||
| 20 | + | ||
| 21 | + Parameter | Type | Description | ||
| 22 | + --- | --- | --- | ||
| 23 | + str | [QString][QString] | String describing the transform | ||
| 24 | + parent | [QObject][QObject] \* | Parent of the object to be created | ||
| 25 | + | ||
| 26 | +* **output:** ([Transform](transform.md) \*) Returns a pointer to the [Transform](transform.md) described by the string | ||
| 27 | +* **see:** [Factory::make](../factory/statics.md#make) | ||
| 28 | +* **example:** | ||
| 29 | + | ||
| 30 | + Transform::make("Example1+Example2+<ModelFile>")->description(); // returns "Pipe(transforms=[Example1,Example2,LoadStore(ModelFile)])". | ||
| 31 | + | ||
| 32 | + | ||
| 33 | +## [QSharedPointer][QSharedPointer]<[Transform](transform.md)> fromAlgorithm(const [QString][QString] &algorithm, bool preprocess=false) {: #fromalgorithm } | ||
| 34 | + | ||
| 35 | +Create a [Transform](transform.md) from an OpenBR algorithm string. The [Transform](transform.md) is created using everything to the left of a **:** or a **!** in the string. | ||
| 36 | + | ||
| 37 | +* **function definition:** | ||
| 38 | + | ||
| 39 | + static QSharedPointer<Transform> fromAlgorithm(const QString &algorithm, bool preprocess=false) | ||
| 40 | + | ||
| 41 | +* **parameters:** | ||
| 42 | + | ||
| 43 | + Parameter | Type | Description | ||
| 44 | + --- | --- | --- | ||
| 45 | + algorithm | const [QString][QString] & | Algorithm string to construct the [Transform](transform.md) from | ||
| 46 | + preprocess | bool | (Optional) If true add a [StreamTransform](../../../plugin_docs/core.md#streamtransform) as the parent of the constructed [Transform](transform.md). Default is false. | ||
| 47 | + | ||
| 48 | +* **output:** ([QSharedPointer][QSharedPointer]<[Transform](transform.md)>) Returns a pointer to the [Transform](transform.md) described by the algorithm. | ||
| 49 | +* **example:** | ||
| 50 | + | ||
| 51 | + Transform::fromAlgorithm("EnrollmentTransform:Distance")->decription(); // returns "EnrollmentTransform" | ||
| 52 | + Transform::fromAlgorithm("EnrollmentTransform!DistanceTransform")->decription(); // returns "EnrollmentTransform" | ||
| 53 | + Transform::fromAlgorithm("EnrollmentTransform")->decription(); // returns "EnrollmentTransform" | ||
| 54 | + | ||
| 55 | +## [QSharedPointer][QSharedPointer]<[Transform](transform.md)> fromComparison(const [QString][QString] &algorithm) {: #fromcomparison } | ||
| 56 | + | ||
| 57 | +Create a[Transform](transform.md) from an OpenBR algorithm string. The [Transform](transform.md) is created using everything to the right of a **:** or a **!** in the string. If the separating symbol is a **:** the string to the right describes a distance. It is converted to a [GalleryCompareTransform](../../../plugin_docs/core.md#gallerycomparetransform) with the distance stored as a property. If the separating symbol is a **!** the string already describes a transform and is unchanged. | ||
| 58 | + | ||
| 59 | +* **function definition:** | ||
| 60 | + | ||
| 61 | + static QSharedPointer<Transform> fromComparison(const QString &algorithm) | ||
| 62 | + | ||
| 63 | +* **parameters:** | ||
| 64 | + | ||
| 65 | + Parameter | Type | Description | ||
| 66 | + --- | --- | --- | ||
| 67 | + algorithm | const [QString][QString] & | Algorithm string to construct the [Transform](transform.md) from | ||
| 68 | + | ||
| 69 | +* **output:** ([QSharedPointer][QSharedPointer]<[Transform](transform.md)>) Returns a pointer to the [Transform](transform.md) described by the algorithm. | ||
| 70 | +* **example:** | ||
| 71 | + | ||
| 72 | + Transform::fromAlgorithm("EnrollmentTransform:Distance")->description(); // returns "GalleryCompare(distance=Distance)"" | ||
| 73 | + Transform::fromAlgorithm("EnrollmentTransform!DistanceTransform"); // returns "DistanceTransform" | ||
| 74 | + | ||
| 75 | + | ||
| 76 | +## [Transform](transform.md) \*deserialize([QDataStream][QDataStream] &stream) {: #deserialize } | ||
| 77 | + | ||
| 78 | +Deserialize a [Transform](transform.md) from a stream. | ||
| 79 | + | ||
| 80 | +* **function definition:** | ||
| 81 | + | ||
| 82 | + static Transform *deserialize(QDataStream &stream) | ||
| 83 | + | ||
| 84 | +* **parameters:** | ||
| 85 | + | ||
| 86 | + Parameter | Type | Description | ||
| 87 | + --- | --- | --- | ||
| 88 | + stream | [QDataStream][QDataStream] & | Stream containing the serialized transform | ||
| 89 | + | ||
| 90 | +* **output:** ([Transform](transform.md) \*) Returns the deserialized transform | ||
| 91 | + | ||
| 92 | + | ||
| 93 | +## [Template](../template/template.md) &operator>>([Template](../template/template.md) &srcdst, const [Transform](transform.md) &f) {: #template-operater-gtgt-1 } | ||
| 94 | + | ||
| 95 | +Convenience function for [project](functions.md#project-1) | ||
| 96 | + | ||
| 97 | +* **function definition:** | ||
| 98 | + | ||
| 99 | + inline Template &operator>>(Template &srcdst, const Transform &f) | ||
| 100 | + | ||
| 101 | +* **parameters:** | ||
| 102 | + | ||
| 103 | + Parameter | Type | Description | ||
| 104 | + --- | --- | --- | ||
| 105 | + srcdst | [Template](../template/template.md) & | Input template. Will be overwritten with the output following call to [project](functions.md#project-1) | ||
| 106 | + f | const [Transform](transform.md) & | [Transform](transform.md) to project through. | ||
| 107 | + | ||
| 108 | +* **output:** ([Template](../template/template.md) &) Returns the output of f::[project](functions.md#project-1) | ||
| 109 | +* **example:** | ||
| 110 | + | ||
| 111 | + Template t("picture1.jpg"); | ||
| 112 | + Transform *transform = Transform::make("Example", NULL); | ||
| 113 | + | ||
| 114 | + t >> *transform; // projects t through Example. t is overwritten with the output of the project call | ||
| 115 | + | ||
| 116 | +<!--no italics* --> | ||
| 117 | + | ||
| 118 | +## [TemplateList](../templatelist/templatelist.md) &operator>>([TemplateList](../templatelist/templatelist.md) &srcdst, const [Transform](transform.md) &f) {: #template-operater-gtgt-2 } | ||
| 119 | + | ||
| 120 | +Convenience function for [project](functions.md#project-2) | ||
| 121 | + | ||
| 122 | +* **function definition:** | ||
| 123 | + | ||
| 124 | + inline TemplateList &operator>>(TemplateList &srcdst, const Transform &f) | ||
| 125 | + | ||
| 126 | +* **parameters:** | ||
| 127 | + | ||
| 128 | + Parameter | Type | Description | ||
| 129 | + --- | --- | --- | ||
| 130 | + srcdst | [TemplateList](../templatelist/templatelist.md) & | Input templates. Will be overwritten with the output following call to [project](functions.md#project-2) | ||
| 131 | + f | const [Transform](transform.md) & | [Transform](transform.md) to project through. | ||
| 132 | + | ||
| 133 | +* **output:** ([TemplateList](../templatelist/templatelist.md) &) Returns the output of f::[project](functions.md#project-2) | ||
| 134 | +* **example:** | ||
| 135 | + | ||
| 136 | + TemplateList tList(QList<Template>() << Template("picture1.jpg")); | ||
| 137 | + Transform *transform = Transform::make("Example", NULL); | ||
| 138 | + | ||
| 139 | + tList >> *transform; // projects tList through Example. tList is overwritten with the output of the project call | ||
| 140 | + | ||
| 141 | +<!--no italics* --> | ||
| 142 | + | ||
| 143 | +## [QDataStream][QDataStream] &operator<<([QDataStream][QDataStream] &stream, const [Transform](transform.md) &f) {: #stream-operator-ltlt} | ||
| 144 | + | ||
| 145 | +Convenience function for [store](../object/functions.md#store) | ||
| 146 | + | ||
| 147 | +* **function definition:** | ||
| 148 | + | ||
| 149 | + inline QDataStream &operator<<(QDataStream &stream, const Transform &f) | ||
| 150 | + | ||
| 151 | +* **parameters:** | ||
| 152 | + | ||
| 153 | + Parameter | Type | Description | ||
| 154 | + --- | --- | --- | ||
| 155 | + stream | [QDataStream][QDataStream] & | Stream to store the transform in | ||
| 156 | + f | const [Transform](transform.md) & | Transform to be stored | ||
| 157 | + | ||
| 158 | +* **output:** ([QDataStream][QDataStream] &) Returns the stream with the transform stored in it | ||
| 159 | +* **example:** | ||
| 160 | + | ||
| 161 | + Transform *transform = Transform::make("Example(property1=value1,property2=value2)"); | ||
| 162 | + | ||
| 163 | + QDataStream stream; | ||
| 164 | + stream << *transform; // stores "Example(property1=value1,property2=value2)" in the stream | ||
| 165 | + | ||
| 166 | +<!--no italics* --> | ||
| 167 | + | ||
| 168 | +## [QDataStream][QDataStream] &operator>>([QDataStream][QDataStream] &stream, const [Transform](transform.md) &f) {: #stream-operator-gtgt} | ||
| 169 | + | ||
| 170 | +Convenience function for [load](../object/functions.md#load) | ||
| 171 | + | ||
| 172 | +* **function definition:** | ||
| 173 | + | ||
| 174 | + inline QDataStream &operator>>(QDataStream &stream, const Transform &f) | ||
| 175 | + | ||
| 176 | +* **parameters:** | ||
| 177 | + | ||
| 178 | + Parameter | Type | Description | ||
| 179 | + --- | --- | --- | ||
| 180 | + stream | [QDataStream][QDataStream] & | Stream to load the transform from | ||
| 181 | + f | const [Transform](transform.md) & | Transform to store loaded information | ||
| 182 | + | ||
| 183 | +* **output:** ([QDataStream][QDataStream] &) Returns the stream without the transform data | ||
| 184 | +* **example:** | ||
| 185 | + | ||
| 186 | + Transform *in = Transform::make("Example(property1=value1,property2=value2)"); | ||
| 187 | + | ||
| 188 | + QDataStream stream; | ||
| 189 | + stream << *in; // stores "Example(property1=value1,property2=value2)" in the stream | ||
| 190 | + | ||
| 191 | + Transform out; | ||
| 192 | + stream >> out; | ||
| 193 | + out->description(); // returns "Example(property1=value1,property2=value2)" | ||
| 194 | + | ||
| 195 | +<!-- Links --> | ||
| 196 | +[QString]: http://doc.qt.io/qt-5/QString.html "QString" | ||
| 197 | +[QObject]: http://doc.qt.io/qt-5/QObject.html "QObject" | ||
| 198 | +[QSharedPointer]: http://doc.qt.io/qt-5/qsharedpointer.html "QSharedPointer" | ||
| 199 | +[QDataStream]: http://doc.qt.io/qt-5/qdatastream.html "QDataStream" |
docs/docs/api_docs/cpp_api/transform/transform.md
0 → 100644
| 1 | +<!-- TRANSFORM --> | ||
| 2 | + | ||
| 3 | +Inherits [Object](../object/object.md) | ||
| 4 | + | ||
| 5 | +Plugin base class for processing a template. | ||
| 6 | + | ||
| 7 | +See: | ||
| 8 | + | ||
| 9 | +* [Members](members.md) | ||
| 10 | +* [Constructors](constructors.md) | ||
| 11 | +* [Static Functions](statics.md) | ||
| 12 | +* [Functions](functions.md) | ||
| 13 | + | ||
| 14 | +Transforms support the idea of *training* and *projecting*, whereby they are (optionally) given example images and are expected learn how to transform new instances into an alternative, hopefully more useful, basis for the recognition task at hand. Transforms can be chained together to support the declaration and use of arbitrary algorithms at run time. |