0

I have trained YOLOv3 darknet model on my custom dataset. First I have cloned the https://github.com/kriyeng/darknet/ repository in google colab and then run the whole code in google colab. But I want to change the color of the bounding boxes in the output video. Please suggest how to do it. Thanks in advance.

Sneha Roy
  • 81
  • 1
  • 3
  • 16

1 Answers1

0

Here is a solution in C++ but you can apply it to python as well. Just change the values in Scalar. In the example below it is set to the color red.

//Draw a rectangle displaying the bounding box
rectangle(frame, Point(left, top), Point(right, bottom), Scalar(0, 0, 255));

yudhiesh
  • 6,383
  • 3
  • 16
  • 49
  • Yo, how to get scalar? – Shahriar Kabir Khan Aug 27 '20 at 00:01
  • Scalar is present by default in OpenCV to allow you to pass pixel values. If you're using python I do not think the Scalar type in C++ and Python are the same. You could do the following # Create a blank 300x300 black image image = np.zeros((300, 300, 3), np.uint8) # Fill image with red colour (set each pixel to red BGR not RGB) image[:] = (0, 0, 255) – yudhiesh Aug 27 '20 at 01:58