press_and_release ( "space" ) elif last_event = "duck" : keyboard. Last_event = "jump" else : if last_event = "jump" : last_event = None if thumb_tip is not None and index_tip is not None : print ( euclidean ( index_tip, middle_tip )) if euclidean ( thumb_tip, index_tip ) < 60 : last_event = "duck" else : if last_event = "duck" : last_event = None check_cnt = 0 if check_cnt = 0 : if last_event = "jump" : keyboard. y, w, h ) if index_tip is not None : if check_cnt = check_every : if index_tip is not None and middle_tip is not None : if euclidean ( index_tip, middle_tip ) < 40 : # 60 should be relative to the height of frame _normalized_to_pixel_coordinates ( hand_landmarks. multi_hand_landmarks : index_dip = mp_drawing. multi_hand_landmarks : for hand_landmarks in res. resize ( frame, ( fsize, fsize )) h, w, _ = frame. read () if not ret : continue frame = cv2. Hands ( static_image_mode = True, max_num_hands = 1, min_detection_confidence = 0.6 ) as hands : while cam. VideoCapture ( 0 ) fsize = ( 520, 720 ) last_event = None check_cnt = 0 check_every = 5 mp_drawing = mp. Just import them and see if any error pops up.Ĭam = cv2. Once installed make sure you can use them. Keyboard: Not the physical one because we are simulating key events using gestures.OpenCV: It will be installed by default while installing mediapipe.Mediapipe: Install it using pip install mediapipe.Auto Dino: Play Trex Game Automatically Video | Blog.Play Trex Game With Gesture Video | Blog.Air Mouse: Control Mouse with Gestures Video | Blog.Real-time Background Changing: Video | Blog.Links to the blogs and videos of each projects are: This blog is the part of the series #7DaysOfComputerVisionProjects. □□♂️□♂️ Well in this blog, we are going to play with with full intention. Many of us have played this game but none of us were interested to play. In this blog, I am writing about how can we play the popular trex game by only moving our fingers in front of the camera. Since few days, I am thinking about some cool projects that can be done within some hours using Mediapipe and OpenCV in Python. ![]() Play Trex Game on Chrome By Gesture Using OpenCV and Mediapipe
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |