Spaces:
Runtime error
Runtime error
File size: 486 Bytes
eb0e26a e78881d 6b08eb8 e78881d |
1 2 3 4 5 6 7 8 9 10 11 |
import cv2
def overlay_boxes(frame, cracks):
for crack in cracks:
box = crack['box']
severity = crack['severity']
x_min, y_min, x_max, y_max = map(int, box)
color = (0, 0, 255) if severity == 'Severe' else (0, 255, 255) if severity == 'Moderate' else (0, 255, 0)
cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), color, 2)
cv2.putText(frame, severity, (x_min, y_min - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)
return frame |