Create A Virtual Mouse Using 35 Lines of python || Python Project || AI Powered Mouse || open cv

Create A Virtual Mouse Using 35 Lines of python || Python Project || AI Powered Mouse || open cv

Programming Hero

1 год назад

164,991 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Bangaru Varun
Bangaru Varun - 06.11.2023 12:05

Guruji you are great

Ответить
Rahul Sardesai
Rahul Sardesai - 17.10.2023 20:36

The man in the video is really a gem 💎....what an amazing project tutorial it's !.....The energy throughout the entire project is superb....Your teaching process is superb duperb...i should say Bang Bang Bang 🤩😌..... Satisfaction level is high 🫡
Thank you sir 🙏🏼

Ответить
•quixnlle•
•quixnlle• - 09.10.2023 00:26

how can i get cv2 ?

Ответить
Wilson R
Wilson R - 08.10.2023 20:47

It works, but it is really jittery please tell a solution

Ответить
Ramya Sree
Ramya Sree - 08.10.2023 09:08

Sir i am getting an error plz help me

Ответить
aditya chaube
aditya chaube - 29.09.2023 23:05

Sbse bda python to tumhi LG rhe ho

Ответить
Alex Palmer
Alex Palmer - 22.08.2023 05:00

lol you use a phone to record, not like I could do better tho

Ответить
Nikunj Khannawalia
Nikunj Khannawalia - 08.08.2023 16:53

bro your code isn't working it is showing too many problems

Ответить
Nikunj Khannawalia
Nikunj Khannawalia - 04.08.2023 16:55

thier is a lag in my camera video, can you tell me how to solve this problem?

Ответить
Shourya Agarwal
Shourya Agarwal - 30.07.2023 04:55

Thanks a lot programming hero, I did a course 2 years back, and after that did not even try to get in touch back with Python and forgot everything but this video w a unique as I watched your videos 2 years back and I still understood why the code was done and even executed it so thanks

Ответить
VTnotfound | Vasidnotfound | :)
VTnotfound | Vasidnotfound | :) - 20.07.2023 18:35

ok :)

import cv2
import mediapipe as mp
import pyautogui
index_y = 0
cap = cv2.VideoCapture(0)
hand_detector = mp.solutions.hands.Hands()
drawing_utils = mp.solutions.drawing_utils
screen_width, screen_height = pyautogui.size()
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
print(hands)
if hands:
for hand in hands:
drawing_utils.draw_landmarks(frame, hand)
landmarks = hand.landmark
for id, landmarks in enumerate(landmarks):
x = int(landmark.x*frame_width)
y = int(landmark.y*frame_height)
print(x, y)
if id == 8:
cv2.circle(img=frame, center=(x,y), radius=10, (0, 255, 255))
index_x = screen_width/frame_width*x
index_y = screen_height/frame_height*y
pyautogui.moveTo(index_x, index_y)
if id == 4:
cv2.circle(img=frame, center=(x, y), radius=10, (0, 255, 255))
thumb_x = screen_width / frame_width * x
thumb_y = screen_height / frame_height * y
print('outside', abs(index_y - thumb_y))
if abs(index_y - thumb_y) <20:
pyautogui.click()
pyautogui.sleep(1)
print('click')
cv2.imshow('Virtual Mouse' , frame)
drawing_utils.draw_landmarks(frame, hands)
cv2.waitKey(1)

Ответить
Jayalakshmi S cs
Jayalakshmi S cs - 17.07.2023 20:15

Source code plss!!

Ответить
Amar Dib
Amar Dib - 12.07.2023 19:57

This is an awesome turtorial, but I have a question, can we make our cursor movement faster and synchronized?

Ответить
Hồ Phi Đoàn
Hồ Phi Đoàn - 09.07.2023 18:15

Can anyone fix it for me?
frame_height, frame_width, _ = frame.shape
AttributeError: 'NoneType' object has no attribute 'shape'

Ответить
ying wai Sia
ying wai Sia - 06.07.2023 05:22

Amazing!! Awesome video! Thank You Sir❤

Ответить
Zerium
Zerium - 05.07.2023 09:34

Hello i have a small problem with it and i cant seem to figure out how to fix it to try to make the hand on the frame and mouse on the screen line up its converted to the same size however for me that does really work because my hand goes out of frame before i hit any of the corners which makes it hard to click on a windows icon or close a tab how you would you suggest i make the mouse move more when the finger moves

Ответить
Prathamesh Deshmukh
Prathamesh Deshmukh - 02.06.2023 08:55

what is the python version you are using?

Ответить
Rama Chandran
Rama Chandran - 27.05.2023 12:03

Wonderful dear...

Ответить
Y. Sivaram 20BCS1061
Y. Sivaram 20BCS1061 - 25.05.2023 14:36

I can't install mediapipe package in pycharm any solution?

Ответить
Supraja
Supraja - 23.05.2023 10:51

It's always popping that error found in installing mediapipe 🥴....ANY SOLUTION?

Ответить