Debug-Visualisierung für Fahrzeugzählung hinzugefügt
Neue visuelle Features: - Gelber Punkt am Zentrum jeder Bounding Box - Grüner Kreis erscheint beim Zählen eines Fahrzeugs - "✓" wird zum Label hinzugefügt wenn Fahrzeug gezählt wurde - Grüne Boxen für zählbare Fahrzeuge, blaue für andere Objekte Hilft beim Debuggen: - Zeigt visuell welche Fahrzeuge bereits gezählt wurden - Macht den Zenterpunkt sichtbar für Line-Intersection - Bestätigt visuell erfolgreiche Zählung 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
30
app.py
30
app.py
@@ -135,13 +135,24 @@ def detect_objects_from_webcam(line_data):
|
||||
counted_ids.add(track_id)
|
||||
vehicle_count += 1
|
||||
vehicle_type_counts[c] += 1
|
||||
# Draw visual feedback when vehicle is counted (green circle)
|
||||
cv2.circle(frame, (center_x, center_y), 15, (0, 255, 0), 3)
|
||||
|
||||
# Update position
|
||||
track_positions[track_id] = (center_x, center_y)
|
||||
|
||||
# Draw bounding box and label
|
||||
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
||||
cv2.putText(frame, f'{track_id} - {c}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 0, 255), 1)
|
||||
box_color = (0, 255, 0) if c in VEHICLE_CLASSES else (255, 0, 0)
|
||||
cv2.rectangle(frame, (x1, y1), (x2, y2), box_color, 2)
|
||||
|
||||
# Show if already counted
|
||||
label = f'{track_id} - {c}'
|
||||
if track_id in counted_ids:
|
||||
label += ' ✓'
|
||||
cv2.putText(frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 0, 255), 1)
|
||||
|
||||
# Draw center point (yellow)
|
||||
cv2.circle(frame, (center_x, center_y), 3, (0, 255, 255), -1)
|
||||
|
||||
# Display vehicle count with type breakdown
|
||||
cv2.rectangle(frame, (10, 10), (350, 140), (0, 0, 0), -1)
|
||||
@@ -259,13 +270,24 @@ def detect_objects_from_video(video_path, line_data):
|
||||
counted_ids.add(track_id)
|
||||
vehicle_count += 1
|
||||
vehicle_type_counts[c] += 1
|
||||
# Draw visual feedback when vehicle is counted (green circle)
|
||||
cv2.circle(frame, (center_x, center_y), 15, (0, 255, 0), 3)
|
||||
|
||||
# Update position
|
||||
track_positions[track_id] = (center_x, center_y)
|
||||
|
||||
# Draw bounding box and label
|
||||
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
||||
cv2.putText(frame, f'{track_id} - {c}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 0, 255), 1)
|
||||
box_color = (0, 255, 0) if c in VEHICLE_CLASSES else (255, 0, 0)
|
||||
cv2.rectangle(frame, (x1, y1), (x2, y2), box_color, 2)
|
||||
|
||||
# Show if already counted
|
||||
label = f'{track_id} - {c}'
|
||||
if track_id in counted_ids:
|
||||
label += ' ✓'
|
||||
cv2.putText(frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 0, 255), 1)
|
||||
|
||||
# Draw center point (yellow)
|
||||
cv2.circle(frame, (center_x, center_y), 3, (0, 255, 255), -1)
|
||||
|
||||
# Display vehicle count with type breakdown
|
||||
cv2.rectangle(frame, (10, 10), (350, 140), (0, 0, 0), -1)
|
||||
|
||||
Reference in New Issue
Block a user