From 19591595daf3888b71389bbb40c341c1944db4c9 Mon Sep 17 00:00:00 2001 From: Austin Blanton Date: Thu, 14 May 2015 12:34:05 -0400 Subject: [PATCH] Add Python wrapper doc --- docs/docs/api_docs/python_api.md | 22 ++++++++++++++++++++++ docs/mkdocs.yml | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 docs/docs/api_docs/python_api.md diff --git a/docs/docs/api_docs/python_api.md b/docs/docs/api_docs/python_api.md new file mode 100644 index 0000000..ca10d19 --- /dev/null +++ b/docs/docs/api_docs/python_api.md @@ -0,0 +1,22 @@ +# Python API + +The Python API is a light wrapper of the C API. It creates an object that has [all the C functions](c_api/functions.md): + + from brpy import init_brpy + # br_loc is /usr/local/lib by default, + # you may change this by passing a different path to the shared objects + br = init_brpy(br_loc='/path/to/libopenbr') + br.br_initialize_default() + img = open('catpic.jpg','rb').read() + br.br_set_property('algorithm','MyCatFaceDetectionModel') + br.br_set_property('enrollAll','true') + tmpl = br.br_load_img(img, len(img)) + catfaces = br.br_enroll_template(tmpl) + print('This pic has %i cats in it!' % br.br_num_templates(catfaces)) + br.br_free_template(tmpl) + br.br_free_template_list(catfaces) + br.br_finalize() + +To enable the module, add `-DBR_INSTALL_BRPY=ON` to your cmake command (or use the ccmake GUI - highly recommended). + +Currently only OS X and Linux are supported. diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 7e3f4e5..b84a503 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -25,7 +25,7 @@ pages: - [api_docs/c_api.md, API Docs, C API] - [api_docs/c_api/typedefs.md, C API, Typedefs] - [api_docs/c_api/functions.md, C API, Functions] - +- [api_docs/python_api.md, API Docs, Python wrapper API] - [api_docs/cpp_api.md, API Docs, C++ Plugin API] # API Functions -- libgit2 0.21.4