Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frank Tjado Ihmels
medienverarbeitung17.projectmood
Commits
cb91aff7
Commit
cb91aff7
authored
Oct 26, 2017
by
Arne Gerdes
Browse files
Zweiten Test mit Landmarks umgesetzt Ziele sollte nun sein beide Tests zusammen zu fuegen
parent
36c840aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
projectmood/ZweiterTest
0 → 100644
View file @
cb91aff7
# Import required modules
import cv2
import dlib
# Set up some required objects
video_capture = cv2.VideoCapture(0) # Webcam object
detector = dlib.get_frontal_face_detector() # Face detector
predictor = dlib.shape_predictor(
"shape_predictor_68_face_landmarks.dat") # Landmark identifier. Set the filename to whatever you named the downloaded file
while True:
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
clahe_image = clahe.apply(gray)
detections = detector(clahe_image, 1) # Detect the faces in the image
for k, d in enumerate(detections): # For each detected face
shape = predictor(clahe_image, d) # Get coordinates
for i in range(1, 68): # There are 68 landmark points on each face
cv2.circle(frame, (shape.part(i).x, shape.part(i).y), 1, (0, 0, 255),
thickness=2) # For each point, draw a red circle with thickness2 on the original frame
cv2.imshow("image", frame) # Display the frame
if cv2.waitKey(1) & 0xFF == ord('q'): # Exit program when the user presses 'q'
break
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment