Commit 4aff6f126b535ddcbf89c6582ef4678974e2630e

Authored by Josh Klontz
1 parent 343cfe9b

made br_universal_template::label an integer to overcome alignment issues

openbr/plugins/gallery.cpp
... ... @@ -313,15 +313,15 @@ class utGallery : public BinaryGallery
313 313 width = t.file.get<uint32_t>("Width", 0);
314 314 height = t.file.get<uint32_t>("Height", 0);
315 315 }
316   - const double label = t.file.get<double>("Label", 0);
  316 + const uint32_t label = t.file.get<uint32_t>("Label", 0);
317 317  
318 318 gallery.write(imageID);
319   - gallery.write((const char*) &algorithmID, sizeof(uint32_t));
  319 + gallery.write((const char*) &algorithmID, sizeof(int32_t));
320 320 gallery.write((const char*) &x , sizeof(uint32_t));
321 321 gallery.write((const char*) &y , sizeof(uint32_t));
322 322 gallery.write((const char*) &width , sizeof(uint32_t));
323 323 gallery.write((const char*) &height , sizeof(uint32_t));
324   - gallery.write((const char*) &label , sizeof(double));
  324 + gallery.write((const char*) &label , sizeof(uint32_t));
325 325  
326 326 const uint32_t urlSize = url.size() + 1;
327 327 gallery.write((const char*) &urlSize, sizeof(uint32_t));
... ...
openbr/universal_template.cpp
... ... @@ -8,7 +8,7 @@
8 8  
9 9 #include "universal_template.h"
10 10  
11   -br_utemplate br_new_utemplate(const int8_t *imageID, int32_t algorithmID, size_t x, size_t y, size_t width, size_t height, double label, const char *url, const char *fv, uint32_t fvSize)
  11 +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)
12 12 {
13 13 const uint32_t urlSize = strlen(url) + 1;
14 14 br_utemplate utemplate = (br_utemplate) malloc(sizeof(br_universal_template) + urlSize + fvSize);
... ...
openbr/universal_template.h
... ... @@ -41,8 +41,7 @@ struct br_universal_template
41 41 uint32_t y; /*!< region of interest vertical offset (pixels). */
42 42 uint32_t width; /*!< region of interest horizontal size (pixels). */
43 43 uint32_t height; /*!< region of interest vertical size (pixels). */
44   - double label; /*!< classification/regression supervised training class,
45   - or manually annotated ground truth. */
  44 + uint32_t label; /*!< supervised training class or manually annotated ground truth. */
46 45 uint32_t urlSize; /*!< length of null-terminated URL at the beginning of _data_,
47 46 including the null-terminator character. */
48 47 uint32_t fvSize; /*!< length of the feature vector after the URL in _data_. */
... ... @@ -58,7 +57,7 @@ typedef const struct br_universal_template *br_const_utemplate;
58 57 * \brief br_universal_template constructor.
59 58 * \see br_free_utemplate
60 59 */
61   -BR_EXPORT br_utemplate br_new_utemplate(const int8_t *imageID, int32_t algorithmID, size_t x, size_t y, size_t width, size_t height, double label, const char *url, const char *fv, uint32_t fvSize);
  60 +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);
62 61  
63 62 /*!
64 63 * \brief br_universal_template destructor.
... ...