initial commit

main
Tylan Tyson 1 year ago
commit 684d63fbdb

2
.gitignore vendored

@ -0,0 +1,2 @@
.DS_STORE
venv/

@ -0,0 +1,37 @@
# Imports
import cv2
import mediapipe as mp
# Face Class
class Face:
# Constructor Function
def __init__(self, faces, thickness, circle_radius):
self.video = cv2.VideoCapture(0)
self.image = None
self.mpDraw = mp.solutions.drawing_utils
self.mpFaceMesh = mp.solutions.face_mesh
self.faceMesh = self.mpFaceMesh.FaceMesh(max_num_faces=faces)
self.drawSpec = self.mpDraw.DrawingSpec(thickness=thickness, circle_radius=circle_radius)
self.points = []
self.faces = 0
# Track
def track(self):
success, self.image = self.video.read()
imageRgb = cv2.cvtColor(self.image, cv2.COLOR_BGR2RGB)
results = self.faceMesh.process(imageRgb)
self.points = []
self.faces = 0
if results.multi_face_landmarks:
for faceNumber, face in enumerate(results.multi_face_landmarks):
self.faces += 1
self.mpDraw.draw_landmarks(self.image, face, self.mpFaceMesh.FACEMESH_CONTOURS, self.drawSpec)
for landmarkNumber, landmark in enumerate(face.landmark):
self.points += [faceNumber, landmarkNumber, landmark.x, landmark.y, landmark.z]
# Display
def display(self):
cv2.imshow("Image", self.image)
cv2.waitKey(1)

@ -0,0 +1,10 @@
# Imports
from FaceMesh import Face
# Create Face
face = Face(100, 2, 1)
# Program Loop
while True:
face.track()
face.display()

@ -0,0 +1,23 @@
absl-py==1.4.0
attrs==23.1.0
cffi==1.15.1
contourpy==1.0.7
cycler==0.11.0
flatbuffers==23.3.3
fonttools==4.39.3
importlib-resources==5.12.0
kiwisolver==1.4.4
matplotlib==3.7.1
mediapipe==0.9.3.0
numpy==1.24.3
opencv-contrib-python==4.7.0.72
opencv-python==4.7.0.72
packaging==23.1
Pillow==9.5.0
protobuf==3.20.3
pycparser==2.21
pyparsing==3.0.9
python-dateutil==2.8.2
six==1.16.0
sounddevice==0.4.6
zipp==3.15.0
Loading…
Cancel
Save