From 8d56a62d5f55bdc58af881fdb7fcc3fbc4bdbcfb Mon Sep 17 00:00:00 2001 From: Zhuo Zhang Date: Fri, 18 Sep 2020 23:41:59 +0800 Subject: [PATCH] fix yolact color array index out of bound bug (#2136) --- examples/yolact.cpp | 102 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 82 insertions(+), 20 deletions(-) diff --git a/examples/yolact.cpp b/examples/yolact.cpp index 86950f54c..0ca94cdf0 100644 --- a/examples/yolact.cpp +++ b/examples/yolact.cpp @@ -369,26 +369,88 @@ static void draw_objects(const cv::Mat& bgr, const std::vector& objects) "scissors", "teddy bear", "hair drier", "toothbrush" }; - static const unsigned char colors[19][3] = { - {244, 67, 54}, - {233, 30, 99}, - {156, 39, 176}, - {103, 58, 183}, - {63, 81, 181}, - {33, 150, 243}, - {3, 169, 244}, - {0, 188, 212}, - {0, 150, 136}, - {76, 175, 80}, - {139, 195, 74}, - {205, 220, 57}, - {255, 235, 59}, - {255, 193, 7}, - {255, 152, 0}, - {255, 87, 34}, - {121, 85, 72}, - {158, 158, 158}, - {96, 125, 139} + static const unsigned char colors[81][3] = { + {56, 0, 255}, + {226, 255, 0}, + {0, 94, 255}, + {0, 37, 255}, + {0, 255, 94}, + {255, 226, 0}, + {0, 18, 255}, + {255, 151, 0}, + {170, 0, 255}, + {0, 255, 56}, + {255, 0, 75}, + {0, 75, 255}, + {0, 255, 169}, + {255, 0, 207}, + {75, 255, 0}, + {207, 0, 255}, + {37, 0, 255}, + {0, 207, 255}, + {94, 0, 255}, + {0, 255, 113}, + {255, 18, 0}, + {255, 0, 56}, + {18, 0, 255}, + {0, 255, 226}, + {170, 255, 0}, + {255, 0, 245}, + {151, 255, 0}, + {132, 255, 0}, + {75, 0, 255}, + {151, 0, 255}, + {0, 151, 255}, + {132, 0, 255}, + {0, 255, 245}, + {255, 132, 0}, + {226, 0, 255}, + {255, 37, 0}, + {207, 255, 0}, + {0, 255, 207}, + {94, 255, 0}, + {0, 226, 255}, + {56, 255, 0}, + {255, 94, 0}, + {255, 113, 0}, + {0, 132, 255}, + {255, 0, 132}, + {255, 170, 0}, + {255, 0, 188}, + {113, 255, 0}, + {245, 0, 255}, + {113, 0, 255}, + {255, 188, 0}, + {0, 113, 255}, + {255, 0, 0}, + {0, 56, 255}, + {255, 0, 113}, + {0, 255, 188}, + {255, 0, 94}, + {255, 0, 18}, + {18, 255, 0}, + {0, 255, 132}, + {0, 188, 255}, + {0, 245, 255}, + {0, 169, 255}, + {37, 255, 0}, + {255, 0, 151}, + {188, 0, 255}, + {0, 255, 37}, + {0, 255, 0}, + {255, 0, 170}, + {255, 0, 37}, + {255, 75, 0}, + {0, 0, 255}, + {255, 207, 0}, + {255, 0, 226}, + {255, 245, 0}, + {188, 255, 0}, + {0, 255, 18}, + {0, 255, 75}, + {0, 255, 151}, + {255, 56, 0}, + {245, 255, 0} }; cv::Mat image = bgr.clone();