Sephfox commited on
Commit
bf35428
·
verified ·
1 Parent(s): 691fbd2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -416,7 +416,6 @@ holistic = mp_holistic.Holistic(static_image_mode=True, min_detection_confidence
416
 
417
  # Lists of landmark names for pose, face, and hands
418
  pose_landmarks = [name for name in mp_holistic.PoseLandmark.__members__]
419
- face_landmarks = [name for name in mp_holistic.FaceLandmark.__members__]
420
  hand_landmarks = [name for name in mp_holistic.HandLandmark.__members__]
421
 
422
  def detect_landmarks(image_path):
@@ -450,7 +449,7 @@ def detect_landmarks(image_path):
450
  for idx, landmark in enumerate(results.face_landmarks.landmark):
451
  x = int(landmark.x * image_width)
452
  y = int(landmark.y * image_height)
453
- keypoints.append(('FACE_' + face_landmarks[idx], (x, y)))
454
 
455
  # Left hand landmarks
456
  if results.left_hand_landmarks:
@@ -486,6 +485,14 @@ def apply_touch_points(image_path, keypoints):
486
 
487
  return image_pil
488
 
 
 
 
 
 
 
 
 
489
 
490
  # Function to create a sensation map
491
  def create_sensation_map(width, height, keypoints):
 
416
 
417
  # Lists of landmark names for pose, face, and hands
418
  pose_landmarks = [name for name in mp_holistic.PoseLandmark.__members__]
 
419
  hand_landmarks = [name for name in mp_holistic.HandLandmark.__members__]
420
 
421
  def detect_landmarks(image_path):
 
449
  for idx, landmark in enumerate(results.face_landmarks.landmark):
450
  x = int(landmark.x * image_width)
451
  y = int(landmark.y * image_height)
452
+ keypoints.append(('FACE_LANDMARK_' + str(idx), (x, y)))
453
 
454
  # Left hand landmarks
455
  if results.left_hand_landmarks:
 
485
 
486
  return image_pil
487
 
488
+ # Example usage
489
+ image_path = 'path_to_your_image.jpg'
490
+ keypoints = detect_landmarks(image_path)
491
+ if keypoints:
492
+ output_image = apply_touch_points(image_path, keypoints)
493
+ output_image.show()
494
+ else:
495
+ print("No landmarks detected in the image.")
496
 
497
  # Function to create a sensation map
498
  def create_sensation_map(width, height, keypoints):