AI Virtual Mouse | OpenCV Python | Computer Vision
Вставка
- Опубліковано 22 сер 2024
- In this video, we are going to create an AI-based Mouse Controller. We will first detect the hand landmarks and then track and click based on these points. We will also apply smoothing techniques to make it more usable.
🚀🚀 My Urdu/Hindi AI UA-cam Channel 🚀🚀
/ @murtazahassan01
Download Code:
www.computervi...
Premium Courses:
✔️ Computer Vision Game Development Course:
bit.ly/3ttLZ2s
✔️ Computer Vision with Arduino Course:
bit.ly/3wzLB4m
✔️ Advanced Drone Programming Course:
bit.ly/3qs3v5g
✔️ Learn to Build Computer Vision Mobile Apps:
bit.ly/3uioY1J
✔️ Jetson Nano Premium Course:
bit.ly/3L8uIlF
⚙️⚙️⚙️--My Gear - ⚙️⚙️⚙️
👉 Complete Gear 💈: www.computervi...
👉 My PC Specs 🖥️: www.computervi...
👉 My Video Shooting Gear📽️ : www.computervi...
👉 My Laptops 💻: www.computervi...
👉 Educational Products🧑🎓: www.computervi...
👉 UA-cam Starter Kit 🔴: www.computervi...
Follow Me:
TikTok: bit.ly/3Vo76OQ
Facebook Group: bit.ly/3irDcb7
Discord: bit.ly/3JvyxAM
Facebook Page: bit.ly/3IvpU7W
Instagram : bit.ly/3NdGME3
Website: bit.ly/3ICFTS0
Github: bit.ly/3woU6PS
#ComputerVision
#OpenCV
#CVZone
this is the kind of stufff i dreamed to do when i started codin..... thanks for this amazing video.... deserves a sub
Can you please share your code ?
Bro how fast your brain works? You are really amazing. You are getting on a maximum level in AI
Lol thank you
@@murtazasworkshop
Sir the code you given is not working completely even after I set video capture(0) please help.
@@murtazasworkshop I have a question, how to learn "IA"?
@@murtazasworkshop pycharm . Which version sir
For anyone have problem with open the webcam, just change the number in func "cv2.VideoCapture(1)" to "cv2.VideoCapture(0)". 'cause the device number might be 0 or 1 depending on the device and the webcam.
my problem is autopy. I can't install it
@@ramdomapplication whats your python version? I can install in python 3.8
@@iampalop4228 I have version 3.10
@@ramdomapplication install python 3.8 version uninstall python 3.10 restart use command pip install in terminal and always select python 3.8.0(64 bit) inteprator if using mediapipe
@@sourcecloud6061 how you installed opencv in python 3.8.0
Thanks a lot for sharing bro.
it works!
Who ever faces problem while executing, install pycharm and make sure that the python version is 3.7, mediapipe 0.8.10 and autopy 4.0.0 . It worked for me.
Hello Bro...
Please Help Me I Got Some Error
exactly 3.7 or above 3.7?
@@DosawadaAdithya exactly 3.7
There is no 0.8.10 in mediapipe it shows only 0.8.11
What can I do?
Can you please share your code?
Can somebody get this man a million subscribers.
Thank you for your kind words. With you solid support it does not feel far away.
how did your autopy worked ?
I am getting problem in installing it.
@@visheshmalhotra4448 you can go to your command prompt and write pip install autopy, or terminal if you use Mac
@@moking8646 not install dude
Whatever India vs Pakistan... You're from Pakistan and I'm from India. You're the best and changing lives.🔥🤗 Loved your tutorials. If I'm able to choose a teacher. Definitely I will choose you.🌟🌟
I am one of the future million subscribers who has benefited from this module. The the hardest choice is what course to buy...
Hello Murtaza Thank You For The Amazing Cv Lessons, Your Explaining Is So Good I'd Love To Learn Python In The First Place Because Of Your Explaining & I'll Be Happy If There Is Any Courses For Python Basics From You That I Can Watch Or Buy
Hi i need help
I was literally thinking about it after seeing your hand tracking video
Me too🙏
I made the similar project using pynput but couldn't smooth out the motion as he did.
@@shubhammodanwal6713 maybe it's laptops camera problem
@@rushangkasundra3956 I am using my phone as external wifi webcam
Same, I was wanting to do it, than this guy post a tutorial on how to make it, I think he's reading our mind xD
detector = htm.handDetector(maxHands=1)
AttributeError: module 'HandTrackingModule' has no attribute 'handDetector'
i got the same error ,what should i do now??
Try older project
@@Yourwelcome176 what does that mean?
Same problem 🙄
How did u solve that ??
Great video dude,
I want u to have million of subscribers one day!
Love from india❣
Thanks for your sharing a lot!
I’ve subscribed your channel immediately,
I feel very fortunately to watch it right now.
It’s very clear and easy to understand!
Hope you can continually update,
Wish you have good luck in everything!
Helal olsun hocam elinize sağlık sizin gibi insanlara ihtiyacımız var 👏
Tr
Thank you bro! you are amaizing... more Murtaza's in the world, please...
Lol Thank you
Bro am facing problem in installing autopy, how to fix it
.
@@bhavanap1140 same here
If you are facing a problem with installing autopy, then use python 3.6.
Or you can use an alternative of it. Like Pyautogui. It works like a charm when I first tried.
@@learn3045 is it workingg
Not able to find the distance between the two finger in detection mode
With mediapipe library, this is a peace of cake!
Hallo I'm from Indonesia. I have a question Sir
What algorithm did you use to make this project?
I need a theoretical basis for my report.
here sir uses hand landmark detection and hand gesture recognition .Hand landmark using mediapipe(knn algorithm -21 key points) and hand gesture recognition using convolution neural network .When your gesture is recognised it performs the operation.
I am not sure,but this is the best of my knowledge.
You are an amazing guy! This is so helpful. Thankyou very much!!
I hope you would get in future billions of subscribers.
sir i get this error
Traceback (most recent call last):
File "c:/Users/Asus/Documents/projek python/Coding/AImouse.py", line 20, in
detector = htm.handDetector(maxHands=1)
File "c:\Users\Asus\Documents\projek python\Coding\HandTrackingModule.py", line 24, in __init__
self.detectionCon, self.trackCon)
what should i do to fix it ?
Bro same error have you find the solution?
Sir the handDetector function is not present in the hand tracking module. I am receiving an attribute error.
same error
same error give me solution@@mesostonks
For those getting "indexerror: list index out of range" when your hand is off camera. Try adding a Try: Except: to the if statements in the fingersup function and put fingers.append(0) in the except
should i just replace " if to try: " and " else to except"
Thanks a lot everyone should be like you how caring you are nice 👍👍
Same problm m facing bro , BUT i didnt understand what to put in "try" and what to put in "except" statement.
can you please tell me how you solve this error can't understand what you are trying to say
@@azanemuhammad2055 there's an mis-indentation in original source code he posted on his website. try indent some lines fo code
I click like with my fingers!
Thanks for the knowledge.
Greeting from Portugal
A LOT OF THANKS! You have made possible one of my dreams when I started with computers. Regards!
bro can you make a video on "How to download mediapipe and autopy" please because I can't install it
to install autopy and mediapipe watch this video: ua-cam.com/video/xb5Xe8eE_Jw/v-deo.html
try using python version 3.7.9
use python 3.8.0 only this version of python can install mediapipe and autopy easily
@@Chronicsco It worked thx
@@NotOm32 Same ur idea worked too thx
The autopy error is not resolving can u fix this.
did u get the solution?
@@ishitagoyal1631 nope, but u can use another package called pyautogui , which is more efficient than autopy
to install autopy and mediapipe watch this video: ua-cam.com/video/xb5Xe8eE_Jw/v-deo.html
@@ishitagoyal1631 to install autopy and mediapipe watch this video: ua-cam.com/video/xb5Xe8eE_Jw/v-deo.html
TypeError: create_int(): incompatible function arguments. The following argument types are supported:
1. (arg0: int) -> mediapipe.python._framework_bindings.packet.Packet
please urgent need of help @murtazasworkshop
same error
have you resolved the problem?
You are amazing buddy.. I love your content. have referred your channel to several others
You are incredibly awesome....
how to solve?
Traceback (most recent call last):
File "D:/ml projects/AiVirtualMouseProject.py", line 27, in
lmList, bbox = detector.findPosition(img)
File "D:\ml projects\HandTrackingModule.py", line 49, in findPosition
xmin, xmax = min(xList ), max(xList)
ValueError: min() arg is an empty sequence
Same error...Were you able to solve it?
Will u solved this?
Please help sir
Very few people in the world can create , innovate and you are one of them.
Was wondering if you could show how to see the methods inside of a package like mediapipe so we know some of the options
that are available. Thanks.
Can you make a video on how to detect specific mouse movement patterns ? such as detecting if I make the pattern of a number 4 or whatever.
Yes
This guy uses pretrained models
Training models is a bit hard. You can train the neural net to do almost anything using tensor flow . Honestly u learn almost nothing from here if u are an intermediate coder
Congratulation on 100k ❤️ 👍👍👍👍👍
Sir/brdr, you'll not believe I was thinking how could I develop hand tracking to mouse hovering, since past few days, and I just opened UA-cam, and there you were
Come on!! You read my mind
i can not get package of autopy it is giving error while installing
what to do ?
Sir, you are legend. I learnt a lot from you. Make more videos like this. ❤️
Yess
I'm facing this problem.
if self.lmList[self.tipIds[0]][1] > self.lmList[self.tipIds[0] - 1][1]:
IndexError: list index out of range
Kindly someone help me out here. Thank you so much
me toooooo. Did you fix that?
@@zhongjiarui6329 Not yet
But we have declared lmList as follows
self.lmList=[] but we are passing elements as if it's 2D array. So I guess that's why we're facing an issue
Me too
Please inform if you fixed it
I am also getting the same error..can anyone please help me.
Same issue
I did it before you but it was very slow and noisy
Thanks it is very helpful video
You are so amazing.. teaching all the complex things super simply.. i have learned a lot from you.. thank you..
can we add more functionalities to this project like adding the right and left clicks of mouse , scrolling , etc ... can u give some ideas for that ????
yes you can, just check the documentation of the autopy. but in this case I use pyautogui instead of autopy
@@farlanded5179 can you send me the code to your program
Really man this is amazing !!! 🤞
Thank you
Autopy is not installing in my system any suggestion sir even if i try many times
Waiting for your response sir
Actually I have a doubt, the height which you have set in this algorithm whether it is predefined or else you chose it by yourself?
chose it by himself,you can change the value yourself
Hii sir
Thanks for the videos
I am not able to install autopy in my pycharm
I have tried with a lot of things like updating pip, rustup tec. But i am still not able to install the package.
Kindly help.
me too
Make sure that your python version is 3.7 not above it
The project is so great anyways i am getting some errors in the code please help:-
xmin, xmax = min(xList), max(xList)
ValueError: min() arg is an empty sequence
getting this error code in findPosition ()
I got the same error in VS Code, write the code again but with autocomplete. It worked for me :)
Traceback (most recent call last):
File "C:/Users/HP/PycharmProjects/VirtualPaintCV/Count Finger.py", line 36, in
fingers = detector.fingersUp()
File "C:\Users\HP\PycharmProjects\VirtualPaintCV\HandTrackingModule.py", line 72, in fingersUp
if self.lmList[self.tipIds[0]][1] > self.lmList[self.tipIds[0] - 1][1]:
IndexError: list index out of range
[ WARN:1] global C:\Users
unneradmin\AppData\Local\Temp\pip-req-build-_8k9tw8n\opencv\modules\videoio\src\cap_msmf.cpp (438) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback
- Bro this error is coming
@@nojoreduniya U have written the code again with auto complete?
@@nbjayson1947 Yes bro
In my pycharm editor mediapipe is not getting installed
Can some help me out
Error is error: could not find a version that satisfies the requirement mediapipe (from versions: none)
same problem i have
Sir, I have been following, you really changed my taste (in terms of CS domain😂)
I got a error in handTrackerModule.py file in line no. 15 please tell me if u didn't get any error!
@@savvyprogrammer ohkay, I'd like to see your code
@@rishabhpant1828 how??
@@savvyprogrammer we can have connect in comment section in your channel's only video
@@rishabhpant1828 sure please🙏
AttributeError: module 'HandTrackingModule' has no attribute 'handDetector'
plz help me
unistall cvzone and down grade it's version to 1.4.1 then the program should work just fine, handDetector attribute has been removed frrom HandTrackingModule in later versions of cvzone 🤓
Hello, excuse me. how they solved the problem of installing autopy in pycharm
how did you install autopy ?
@Satyam Shashank Karan hi, I installed auntopy from the console, in my corresponding env. and I also did it in the conventional way the pycharm, as it does in the video. is rare. Anyway, I solved it by working on another ide, and I could also change that library in pycharm for another that does the same.
@@cristianmorilla8631 i tried using pycharm as well.. and also with cmd but still I cannot install. can you help me out
@@satyamshashankkaran5886 Last week this did not work for me, I am in exam period but I send the same code without the implementation of savisado and using the library as a class within the same notebook, the comments are in Spanish I think
Please send me out
for those facing problem with autopy or mediapipe installation
i creat a developement environnement with anaconda, and install all what i need.
than i use this env as interpretor , and when i need new dependencies, i just go to anaconda prompt, conda activate nameOfMyEnv and than pip install whatINeed
my env use python 3.8 and everything works, but i see peoples resolving this with changing to python 3.7
Hi, the autopy lib doesn't install in my system. I tried all the ways. Is there any alternative to autopy?
downgrade python to 3.8 should work fine
Sir whenever i am watching your tutorial, one or two modules are always updated and then exact source code doesn't work. Now that becomes a bit difficult to track the chhange in the module. if the module is updated, can you please inform us about the new code as that would be helpful.
Yeah bro the code doesn't works
@@aswingopinathan2516 i mean it works, but that thing is that some module fucntions get updated and figuring out the updated syntax of the new module is a bigger challenge.
Hey! I got an error in this. I have been working on this for quite long now and it isn't solving. While running AiVirtualMouseProject.py, it gave an error in " if self.lmList[self.tipIds[0]][1] < self.lmList[self.tipIds[0] - 1][1]:
IndexError: list index out of range"
I understand its meaning, but somehow i am not able to sort this out. If someone could tell me how to correct it, or connect somewhere to clarify, that would be great.
Thakyou ❤️
I have the same problem
I am getting the same error, have you solved the issue??
@@batulbohra4431 have u find the solution? Please tell me
@Urmila Singh do you got any solution please post it would be really helpful..
I found that this error fires when it can't find fingers (maybe hand out of camera), so lmList is empty.
I wrapped code in fingersUp
if len(self.lmList):
......
else:
fingers=[0,0,0,0,0]
New Window named "Image" is not opening at my end when I run the code.
o/p : hi,pycharm. What to do..?
error lmList, tuple out of the range
i did this also
if len(lmList)!=0:
print(lmList[4])
but same error
what i can do?
facing the same error
@@pup-arazzisworld3469 if len(lmList)!=0 and bbox!=0 : it will work moslty
@@yogeswarrsathish7502 thanks it did work
Hello, I'm pretty interested in this project since I'm doing the same one and I have a question, is it possible to combine this project with background subtraction method to make the program detect the hand in outdoors area or complex background easier?
Why does PyCharm not see the module "HandTrackingModule" ? I have installed all libraries. Please help
@@Lui_trisha we are also dealing with the same problem had you find the solution for this in problem please give and help us
@@Lui_trisha have you installed in the same folder?
@@lechihieu2606 No, I recorded the tracker myself. The author has a site where you can find a lesson where a link is given to the text "HandTrackingModule" It remains only to copy the text and transfer it to PyCharm
@@thirugnanas4605 The author has a site where you can find a lesson where a link is given to the text "HandTrackingModule" It remains only to copy the text and transfer it to PyCharm
mediapipe not install in pycharm
can you help for fix
How do I install autopy package?
Error occurred when installing autopy package
Wow Thank you so much for this video, what a great help. It works perfectly. My windows is activated now. LIKED AND SUBSCRIBED
I found that error
"if self.lmList[self.tipIds[0]][1] < self.lmList[self.tipIds[0] - 1][1]:
IndexError: list index out of range"
fires when it can't find fingers (maybe hand out of camera), so lmList is empty.
I wrapped code in fingersUp
if len(self.lmList):
......
else:
fingers=[0,0,0,0,0]
Or just place code #3-10 in main file under `if len(lmList) != 0:`
'handDetector has no attribute 'tipIds' - I'm having this error, what to do?
Hi Guys. Does this project works on a Mac aswell?
hi there, i have problem when import HandTrackingModule, the error is ModuleNotFoundError: No module named 'HandTrackingModule', can someone help me with this problem?
I keep getting error on HandTrackingModule
. >>AttributeError: module 'HandTrackingModule' has no attribute 'handDetector'
I really love your teaching
Thank you! 😃
Hey! I'm having troubles installing autopy. Any help?
It was an awesome video. Your ideas are brilliant. I am expecting some more videos on object detection, tracking, objectron from the mediapipe library. Keep up the good work.
hello i am having this error:
File "D:\py programs\AI_mini_PROJECT\mouse\HandTrackingModule.py", line 65, in fingersUp
if self.lmList[self.tipIds[0]][1] > self.lmList[self.tipIds[0] - 1][1]:
IndexError: list index out of range.
Does anybody know how to solve it?
DO you got the solution ? @rajeev k
def fingersUp(self):
fingers = []
if len(self.lmList):
if self.lmList[self.tipIds[0]][1] > self.lmList[self.tipIds[0]-1][1]:
fingers.append(1)
else:
fingers.append(0)
for id in range(1,5):
if self.lmList[self.tipIds[id]][2]< self.lmList[self.tipIds[id]-2][2]:
fingers.append(1)
else:
fingers.append(0)
else:
fingers = [0,0,0,0,0]
return fingers
All workshops are not working
getting error handtrackingmodule has no attribute name handdetector
Unable to install Autopy
Tried many times
Super tutorial sir but how to see the code as the link does not gives the code for anything pls do help
Yes I am too having the same problem
I am unable to install autopy it gives an error each time, I have also gone through the website but the instruction couldn't resolve my error. Pls help, how can I install autopy, would really appreciate your help.
Download python 3.7.9, install it, and select that exe file as the interpreter in pycharm settings. Then install all necessary packages
@@nomad4253 that doesn't help as i have to manually install packages through cmd
@@yuvrajjadhav8270 No u don't have to. I think you are selecting interpreter 3.9 but use 3.7
let me know if it works :)
@@nomad4253 Thanks a lot bro... It actually worked for me
For anyone trying to do this project now, don't.
The current code that he's using is outdated and does not work with the new framework of mediapipe, even if you roll back your interpreter to an older one, such as in this video it still won't work so you are wasting your time here. I spent 2h trying to figure out why the code doesn't work just to find a bunch of one year old messages on Stack Overflow that this way of writing code is outdated and is no longer supported or valid.
Yeah
but ya found any other ways around, it works well until a certain point
True.
Hello, I really appreciate your tutorials, they helped me a lot. I have one problem, I'm faced with the fact that it gives out little fps. I read articles that say it depends on the system, but I have a 3060, i5 10400f and 16 ram. Is this really not enough? If not, what else could be the problem?
I have signed up on your site, and was following this AI Virtual Mouse. however, i'm not being able to install "autopy", it's keep giving error. tried to follow instruction from autopy site, but no luck. can u advise any workaround please. thanks in advance
The same error occurred to me but don't worry You may be using Python 2.9 or above version but autopy supports till Python 3.8 version you can see on the pypi website. I resolved the issue by downloading version 3.7.9
Hey, don't worry about older versions you can install both the versions on your pc to use them just switch the path of your compiler. You can follow tutorials to install older versions.
Best of LUCK.
Hello!
Can you help me? I have some problems The program return error
File "C:/Users/shkry/PycharmProjects/MouseAi/main.py", line 28, in
lmList, bbox = detector.findPosition(img)
ValueError: too many values to unpack (expected 2)
@Maxwell Pi I've tried this already. It did not help.
Hi
There are some changes in HandTracking Module, make changes in that code after that your code will execute.
@@lepsygoyal283How can I download the source code? Tabulation is broken on the site.
Everything worked out, thank you very much
@Lepsy Goyal could you share those changes in code of HandTrackingModule.py
Pls bro! I'm worried from 2days,🙂
Thanks for providing this awesome video.
the second you have given is not properly intended the hand one can you please update that 👋🏼
I want to add extra like when I snap my finger it will close every program in computer which is running how can I add that
Hey man love your videos. If possible make a video on "playing gta or any other game using hand tracking"
How to install Autopy as the Error occurred when installing packing 'autopy'? 3:32
Facing the same problem
It didn't work
@@mohammadkanaan3043 Just install python 3.7, it worked for me. I am using PyCharm
I hope it will help you :)
I could just go inspect every single funtion to check what it reutrns and what it does, but a detailed explanation would be much appreciated
Can anyone help with autopy installation. I can't download it because I have an error.
same
Use python 3.7.9
Dude, you are the exactly best in the world!
thank you man really thank you you are a real hero for persons like me cause you are providing this stuff for free while others are not. btw, can you make a video on a ai assistant like google like controlling phone
can you help me i cant install autopy
Can you provide the link for the first part of this project where you wrote the first part of the code? Thanks
Which IDE you have used?
Greetings from Peru excellent video you are a great programmer I wish you many successes in your career Thank you for the explanatory video
how did u install autopy??
Yes, I also couldn't able to install aytopy.As it is showing me the below error:
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for autopy
Running setup.py clean for autopy
Failed to build autopy
ERROR: Could not build wheels for autopy, which is required to install pyproject.toml-based projects
python setup.py bdist_wheel did not run successfully.
Would it work for python 3.10. ??
@@555chaithanyakrishna8 Autopy works on python 3.8 and not working on python 3.9 and up
Your code NOT working! Please fix it
Really Awesome Video.
Thank you so much for your sharing. I have a question relating to installing autopy. How could you solved the problem with error when installing autopy as your first tried.
Thank you so much in advance
It's better that you use a different module like pyautogui or pynput
@@krishnaagarwal895 Thank you so much!!!
i am also having problem installing auto py
Keep up the good work!!
Thanks for this useful video. I tried it myself too, and I'm wondering how I can run mediapipe on a GPU.
why is detector = handDetector() giving an error?
Sir do you work on laptop or use desktop for opencv? as i've desktop computer and dont know how to use opencv using usb cam/webcam. Kindly help me in this.
I am getting "code not accessible" Pylance error in the hand tracking module.Someone please help me
Sorry to say that I am not able to install autopy library on windows 10x64
It installs on Python 3.7.9
@@nomad4253 Thank you, but I found its alternate (pyautogui)