From 13c6367072a202a131e099d3d1dfd9df0f3a0b94 Mon Sep 17 00:00:00 2001 From: syauqibilfaqih Date: Tue, 20 Aug 2024 21:37:53 +0700 Subject: [PATCH 1/2] Changed textsize to textlength --- examples/identify_and_draw_boxes_on_faces.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/identify_and_draw_boxes_on_faces.py b/examples/identify_and_draw_boxes_on_faces.py index 1b5fef7ae..20747f8fc 100644 --- a/examples/identify_and_draw_boxes_on_faces.py +++ b/examples/identify_and_draw_boxes_on_faces.py @@ -58,7 +58,8 @@ draw.rectangle(((left, top), (right, bottom)), outline=(0, 0, 255)) # Draw a label with a name below the face - text_width, text_height = draw.textsize(name) + text_width = draw.textlength(name) + text_height = draw.textlength(name) draw.rectangle(((left, bottom - text_height - 10), (right, bottom)), fill=(0, 0, 255), outline=(0, 0, 255)) draw.text((left + 6, bottom - text_height - 5), name, fill=(255, 255, 255, 255)) From e7b082396566eece16cd4f7abfdef77a67f8d01e Mon Sep 17 00:00:00 2001 From: syauqibilfaqih Date: Wed, 21 Aug 2024 13:22:22 +0700 Subject: [PATCH 2/2] BGR2RGB Convert Image --- examples/facerec_from_webcam_faster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/facerec_from_webcam_faster.py b/examples/facerec_from_webcam_faster.py index e4a7bbd47..e0daa09c1 100644 --- a/examples/facerec_from_webcam_faster.py +++ b/examples/facerec_from_webcam_faster.py @@ -48,7 +48,7 @@ small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25) # Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses) - rgb_small_frame = small_frame[:, :, ::-1] + rgb_small_frame = cv2.cvtColor(small_frame,cv2.COLOR_BGR2RGB) # Find all the faces and face encodings in the current frame of video face_locations = face_recognition.face_locations(rgb_small_frame)