lokesh341 commited on
Commit
e78881d
·
1 Parent(s): a63fb5e

Update services/overlay_service.py

Browse files
Files changed (1) hide show
  1. services/overlay_service.py +8 -4
services/overlay_service.py CHANGED
@@ -1,7 +1,11 @@
1
  import cv2
2
 
3
- def overlay_boxes(frame, boxes):
4
- for box in boxes:
 
 
5
  x_min, y_min, x_max, y_max = map(int, box)
6
- cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), (0, 0, 255), 2)
7
- return frame
 
 
 
1
  import cv2
2
 
3
+ def overlay_boxes(frame, cracks):
4
+ for crack in cracks:
5
+ box = crack['box']
6
+ severity = crack['severity']
7
  x_min, y_min, x_max, y_max = map(int, box)
8
+ color = (0, 0, 255) if severity == 'Severe' else (0, 255, 255) if severity == 'Moderate' else (0, 255, 0)
9
+ cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), color, 2)
10
+ cv2.putText(frame, severity, (x_min, y_min - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)
11
+ return frame