Commit 31bef74e87679a656b87ee1335dcdb021810cf0a

Authored by Austin Blanton
1 parent 9309ed63

Add br_img_is_empty to C API in case imdecode fails

openbr/openbr.cpp
@@ -341,6 +341,12 @@ int br_img_channels(br_template tmpl) @@ -341,6 +341,12 @@ int br_img_channels(br_template tmpl)
341 return t->m().channels(); 341 return t->m().channels();
342 } 342 }
343 343
  344 +bool br_img_is_empty(br_template tmpl)
  345 +{
  346 + Template *t = reinterpret_cast<Template*>(tmpl);
  347 + return t->m().empty();
  348 +}
  349 +
344 void br_set_filename(br_template tmpl, const char *filename) 350 void br_set_filename(br_template tmpl, const char *filename)
345 { 351 {
346 Template *t = reinterpret_cast<Template*>(tmpl); 352 Template *t = reinterpret_cast<Template*>(tmpl);
openbr/openbr.h
@@ -467,6 +467,10 @@ BR_EXPORT int br_img_cols(br_template tmpl); @@ -467,6 +467,10 @@ BR_EXPORT int br_img_cols(br_template tmpl);
467 */ 467 */
468 BR_EXPORT int br_img_channels(br_template tmpl); 468 BR_EXPORT int br_img_channels(br_template tmpl);
469 /*! 469 /*!
  470 + * \brief Returns if the image is empty.
  471 + */
  472 +BR_EXPORT bool br_img_is_empty(br_template tmpl);
  473 +/*!
470 * \brief Set the filename for a template. 474 * \brief Set the filename for a template.
471 */ 475 */
472 BR_EXPORT void br_set_filename(br_template tmpl, const char *filename); 476 BR_EXPORT void br_set_filename(br_template tmpl, const char *filename);