Hand 보고서 #54
KimMin-Gwan
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hand 개요
Hand는 MediaPipe 라이브러리를 활용하여 손가락의 부위별 좌표를 알아내도록 하는 패키지이다.
MediaPipe 는 Google에서 제작하여 배포한 비전 AI 오픈소스 크로스 플랫폼 프레임워크이다.
간단한 방법으로 화면에 있는 신체 부위의 좌표를 알 수 있으며 이번 프로젝트에서는 손가락 위치를 알아내기 위해 사용되었다.
Hand 패키지
constants.py
mediapipe가 화면에서 추출해낸 데이터를 보관하는 객체들로 구성되어 있다.
utils.py
numpy는 피타고라스의 정리를 사용하기 위해 가져온다.
손가락의 위치 정보를 x와 y로 각각 반환
엄지와 검지 사이의 거리 변화를 확인한다.
만약 이전 프레임보다 거리가 멀어졌다면 True와 현재 거리를 반환하여 보관한다.
손가락을 mediapipe에서 지원하는 Hands 클래스를 이용하여 객체로 만든다.
mdp.py
mediapipe에서 지원하는 Hands 클래스를 사용하여 predict를 진행한 결과를 results에 보관한다.
results에서 landmarks를 추출해내고, 엄지와 검지 끝의 좌표를 각각 받아온다.
손가락의 좌표로 부터 거리를 계산하고, 4회이상 거리가 벌어진 것이 확인되면 트리거로 인정한다.
트리거가 True가 되면 다음 프레임 부터 제스처 모드를 사용하기 위해 gesture를 True로 반환한다.
Beta Was this translation helpful? Give feedback.
All reactions