stream_hacks to main #2

Merged
skeh merged 8 commits from stream_hacks into main 2024-12-11 03:22:13 +00:00
3 changed files with 37 additions and 1 deletions
Showing only changes of commit c9db70f57d - Show all commits

View File

@ -32,6 +32,20 @@ face_mesh_map = {
], ],
} }
body_map = {
LANDMARK_TYPES.SHOULDER | LANDMARK_TYPES.LEFT: [11],
LANDMARK_TYPES.SHOULDER | LANDMARK_TYPES.RIGHT: [12],
LANDMARK_TYPES.ELBOW | LANDMARK_TYPES.LEFT: [13],
LANDMARK_TYPES.ELBOW | LANDMARK_TYPES.RIGHT: [14],
LANDMARK_TYPES.HIP | LANDMARK_TYPES.LEFT: [23],
LANDMARK_TYPES.HIP | LANDMARK_TYPES.RIGHT: [24],
LANDMARK_TYPES.KNEE | LANDMARK_TYPES.LEFT: [25],
LANDMARK_TYPES.KNEE | LANDMARK_TYPES.RIGHT: [26],
}
# SEE YEAH THESE MAKE SENSE GOOGLE WHAT THE HELL # SEE YEAH THESE MAKE SENSE GOOGLE WHAT THE HELL
hand_mesh_map = {LANDMARK_TYPES.HAND | LANDMARK_TYPES.WRIST: [0]} hand_mesh_map = {LANDMARK_TYPES.HAND | LANDMARK_TYPES.WRIST: [0]}
_finger_map = { _finger_map = {

View File

@ -2,7 +2,7 @@ import mediapipe
import numpy as np import numpy as np
from ovtk_track.transform import TransformProcess from ovtk_track.transform import TransformProcess
from ovtk_track.transform.solve.mediapipe import face_mesh_map, hand_mesh_map from ovtk_track.transform.solve.mediapipe import face_mesh_map, hand_mesh_map, body_map
from ovtk_track import types from ovtk_track import types
from ovtk_track.types.Landmarks import LANDMARK_TYPES from ovtk_track.types.Landmarks import LANDMARK_TYPES
@ -83,6 +83,17 @@ class Process(TransformProcess):
available.append((right_hand_landmarks, mix_maps(hand_mesh_map, LANDMARK_TYPES.RIGHT))) available.append((right_hand_landmarks, mix_maps(hand_mesh_map, LANDMARK_TYPES.RIGHT)))
if results.pose_landmarks:
raw_landmarks = results.pose_landmarks.landmark
body_landmarks = np.empty((33, 3), dtype=np.float32)
for i in range(33):
body_landmarks[i][0] = raw_landmarks[i].x
body_landmarks[i][1] = raw_landmarks[i].y
body_landmarks[i][2] = raw_landmarks[i].z
available.append((body_landmarks, body_map))
if available: if available:
avail_landmarks, maps = zip(*available) avail_landmarks, maps = zip(*available)
combo_map = combine_maps(zip(maps, (array.shape[0] for array in avail_landmarks))) combo_map = combine_maps(zip(maps, (array.shape[0] for array in avail_landmarks)))

View File

@ -17,6 +17,17 @@ class LANDMARK_TYPES(Flag):
LIPS = auto() LIPS = auto()
CHIN = auto() CHIN = auto()
# Body
SHOULDER = auto()
ELBOW = auto()
HIP = auto()
KNEE = auto()
# Feet tracking lmao
ANKLE = auto()
HEEL = auto()
TOE_INDEX = auto()
# Hand # Hand
HAND = auto() HAND = auto()
WRIST = auto() WRIST = auto()