From d711c3822c350ee183c38cd8a4162ef7c55f2a46 Mon Sep 17 00:00:00 2001 From: Austin Blanton Date: Wed, 6 Nov 2013 16:04:14 -0500 Subject: [PATCH] Add docs for new C API funcs --- openbr/core/core.cpp | 2 +- openbr/openbr.cpp | 6 ++++++ openbr/openbr.h | 25 ++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/openbr/core/core.cpp b/openbr/core/core.cpp index e9782e4..6eba193 100644 --- a/openbr/core/core.cpp +++ b/openbr/core/core.cpp @@ -187,7 +187,7 @@ struct AlgorithmCore void enroll(Template &data) { if (transform.isNull()) qFatal("Null transform."); - data = (data >> *transform); + data >> *transform; } void retrieveOrEnroll(const File &file, QScopedPointer &gallery, FileList &galleryFiles) diff --git a/openbr/openbr.cpp b/openbr/openbr.cpp index 77cfbb4..41c16db 100644 --- a/openbr/openbr.cpp +++ b/openbr/openbr.cpp @@ -325,6 +325,12 @@ int br_img_cols(br_template tmpl) return t->m().cols; } +int br_img_channels(br_template tmpl) +{ + Template *t = reinterpret_cast(tmpl); + return t->m().channels(); +} + void br_enroll_template(br_template tmpl) { Template *t = reinterpret_cast(tmpl); diff --git a/openbr/openbr.h b/openbr/openbr.h index 3f41878..2690d0b 100644 --- a/openbr/openbr.h +++ b/openbr/openbr.h @@ -206,6 +206,10 @@ BR_EXPORT void br_fuse(int num_input_simmats, const char *input_simmats[], * \see br_finalize */ BR_EXPORT void br_initialize(int &argc, char *argv[], const char *sdk_path = ""); +/*! + * \brief Wraps br::Context::initialize() with default arguments. + * \see br_finalize + */ BR_EXPORT void br_initialize_default(); /*! @@ -419,16 +423,35 @@ BR_EXPORT void br_slave_process(const char * baseKey); // this will be this header's conception of a template // any functions that need a Template pointer // will take this typedef and cast it -// (and then we'll cross our fingers) typedef void* br_template; /*! * \brief Load an image from a string buffer. * Easy way to pass an image in memory from another programming language to openbr. + * \param data The image buffer. + * \param len The length of the buffer. + * \see br_unload_img */ BR_EXPORT br_template br_load_img(const char *data, int len); +/*! + * \brief Unload an image to a string buffer. + * Easy way to pass an image from openbr to another programming language. + */ BR_EXPORT unsigned char* br_unload_img(br_template tmpl); +/*! + * \brief Get the number of rows in an image. + */ BR_EXPORT int br_img_rows(br_template tmpl); +/*! + * \brief Get the number of columns in an image. + */ BR_EXPORT int br_img_cols(br_template tmpl); +/*! + * \brief Get the number of channels in an image. + */ +BR_EXPORT int br_img_channels(br_template tmpl); +/*! + * \brief Enroll a br::Template from the C API! + */ BR_EXPORT void br_enroll_template(br_template tmpl); /*! @}*/ -- libgit2 0.21.4