diff --git a/openbr/openbr.cpp b/openbr/openbr.cpp index 13c648f..981d000 100644 --- a/openbr/openbr.cpp +++ b/openbr/openbr.cpp @@ -323,6 +323,18 @@ unsigned char *br_unload_img(br_template tmpl) return t->m().data; } +void br_free_template(br_template tmpl) +{ + Template *t = reinterpret_cast(tmpl); + delete t; +} + +void br_free_template_list(br_template_list tl) +{ + TemplateList *realTL = reinterpret_cast(tl); + delete realTL; +} + int br_img_rows(br_template tmpl) { Template *t = reinterpret_cast(tmpl); diff --git a/openbr/openbr.h b/openbr/openbr.h index 6050a1f..fdecfc7 100644 --- a/openbr/openbr.h +++ b/openbr/openbr.h @@ -452,6 +452,14 @@ BR_EXPORT br_template br_load_img(const char *data, int len); */ BR_EXPORT unsigned char* br_unload_img(br_template tmpl); /*! + * \brief Free a br::Template's memory. + */ +BR_EXPORT void br_free_template(br_template tmpl); +/*! + * \brief Free a br::TemplateList's memory. + */ +BR_EXPORT void br_free_template_list(br_template_list tl); +/*! * \brief Get the number of rows in an image. * \param tmpl Pointer to a br::Template. */