From 4442546437d7a92a1d9c7f036c858c046cc9749c Mon Sep 17 00:00:00 2001 From: Juha Reunanen Date: Tue, 29 Oct 2019 12:27:10 +0200 Subject: [PATCH] Draw rect in the color of the corresponding class --- examples/dnn_instance_segmentation_ex.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/dnn_instance_segmentation_ex.cpp b/examples/dnn_instance_segmentation_ex.cpp index 90dc82427..3689c6acd 100644 --- a/examples/dnn_instance_segmentation_ex.cpp +++ b/examples/dnn_instance_segmentation_ex.cpp @@ -24,6 +24,7 @@ */ #include "dnn_instance_segmentation_ex.h" +#include "pascal_voc_2012.h" #include #include @@ -134,7 +135,13 @@ int main(int argc, char** argv) try rgb_label_image(y, x) = random_color; } - dlib::draw_rectangle(rgb_label_image, instance.rect, dlib::rgb_pixel(255, 255, 255), 1); + const Voc2012class& voc2012_class = find_voc2012_class( + [&instance](const Voc2012class& candidate) { + return candidate.classlabel == instance.label; + } + ); + + dlib::draw_rectangle(rgb_label_image, instance.rect, voc2012_class.rgb_label, 1); } // Show the input image on the left, and the predicted RGB labels on the right.