Can you make a Virtual Hand Mouse using Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you make a Virtual Hand Mouse using Python?

Here's the instruction : > Open the editor. (VS Code / Pycharm etc.) > Then create a python file and set name as " main.py ". > Select the interpreter. > Then download 4 packages. mediapipe, pyautogui, opencv-python & protobuf 3.20.0 or lower version of it. Then write the code given below : import cv2 import mediapipe as mp import pyautogui cap = cv2.VideoCapture(0) hand_detector = mp.solutions.hands.Hands() drawing_utils = mp.solutions.drawing_utils screen_width, screen_height = pyautogui.size() index_y = 0 while True: _, frame = cap.read() frame = cv2.flip(frame, 1) frame_height, frame_width, _ = frame.shape rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) output = hand_detector.process(rgb_frame) hands = output.multi_hand_landmarks if hands: for hand in hands: drawing_utils.draw_landmarks(frame, hand) landmarks = hand.landmark for id, landmark in enumerate(landmarks): x = int(

14th Jan 2023, 8:07 AM
Fabian Roy
Fabian Roy - avatar
1 Answer
+ 5
Yes
22nd Jan 2023, 6:02 AM
ᎧᎮ ᭄𝓗𝓪𝓬𝓴𝓮𝓻꧂
ᎧᎮ ᭄𝓗𝓪𝓬𝓴𝓮𝓻꧂ - avatar