how can i get face detected bounding box in face mesh

Solutions on MaxInterview for how can i get face detected bounding box in face mesh by the best coders in the world

showing results for - "how can i get face detected bounding box in face mesh"
Danica
13 Jan 2017
1if res.multi_face_landmarks:
2            for faceLms in res.multi_face_landmarks:
3                mpDraw.draw_landmarks(imgOriginal, faceLms, mpFaceMesh.FACE_CONNECTIONS, drawSpec, drawSpec)
4
5                h, w, c = imgOriginal.shape
6                cx_min = w
7                cy_min = h
8                cx_max = cy_max = 0
9                for id, lm in enumerate(faceLms.landmark):
10                    cx, cy = int(lm.x * w), int(lm.y * h)
11                    if cx < cx_min:
12                        cx_min = cx
13                    if cy < cy_min:
14                        cy_min = cy
15                    if cx > cx_max:
16                        cx_max = cx
17                    if cy > cy_max:
18                        cy_max = cy
19				cv2.rectangle(imgOriginal, (cx_min, cy_min), (cx_max, cy_max), (255, 255, 0), 2)