Skip to content
Merged
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
22 changes: 11 additions & 11 deletions src/text_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np


def lenghth(a):
def length(a):
s = len(a)
if s < 12:
return 36
Expand Down Expand Up @@ -36,7 +36,7 @@ def text_alignment(label, im):
if len(a) == 1:
org = 29 - len(a[0]) + 2, 230
x, y = org
fontScale = lenghth(a[0])
fontScale = length(a[0])
font = ImageFont.truetype("font.ttf", fontScale)
# thin border
text = a[0][:-1]
Expand All @@ -56,7 +56,7 @@ def text_alignment(label, im):
elif len(a) == 2:
org = 29 - len(a[0]) + 2, 7
x, y = org
fontScale = lenghth(a[0])
fontScale = length(a[0])
font = ImageFont.truetype("font.ttf", fontScale)

# thin border
Expand All @@ -76,7 +76,7 @@ def text_alignment(label, im):
im = cv2.cvtColor(np.array(pil_im), cv2.COLOR_RGB2BGR)
org = 29 - len(a[1]) + 2, 230
x, y = org
fontScale = lenghth(a[1])
fontScale = length(a[1])
font = ImageFont.truetype("font.ttf", fontScale)
# thin border
text = a[1]
Expand All @@ -96,7 +96,7 @@ def text_alignment(label, im):
elif len(a) == 3:
org = 29 - len(a[0]) + 2, 7
x, y = org
fontScale = lenghth(a[0])
fontScale = length(a[0])
font = ImageFont.truetype("font.ttf", fontScale)
# thin border
text = a[0]
Expand All @@ -116,7 +116,7 @@ def text_alignment(label, im):
im = cv2.cvtColor(np.array(pil_im), cv2.COLOR_RGB2BGR)
org = 29 - len(a[1]) + 2, 210
x, y = org
fontScale = lenghth(a[1])
fontScale = length(a[1])
font = ImageFont.truetype("font.ttf", fontScale)

# thin border
Expand All @@ -137,7 +137,7 @@ def text_alignment(label, im):
org = 29 - len(a[2]) + 2, 239
x, y = org

fontScale = lenghth(a[2])
fontScale = length(a[2])
font = ImageFont.truetype("font.ttf", fontScale)

# thin border
Expand All @@ -158,7 +158,7 @@ def text_alignment(label, im):
else:
org = 29 - len(a[0]) + 2, 7
x, y = org
fontScale = lenghth(a[0])
fontScale = length(a[0])
font = ImageFont.truetype("font.ttf", fontScale)

# thin border
Expand All @@ -179,7 +179,7 @@ def text_alignment(label, im):
im = cv2.cvtColor(np.array(pil_im), cv2.COLOR_RGB2BGR)
org = 29 - len(a[1]) + 2, 40
x, y = org
fontScale = lenghth(a[1])
fontScale = length(a[1])
font = ImageFont.truetype("font.ttf", fontScale)

# thin border
Expand All @@ -199,7 +199,7 @@ def text_alignment(label, im):
im = cv2.cvtColor(np.array(pil_im), cv2.COLOR_RGB2BGR)
org = 29 - len(a[2]) + 2, 220
x, y = org
fontScale = lenghth(a[2])
fontScale = length(a[2])
font = ImageFont.truetype("font.ttf", fontScale)

# thin border
Expand All @@ -218,7 +218,7 @@ def text_alignment(label, im):
im = cv2.cvtColor(np.array(pil_im), cv2.COLOR_RGB2BGR)
org = 29 - len(a[3]) + 2, 250
x, y = org
fontScale = lenghth(a[3])
fontScale = length(a[3])
font = ImageFont.truetype("font.ttf", fontScale)

# thin border
Expand Down