@@ -249,6 +249,18 @@ def run_all(args_input):
249249 text_landmark = f"{ landmark_list } "
250250 text_location = (frame .shape [1 ] - 500 , 50 )
251251 text_box_size = (300 , 50 )
252+
253+ # Increase font size and adjust text and box accordingly
254+ font_scale = 1.3 # Adjust the font scale as needed
255+ thickness = 2 # Adjust the thickness of the text as needed
256+ font = cv2 .FONT_HERSHEY_SIMPLEX
257+
258+ # Get the size of the text
259+ text_size = cv2 .getTextSize (text_landmark , font , font_scale , thickness )[0 ]
260+
261+ # Adjust the text location and box based on the new font size
262+ text_offset = (10 , text_size [1 ] + 10 )
263+ text_box_size = (text_size [0 ] + 20 , text_size [1 ] + 20 )
252264
253265 # Create a black box, put text inside
254266 cv2 .rectangle (
@@ -264,13 +276,13 @@ def run_all(args_input):
264276 cv2 .putText (
265277 frame ,
266278 text_landmark ,
267- (text_location [0 ] + 10 , text_location [1 ] + 35 ),
268- cv2 . FONT_HERSHEY_SIMPLEX ,
269- 0.7 ,
270- (255 , 255 , 255 ),
271- 2 ,
272- cv2 .LINE_AA ,
273- )
279+ (text_location [0 ] + text_offset [ 0 ] , text_location [1 ] + text_offset [ 1 ] ),
280+ font ,
281+ font_scale ,
282+ (255 , 255 , 255 ),
283+ thickness ,
284+ cv2 .LINE_AA ,
285+ )
274286
275287 # Finally get the frame ready.
276288 out_ = cv2 .normalize (
0 commit comments