Commit 9aefd2ddce4df867f250eb88a1a1d63df0682282
Merge branch 'master' of https://github.com/biometrics/openbr
Showing
3 changed files
with
15 additions
and
0 deletions
.gitignore
docs/docs/api_docs/python_api.md
| @@ -46,6 +46,14 @@ The Python API is a light wrapper of the C API. It creates an object that has [a | @@ -46,6 +46,14 @@ The Python API is a light wrapper of the C API. It creates an object that has [a | ||
| 46 | br.br_free_template_list(query) | 46 | br.br_free_template_list(query) |
| 47 | br.br_finalize() | 47 | br.br_finalize() |
| 48 | 48 | ||
| 49 | +Some functions were made more pythonic and thus differ slightly from the C API. In particular, the C functions that populate a string buffer have that logic abstracted away. For example, `br_get_filename(char * buffer, int buffer_length, br_template tmpl)` in C becomes `filename = br.br_get_filename(tmpl)` in Python. Here are the functions that differ from the C API: | ||
| 50 | + | ||
| 51 | +- br_most_recent_message | ||
| 52 | +- br_objects | ||
| 53 | +- br_scratch_path | ||
| 54 | +- br_get_filename | ||
| 55 | +- br_get_metadata_string | ||
| 56 | + | ||
| 49 | To enable the module, add `-DBR_INSTALL_BRPY=ON` to your cmake command (or use the ccmake GUI - highly recommended). | 57 | To enable the module, add `-DBR_INSTALL_BRPY=ON` to your cmake command (or use the ccmake GUI - highly recommended). |
| 50 | 58 | ||
| 51 | Currently only OS X and Linux are supported. | 59 | Currently only OS X and Linux are supported. |
scripts/brpy/__init__.py
| @@ -53,6 +53,10 @@ def _handle_string_func(func, *moretypes): | @@ -53,6 +53,10 @@ def _handle_string_func(func, *moretypes): | ||
| 53 | return msg | 53 | return msg |
| 54 | return call_func | 54 | return call_func |
| 55 | 55 | ||
| 56 | +# TODO: small wrapper around any objects that need br_free_* | ||
| 57 | +# so when python object dies, user doesn't need to call br_free_* | ||
| 58 | +# TODO: iterator for templatelist object | ||
| 59 | +# (or mimic C++ obj API via C? overkill?) | ||
| 56 | def init_brpy(br_loc='/usr/local/lib'): | 60 | def init_brpy(br_loc='/usr/local/lib'): |
| 57 | """Initializes all function inputs and outputs for the br ctypes lib object""" | 61 | """Initializes all function inputs and outputs for the br ctypes lib object""" |
| 58 | 62 |