Skip to content

Bounding box array of points #346

Description

@isdito

Good night,

I am looking for a way with the face points array, get its bounding box and face rotation (tilt, yaw, roll).

mat = np.array(face_landmarks.landmark)

It returns the array of face points if I can't find out how it's rotated, at least through the boundigbox knowing its size

Can you help me

CODE



camera = cv2.VideoCapture("F:/C0010.MP4")

mp_face_mesh = mp.solutions.face_mesh
mp_drawing = mp.solutions.drawing_utils 

with mp_face_mesh.FaceMesh(
	static_image_mode = False,
	max_num_faces = 1,
	min_detection_confidence=0.5) as face_mesh:

    while True:
        ret, frame = camera.read()
        if (ret == 0):
            break
        
        frame_rgb = cv2.cvtColor(frame,cv2.COLOR_BGR2RGB)
        results = face_mesh.process(frame_rgb)
	
        if results.multi_face_landmarks is not None:
            for face_landmarks in results.multi_face_landmarks:
                mp_drawing.draw_landmarks(frame,face_landmarks)
		
                ys, zs, xs = getaxis(face_landmarks.landmark)
                mat = np.array(face_landmarks.landmark)
                print (rotation_angles(mat, "XYZ"))


        cv2.imshow("FRAME",frame)
        k = cv2.waitKey(1) & 0xFF
    
        if (k == 27):
            break

camera.release()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions