From 31bef74e87679a656b87ee1335dcdb021810cf0a Mon Sep 17 00:00:00 2001 From: Austin Blanton Date: Fri, 22 Nov 2013 10:10:55 -0500 Subject: [PATCH] Add br_img_is_empty to C API in case imdecode fails --- openbr/openbr.cpp | 6 ++++++ openbr/openbr.h | 4 ++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/openbr/openbr.cpp b/openbr/openbr.cpp index 54b0404..067334b 100644 --- a/openbr/openbr.cpp +++ b/openbr/openbr.cpp @@ -341,6 +341,12 @@ int br_img_channels(br_template tmpl) return t->m().channels(); } +bool br_img_is_empty(br_template tmpl) +{ + Template *t = reinterpret_cast(tmpl); + return t->m().empty(); +} + void br_set_filename(br_template tmpl, const char *filename) { Template *t = reinterpret_cast(tmpl); diff --git a/openbr/openbr.h b/openbr/openbr.h index 46bcb87..64d5be4 100644 --- a/openbr/openbr.h +++ b/openbr/openbr.h @@ -467,6 +467,10 @@ BR_EXPORT int br_img_cols(br_template tmpl); */ BR_EXPORT int br_img_channels(br_template tmpl); /*! + * \brief Returns if the image is empty. + */ +BR_EXPORT bool br_img_is_empty(br_template tmpl); +/*! * \brief Set the filename for a template. */ BR_EXPORT void br_set_filename(br_template tmpl, const char *filename); -- libgit2 0.21.4