Commit d711c3822c350ee183c38cd8a4162ef7c55f2a46
1 parent
511dae91
Add docs for new C API funcs
Showing
3 changed files
with
31 additions
and
2 deletions
openbr/core/core.cpp
| @@ -187,7 +187,7 @@ struct AlgorithmCore | @@ -187,7 +187,7 @@ struct AlgorithmCore | ||
| 187 | void enroll(Template &data) | 187 | void enroll(Template &data) |
| 188 | { | 188 | { |
| 189 | if (transform.isNull()) qFatal("Null transform."); | 189 | if (transform.isNull()) qFatal("Null transform."); |
| 190 | - data = (data >> *transform); | 190 | + data >> *transform; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | void retrieveOrEnroll(const File &file, QScopedPointer<Gallery> &gallery, FileList &galleryFiles) | 193 | void retrieveOrEnroll(const File &file, QScopedPointer<Gallery> &gallery, FileList &galleryFiles) |
openbr/openbr.cpp
| @@ -325,6 +325,12 @@ int br_img_cols(br_template tmpl) | @@ -325,6 +325,12 @@ int br_img_cols(br_template tmpl) | ||
| 325 | return t->m().cols; | 325 | return t->m().cols; |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | +int br_img_channels(br_template tmpl) | ||
| 329 | +{ | ||
| 330 | + Template *t = reinterpret_cast<Template*>(tmpl); | ||
| 331 | + return t->m().channels(); | ||
| 332 | +} | ||
| 333 | + | ||
| 328 | void br_enroll_template(br_template tmpl) | 334 | void br_enroll_template(br_template tmpl) |
| 329 | { | 335 | { |
| 330 | Template *t = reinterpret_cast<Template*>(tmpl); | 336 | Template *t = reinterpret_cast<Template*>(tmpl); |
openbr/openbr.h
| @@ -206,6 +206,10 @@ BR_EXPORT void br_fuse(int num_input_simmats, const char *input_simmats[], | @@ -206,6 +206,10 @@ BR_EXPORT void br_fuse(int num_input_simmats, const char *input_simmats[], | ||
| 206 | * \see br_finalize | 206 | * \see br_finalize |
| 207 | */ | 207 | */ |
| 208 | BR_EXPORT void br_initialize(int &argc, char *argv[], const char *sdk_path = ""); | 208 | BR_EXPORT void br_initialize(int &argc, char *argv[], const char *sdk_path = ""); |
| 209 | +/*! | ||
| 210 | + * \brief Wraps br::Context::initialize() with default arguments. | ||
| 211 | + * \see br_finalize | ||
| 212 | + */ | ||
| 209 | BR_EXPORT void br_initialize_default(); | 213 | BR_EXPORT void br_initialize_default(); |
| 210 | 214 | ||
| 211 | /*! | 215 | /*! |
| @@ -419,16 +423,35 @@ BR_EXPORT void br_slave_process(const char * baseKey); | @@ -419,16 +423,35 @@ BR_EXPORT void br_slave_process(const char * baseKey); | ||
| 419 | // this will be this header's conception of a template | 423 | // this will be this header's conception of a template |
| 420 | // any functions that need a Template pointer | 424 | // any functions that need a Template pointer |
| 421 | // will take this typedef and cast it | 425 | // will take this typedef and cast it |
| 422 | -// (and then we'll cross our fingers) | ||
| 423 | typedef void* br_template; | 426 | typedef void* br_template; |
| 424 | /*! | 427 | /*! |
| 425 | * \brief Load an image from a string buffer. | 428 | * \brief Load an image from a string buffer. |
| 426 | * Easy way to pass an image in memory from another programming language to openbr. | 429 | * Easy way to pass an image in memory from another programming language to openbr. |
| 430 | + * \param data The image buffer. | ||
| 431 | + * \param len The length of the buffer. | ||
| 432 | + * \see br_unload_img | ||
| 427 | */ | 433 | */ |
| 428 | BR_EXPORT br_template br_load_img(const char *data, int len); | 434 | BR_EXPORT br_template br_load_img(const char *data, int len); |
| 435 | +/*! | ||
| 436 | + * \brief Unload an image to a string buffer. | ||
| 437 | + * Easy way to pass an image from openbr to another programming language. | ||
| 438 | + */ | ||
| 429 | BR_EXPORT unsigned char* br_unload_img(br_template tmpl); | 439 | BR_EXPORT unsigned char* br_unload_img(br_template tmpl); |
| 440 | +/*! | ||
| 441 | + * \brief Get the number of rows in an image. | ||
| 442 | + */ | ||
| 430 | BR_EXPORT int br_img_rows(br_template tmpl); | 443 | BR_EXPORT int br_img_rows(br_template tmpl); |
| 444 | +/*! | ||
| 445 | + * \brief Get the number of columns in an image. | ||
| 446 | + */ | ||
| 431 | BR_EXPORT int br_img_cols(br_template tmpl); | 447 | BR_EXPORT int br_img_cols(br_template tmpl); |
| 448 | +/*! | ||
| 449 | + * \brief Get the number of channels in an image. | ||
| 450 | + */ | ||
| 451 | +BR_EXPORT int br_img_channels(br_template tmpl); | ||
| 452 | +/*! | ||
| 453 | + * \brief Enroll a br::Template from the C API! | ||
| 454 | + */ | ||
| 432 | BR_EXPORT void br_enroll_template(br_template tmpl); | 455 | BR_EXPORT void br_enroll_template(br_template tmpl); |
| 433 | 456 | ||
| 434 | /*! @}*/ | 457 | /*! @}*/ |