Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounding box array of points #346

Open
isdito opened this issue Feb 10, 2023 · 0 comments
Open

Bounding box array of points #346

isdito opened this issue Feb 10, 2023 · 0 comments

Comments

@isdito
Copy link

isdito commented Feb 10, 2023

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant