Commit 19591595daf3888b71389bbb40c341c1944db4c9

Authored by Austin Blanton
1 parent 3c0f9d7f

Add Python wrapper doc

docs/docs/api_docs/python_api.md 0 → 100644
  1 +# Python API
  2 +
  3 +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):
  4 +
  5 + from brpy import init_brpy
  6 + # br_loc is /usr/local/lib by default,
  7 + # you may change this by passing a different path to the shared objects
  8 + br = init_brpy(br_loc='/path/to/libopenbr')
  9 + br.br_initialize_default()
  10 + img = open('catpic.jpg','rb').read()
  11 + br.br_set_property('algorithm','MyCatFaceDetectionModel')
  12 + br.br_set_property('enrollAll','true')
  13 + tmpl = br.br_load_img(img, len(img))
  14 + catfaces = br.br_enroll_template(tmpl)
  15 + print('This pic has %i cats in it!' % br.br_num_templates(catfaces))
  16 + br.br_free_template(tmpl)
  17 + br.br_free_template_list(catfaces)
  18 + br.br_finalize()
  19 +
  20 +To enable the module, add `-DBR_INSTALL_BRPY=ON` to your cmake command (or use the ccmake GUI - highly recommended).
  21 +
  22 +Currently only OS X and Linux are supported.
docs/mkdocs.yml
@@ -25,7 +25,7 @@ pages: @@ -25,7 +25,7 @@ pages:
25 - [api_docs/c_api.md, API Docs, C API] 25 - [api_docs/c_api.md, API Docs, C API]
26 - [api_docs/c_api/typedefs.md, C API, Typedefs] 26 - [api_docs/c_api/typedefs.md, C API, Typedefs]
27 - [api_docs/c_api/functions.md, C API, Functions] 27 - [api_docs/c_api/functions.md, C API, Functions]
28 - 28 +- [api_docs/python_api.md, API Docs, Python wrapper API]
29 - [api_docs/cpp_api.md, API Docs, C++ Plugin API] 29 - [api_docs/cpp_api.md, API Docs, C++ Plugin API]
30 30
31 # API Functions 31 # API Functions