code: import csv
  import numpy as np
  import mediapipe as mp
  import cv2
  
  class_name = "Speaking"
  
  mp_drawing = mp.solutions.drawing_utils  # Drawing helpers
  mp_holistic = mp.solutions.holistic  # Mediapipe Solutions
  
  str_source = input("dir：")
  cap = cv2.VideoCapture(str_source)
  # Initiate holistic model
  with mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5) as holistic:
      while cap.isOpened():
          ret, frame = cap.read()
  
          # Recolor Feed
          image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
          image.flags.writeable = False
  
          # Make Detections
          results = holistic.process(image)
  
          # Recolor image back to BGR for rendering
          image.flags.writeable = True
          image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
  
          # 1. Draw face landmarks
          mp_drawing.draw_landmarks(image, results.face_landmarks, mp_holistic.FACE_CONNECTIONS,
                                    mp_drawing.DrawingSpec(color=(80, 110, 10), thickness=1, circle_radius=1),
                                    mp_drawing.DrawingSpec(color=(80, 256, 121), thickness=1, circle_radius=1)
                                    )
  
          # 2. Right hand
          mp_drawing.draw_landmarks(image, results.right_hand_landmarks, mp_holistic.HAND_CONNECTIONS,
                                    mp_drawing.DrawingSpec(color=(80, 22, 10), thickness=2, circle_radius=4),
                                    mp_drawing.DrawingSpec(color=(80, 44, 121), thickness=2, circle_radius=2)
                                    )
  
          # 3. Left Hand
          mp_drawing.draw_landmarks(image, results.left_hand_landmarks, mp_holistic.HAND_CONNECTIONS,
                                    mp_drawing.DrawingSpec(color=(121, 22, 76), thickness=2, circle_radius=4),
                                    mp_drawing.DrawingSpec(color=(121, 44, 250), thickness=2, circle_radius=2)
                                    )
  
          # 4. Pose Detections
          mp_drawing.draw_landmarks(image, results.pose_landmarks, mp_holistic.POSE_CONNECTIONS,
                                    mp_drawing.DrawingSpec(color=(245, 117, 66), thickness=2, circle_radius=4),
                                    mp_drawing.DrawingSpec(color=(245, 66, 230), thickness=2, circle_radius=2)
                                    )
          # Export coordinates
          try:
              # Extract Pose landmarks
              pose = results.pose_landmarks.landmark
              pose_row = list(
                  np.array([[landmark.x, landmark.y, landmark.z, landmark.visibility] for landmark in pose]).flatten())
  
              row = pose_row
  
              # Append class name
              row.insert(0, class_name)
  
              # Export to CSV
              with open('body_coords.csv', mode='a', newline='') as f:
                  csv_writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
                  csv_writer.writerow(row)
  
          except:
              pass
  
          cv2.imshow('Video', image)
  
          if cv2.waitKey(10) & 0xFF == ord('q'):
              break
  
  cap.release()
  cv2.destroyAllWindows()
  
apis: numpy.array