daavoo / pyntcloud

pyntcloud is a Python library for working with 3D point clouds.

Home Page:http://pyntcloud.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bounding box array of points

isdito opened this issue · comments

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