From 85f148032e50ecdbb05b5d675bc4d6125d8d1c58 Mon Sep 17 00:00:00 2001 From: andrei399 <40136565+andrei399@users.noreply.github.com> Date: Tue, 5 Jul 2022 12:28:13 +0300 Subject: [PATCH] Universal camera shape Automatically grabbing camera shape instead of it being hard-coded in. --- head_posture.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/head_posture.py b/head_posture.py index 0d2db00..f82d20a 100644 --- a/head_posture.py +++ b/head_posture.py @@ -22,7 +22,10 @@ # uncomment next line to use all points for PnP algorithm # points_idx = list(range(0,468)); points_idx[0:2] = points_idx[0:2:-1]; -frame_height, frame_width, channels = (720, 1280, 3) +cap = cv2.VideoCapture(0) +_, frame = cap.read() +frame_height, frame_width, channels = frame.shape +del cap, frame # pseudo camera internals focal_length = frame_width