Fumiya Imazato Claude Opus 4.5 commited on
Commit ·
f11eafe
1
Parent(s): c5ade87
fix: Move overlay from top to bottom of screen
Browse filesHuggingFace Spaces header was causing top overlay to be cut off.
Moved OCR results overlay to bottom of video frame.
Rules:
- Always use git diff before commits
- Fix one issue at a time
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -135,13 +135,16 @@ def detection(image):
|
|
| 135 |
num_lines = 1 + min(len(ocr_texts), 5) # Frame + OCRテキスト(最大5行)
|
| 136 |
box_height = 30 + num_lines * 25
|
| 137 |
|
|
|
|
|
|
|
|
|
|
| 138 |
# 背景(黒で塗りつぶし)
|
| 139 |
-
cv2.rectangle(output, (20,
|
| 140 |
# 緑の枠線
|
| 141 |
-
cv2.rectangle(output, (20,
|
| 142 |
|
| 143 |
# Frameカウンター
|
| 144 |
-
y_pos =
|
| 145 |
cv2.putText(output, f"Frame:{_frame_count}", (35, y_pos),
|
| 146 |
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2, cv2.LINE_AA)
|
| 147 |
|
|
|
|
| 135 |
num_lines = 1 + min(len(ocr_texts), 5) # Frame + OCRテキスト(最大5行)
|
| 136 |
box_height = 30 + num_lines * 25
|
| 137 |
|
| 138 |
+
# 画面下部に配置(HF Spacesのヘッダーで上部が見切れるため)
|
| 139 |
+
y_start = h - box_height - 20
|
| 140 |
+
|
| 141 |
# 背景(黒で塗りつぶし)
|
| 142 |
+
cv2.rectangle(output, (20, y_start), (w - 20, h - 20), (0, 0, 0), -1)
|
| 143 |
# 緑の枠線
|
| 144 |
+
cv2.rectangle(output, (20, y_start), (w - 20, h - 20), (0, 255, 0), 2)
|
| 145 |
|
| 146 |
# Frameカウンター
|
| 147 |
+
y_pos = y_start + 25
|
| 148 |
cv2.putText(output, f"Frame:{_frame_count}", (35, y_pos),
|
| 149 |
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2, cv2.LINE_AA)
|
| 150 |
|