enlarge label

This commit is contained in:
anetla 2024-01-21 22:20:43 +01:00
parent aa4fb49423
commit c85341133e
1 changed files with 3 additions and 4 deletions

View File

@ -373,7 +373,7 @@
canvas.height = img.height;
ctx.drawImage(img, 0, 0);
ctx.lineWidth = 15;
ctx.font = "bold 50px Arial"; // Zwiększono rozmiar czcionki
ctx.font = "bold 70px Arial"; // Zwiększono rozmiar czcionki
// Draw bounding boxes
boxes.forEach(([x1, y1, x2, y2, object_type, prob]) => {
@ -402,7 +402,6 @@
break;
}
const label = `${object_type}`;
// Przypisz różne kolory do różnych klas
let boxColor;
@ -429,13 +428,13 @@
boxColor = "#000000";
break;
}
const label = `${object_type}`;
ctx.strokeStyle = boxColor;
ctx.strokeRect(x1, y1, x2 - x1, y2 - y1);
ctx.fillStyle = boxColor;
const width = ctx.measureText(label).width;
ctx.fillRect(x1, y1, width + 10, 25);
ctx.fillRect(x1, y1 - 40, width + 10, 70);
ctx.fillStyle = "#000000";
ctx.fillText(label, x1, y1 + 10 ); // Przesunięcie etykiety
});