chore: move code to main function
This commit is contained in:
parent
434cea77c1
commit
0ed01b9172
20
src/main.py
20
src/main.py
|
@ -1,6 +1,11 @@
|
|||
import logging
|
||||
|
||||
import cv2
|
||||
import mediapipe as mp
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Main function."""
|
||||
mp_drawing = mp.solutions.drawing_utils # type: ignore
|
||||
mp_drawing_styles = mp.solutions.drawing_styles # type: ignore
|
||||
mp_holistic = mp.solutions.holistic # type: ignore
|
||||
|
@ -22,6 +27,10 @@ with mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=
|
|||
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
||||
results = holistic.process(image)
|
||||
|
||||
# log landmarks
|
||||
logging.debug(results.face_landmarks)
|
||||
logging.debug(results.pose_landmarks)
|
||||
|
||||
# draw landmark annotation on the image
|
||||
image.flags.writeable = True
|
||||
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
||||
|
@ -46,3 +55,14 @@ with mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=
|
|||
|
||||
# close webcam
|
||||
cap.release()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# setup logging format
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format="%(asctime)s %(name)s %(levelname)-8s %(message)s",
|
||||
datefmt="(%F %T)",
|
||||
)
|
||||
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue