Alessio Grancini
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -254,16 +254,14 @@ def get_detection_data(image_data):
|
|
254 |
depthmap, depth_colormap = depth_estimator.make_prediction(image)
|
255 |
|
256 |
detections = []
|
257 |
-
for obj in objects_data:
|
258 |
-
cls_id, cls_name, center, mask,
|
259 |
x1, y1, x2, y2 = get_bbox_from_mask(mask)
|
260 |
depth_value = depth_at_center(depthmap, [x1, y1, x2, y2])
|
261 |
-
|
262 |
# Get color in RGB format (OpenCV uses BGR)
|
263 |
color_rgb = (int(color_bgr[2]), int(color_bgr[1]), int(color_bgr[0])) # Convert BGR to RGB
|
264 |
|
265 |
-
|
266 |
-
|
267 |
detections.append({
|
268 |
"class_id": cls_id,
|
269 |
"class_name": cls_name,
|
|
|
254 |
depthmap, depth_colormap = depth_estimator.make_prediction(image)
|
255 |
|
256 |
detections = []
|
257 |
+
for idx, obj in enumerate(objects_data):
|
258 |
+
cls_id, cls_name, center, mask, color_bgr = obj
|
259 |
x1, y1, x2, y2 = get_bbox_from_mask(mask)
|
260 |
depth_value = depth_at_center(depthmap, [x1, y1, x2, y2])
|
261 |
+
|
262 |
# Get color in RGB format (OpenCV uses BGR)
|
263 |
color_rgb = (int(color_bgr[2]), int(color_bgr[1]), int(color_bgr[0])) # Convert BGR to RGB
|
264 |
|
|
|
|
|
265 |
detections.append({
|
266 |
"class_id": cls_id,
|
267 |
"class_name": cls_name,
|