From 03c6e2c03f037540b7d234a9b28a746cbca361b6 Mon Sep 17 00:00:00 2001 From: Austin Blanton Date: Wed, 18 Feb 2015 16:50:12 -0500 Subject: [PATCH] Change ut.X and ut.Y to int32_t for BBs outside the image --- openbr/plugins/gallery/binary.cpp | 11 ++++++----- openbr/universal_template.cpp | 2 +- openbr/universal_template.h | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/openbr/plugins/gallery/binary.cpp b/openbr/plugins/gallery/binary.cpp index c8229f4..b2c30b3 100644 --- a/openbr/plugins/gallery/binary.cpp +++ b/openbr/plugins/gallery/binary.cpp @@ -247,7 +247,8 @@ class utGallery : public BinaryGallery const int32_t algorithmID = (t.isEmpty() || t.file.fte) ? 0 : t.file.get("AlgorithmID"); const QByteArray url = t.file.get("URL", t.file.name).toLatin1(); - uint32_t x = 0, y = 0, width = 0, height = 0; + int32_t x = 0, y = 0; + uint32_t width = 0, height = 0; QByteArray header; if ((algorithmID <= -1) && (algorithmID >= -3)) { const QRectF frontalFace = t.file.get("FrontalFace"); @@ -268,8 +269,8 @@ class utGallery : public BinaryGallery header.append((const char*)&leftEyeX , sizeof(uint32_t)); header.append((const char*)&leftEyeY , sizeof(uint32_t)); } else { - x = t.file.get("X", 0); - y = t.file.get("Y", 0); + x = t.file.get("X", 0); + y = t.file.get("Y", 0); width = t.file.get("Width", 0); height = t.file.get("Height", 0); } @@ -277,8 +278,8 @@ class utGallery : public BinaryGallery gallery.write(imageID); gallery.write((const char*) &algorithmID, sizeof(int32_t)); - gallery.write((const char*) &x , sizeof(uint32_t)); - gallery.write((const char*) &y , sizeof(uint32_t)); + gallery.write((const char*) &x , sizeof(int32_t)); + gallery.write((const char*) &y , sizeof(int32_t)); gallery.write((const char*) &width , sizeof(uint32_t)); gallery.write((const char*) &height , sizeof(uint32_t)); gallery.write((const char*) &label , sizeof(uint32_t)); diff --git a/openbr/universal_template.cpp b/openbr/universal_template.cpp index 79731ac..8b7d18d 100644 --- a/openbr/universal_template.cpp +++ b/openbr/universal_template.cpp @@ -8,7 +8,7 @@ #include "universal_template.h" -br_utemplate br_new_utemplate(const char *imageID, int32_t algorithmID, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t label, const char *url, const char *fv, uint32_t fvSize) +br_utemplate br_new_utemplate(const char *imageID, int32_t algorithmID, int32_t x, int32_t y, uint32_t width, uint32_t height, uint32_t label, const char *url, const char *fv, uint32_t fvSize) { const uint32_t urlSize = strlen(url) + 1; br_utemplate utemplate = (br_utemplate) malloc(sizeof(br_universal_template) + urlSize + fvSize); diff --git a/openbr/universal_template.h b/openbr/universal_template.h index 979871d..733175e 100644 --- a/openbr/universal_template.h +++ b/openbr/universal_template.h @@ -37,8 +37,8 @@ struct br_universal_template { unsigned char imageID[16]; /*!< MD5 hash of the undecoded origin file. */ int32_t algorithmID; /*!< interpretation of _data_ after _urlSize_. */ - uint32_t x; /*!< region of interest horizontal offset (pixels). */ - uint32_t y; /*!< region of interest vertical offset (pixels). */ + int32_t x; /*!< region of interest horizontal offset (pixels). */ + int32_t y; /*!< region of interest vertical offset (pixels). */ uint32_t width; /*!< region of interest horizontal size (pixels). */ uint32_t height; /*!< region of interest vertical size (pixels). */ uint32_t label; /*!< supervised training class or manually annotated ground truth. */ @@ -57,7 +57,7 @@ typedef const struct br_universal_template *br_const_utemplate; * \brief br_universal_template constructor. * \see br_free_utemplate */ -BR_EXPORT br_utemplate br_new_utemplate(const char *imageID, int32_t algorithmID, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t label, const char *url, const char *fv, uint32_t fvSize); +BR_EXPORT br_utemplate br_new_utemplate(const char *imageID, int32_t algorithmID, int32_t x, int32_t y, uint32_t width, uint32_t height, uint32_t label, const char *url, const char *fv, uint32_t fvSize); /*! * \brief br_universal_template destructor. -- libgit2 0.21.4