How can we set different colors
for different objects detected using YOLO. Now everything detected are displaying in green rectangle.
function draw() {
image(video, 0, 0, width, height); // Displaying image on a canvas
for (let i = 0; i < objects.length; i++) //Iterating through all objects
{
noStroke();
fill(0, 255, 0); //Color of text
text(objects[i].label, objects[i].x * width, objects[i].y * height - 5);
//Displaying the label
noFill();
strokeWeight(4);
stroke(0, 255, 0); //Defining stroke for rectangular outline
rect(objects[i].x * width, objects[i].y * height, objects[i].w * width,
objects[i].h * height);
}
}