Ukuran Teks Relatif Put Text Cv2
def get_optimal_font_scale(text, width):
for scale in reversed(range(0, 60, 1)):
textSize = cv.getTextSize(text, fontFace=cv.FONT_HERSHEY_DUPLEX, fontScale=scale/10, thickness=1)
new_width = textSize[0][0]
#print(new_width)
if (new_width <= width):
return scale/10
return 1
Obnoxious Ox