Alessio Grancini
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -263,16 +263,28 @@ def get_detection_data(image_data):
|
|
263 |
# Convert BGR to RGB
|
264 |
color_rgb = (int(color_bgr[2]), int(color_bgr[1]), int(color_bgr[0]))
|
265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
detections.append({
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
|
|
276 |
})
|
277 |
|
278 |
response = {
|
|
|
263 |
# Convert BGR to RGB
|
264 |
color_rgb = (int(color_bgr[2]), int(color_bgr[1]), int(color_bgr[0]))
|
265 |
|
266 |
+
#detections.append({
|
267 |
+
#"class_id": cls_id,
|
268 |
+
#"class_name": cls_name,
|
269 |
+
#"bounding_box": {
|
270 |
+
# "vertices": get_box_vertices([x1, y1, x2, y2])
|
271 |
+
#},
|
272 |
+
#"position_3d": get_3d_position(center, depth_value, get_camera_matrix(depth_estimator)),
|
273 |
+
#"distance": depth_value,
|
274 |
+
#"color": color_rgb,
|
275 |
+
#"confidence": float(confidence)
|
276 |
+
|
277 |
detections.append({
|
278 |
+
"class_id": cls_id,
|
279 |
+
"class_name": cls_name,
|
280 |
+
"bounding_box": {
|
281 |
+
"vertices": get_box_vertices([x1, y1, x2, y2])
|
282 |
+
},
|
283 |
+
"center_2d": center_2d, # Add 2D center in screen space
|
284 |
+
"distance": depth_value, # Depth in meters
|
285 |
+
"color": color_rgb,
|
286 |
+
"confidence": float(confidence)
|
287 |
+
})
|
288 |
})
|
289 |
|
290 |
response = {
|