Fixed color array initialization problem
authorYuan Zhao <yuanzhao@ti.com>
Fri, 4 May 2018 23:14:52 +0000 (18:14 -0500)
committerYuan Zhao <yuanzhao@ti.com>
Mon, 7 May 2018 18:28:26 +0000 (13:28 -0500)
- Fixed label/color mappings for ssd
- MCT-974

examples/segmentation/main.cpp
examples/segmentation/object_classes.cpp
examples/segmentation/object_classes.h
examples/ssd_multibox/main.cpp

index 32179b9588a8e61ce8268e2087e9ce34b3801c4b..ed7b53375f8f880e98620acc3f987c841339a8ce 100644 (file)
@@ -329,9 +329,9 @@ void CreateMask(uchar *classes, uchar *mb, uchar *mg, uchar* mr,
     {
         object_class_t *object_class = GetObjectClass(object_class_table,
                                                       classes[i]);
-        mr[i] = object_class->color[0];
-        mg[i] = object_class->color[1];
-        mb[i] = object_class->color[2];
+        mb[i] = object_class->color.blue;
+        mg[i] = object_class->color.green;
+        mr[i] = object_class->color.red;
     }
 }
 
index 1cc2a9a3c0513a02eb923284603b21fa59df5580..d930106f0aec6ddac344f04413a4851060bfb702 100644 (file)
@@ -46,9 +46,9 @@ object_class_table_t jdetnet_table =
     4,
     {
         { "some class 1",     { 255,   0, 255 } },
-        { "vehicle",          {   0,   0, 255 } },
-        { "road sign",        { 255, 255,   0 } },
         { "pedestrian",       { 255,   0,   0 } },
+        { "road sign",        { 255, 255,   0 } },
+        { "vehicle",          {   0,   0, 255 } },
         { "unknown",          {   0,   0,   0 } }    /* guard */
     }
 };
index 7ae0e5ad0637f67e2f030fdfe62a1b76f2d2df4c..2a2fce7631519a20bd82d147a5d9741dca732bba 100644 (file)
 #define _OBJECT_CLASSES_H_
 
 #include <string>
+#include <vector>
 
 typedef struct {
     const char *label;
-    unsigned char color[3];  /* rgb */
+    struct {
+        unsigned char red;
+        unsigned char green;
+        unsigned char blue;
+    } color;
 } object_class_t;
 
 typedef struct {
-    unsigned int num_classes;
-    object_class_t  classes[];
+    unsigned int                 num_classes;
+    std::vector<object_class_t>  classes;
 } object_class_table_t;
 
 extern object_class_table_t* GetObjectClassTable(std::string &config);
index 8f9b6e068473781b09409f835a3234bb889ccd48..50545a7b81eb970c9ececc8f62da2a5c1847ad1f 100644 (file)
@@ -372,8 +372,9 @@ bool WriteFrameOutput(const ExecutionObject &eo,
 #endif
 
         cv::rectangle(frame, Point(xmin, ymin), Point(xmax, ymax),
-                      Scalar(object_class->color[0], object_class->color[1],
-                             object_class->color[2]), 2);
+                      Scalar(object_class->color.blue,
+                             object_class->color.green,
+                             object_class->color.red), 2);
     }
 
     // output