Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anti-alias text for better readability #171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Anti-alias text for better readability
  • Loading branch information
UnderpantsGnome committed Apr 26, 2024
commit 89e1020364de47b1569f5164271b9b1e4cb6afb7
3 changes: 3 additions & 0 deletions speed-cam.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,7 @@ def speed_camera():
IM_SIGN_FONT_SCALE,
IM_SIGN_FONT_COLOR,
IM_SIGN_FONT_THICK_PX,
cv2.LINE_AA,
)

# Write text on image before saving
Expand All @@ -1565,6 +1566,7 @@ def speed_camera():
(image_width / 2)
- (len(image_text) * IM_FONT_SIZE_PX / 3)
)

if text_x < 2:
text_x = 2
cv2.putText(
Expand All @@ -1575,6 +1577,7 @@ def speed_camera():
IM_FONT_SCALE,
IM_FONT_COLOR,
IM_FONT_THICKNESS,
cv2.LINE_AA,
)

# Save resized image. If jpg format, user can customize image quality 1-100 (higher is better)
Expand Down