* Assigns a color to each label in the label set */
| 63 | * Assigns a color to each label in the label set |
| 64 | */ |
| 65 | std::vector<std::tuple<std::string, common::BBoxColor>> AssignColourToLabel(const std::string& pathToLabelFile) |
| 66 | { |
| 67 | std::ifstream in(pathToLabelFile); |
| 68 | std::vector<std::tuple<std::string, common::BBoxColor>> labels; |
| 69 | |
| 70 | std::string str; |
| 71 | std::default_random_engine generator; |
| 72 | std::uniform_int_distribution<int> distribution(0,255); |
| 73 | |
| 74 | while (std::getline(in, str)) |
| 75 | { |
| 76 | if(!str.empty()) |
| 77 | { |
| 78 | common::BBoxColor c{ |
| 79 | .colorCode = std::make_tuple(distribution(generator), |
| 80 | distribution(generator), |
| 81 | distribution(generator)) |
| 82 | }; |
| 83 | auto bboxInfo = std::make_tuple (str, c); |
| 84 | |
| 85 | labels.emplace_back(bboxInfo); |
| 86 | } |
| 87 | } |
| 88 | return labels; |
| 89 | } |
| 90 | |
| 91 | std::tuple<std::unique_ptr<common::IFrameReader<cv::Mat>>, |
| 92 | std::unique_ptr<common::IFrameOutput<cv::Mat>>> |