AI Virtual Mouse | OpenCV Python | Computer Vision
HTML-код
- Опубликовано: 20 авг 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 RUclips 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...
👉 RUclips 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 ?
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?
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
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.🌟🌟
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
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
Great video dude,
I want u to have million of subscribers one day!
Love from india❣
Helal olsun hocam elinize sağlık sizin gibi insanlara ihtiyacımız var 👏
Tr
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
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!
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.
Not able to find the distance between the two finger in detection mode
I hope you would get in future billions of subscribers.
You are an amazing guy! This is so helpful. Thankyou very much!!
Really man this is amazing !!! 🤞
Thank you
I click like with my fingers!
Thanks for the knowledge.
Greeting from Portugal
With mediapipe library, this is a peace of cake!
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
You are incredibly awesome....
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 ??
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?
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
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: ruclips.net/video/xb5Xe8eE_Jw/видео.html
@@ishitagoyal1631 to install autopy and mediapipe watch this video: ruclips.net/video/xb5Xe8eE_Jw/видео.html
Sir, you are legend. I learnt a lot from you. Make more videos like this. ❤️
Yess
I did it before you but it was very slow and noisy
Thanks it is very helpful video
A LOT OF THANKS! You have made possible one of my dreams when I started with computers. Regards!
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
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.
How do I install autopy package?
Error occurred when installing autopy package
i can not get package of autopy it is giving error while installing
what to do ?
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: ruclips.net/video/xb5Xe8eE_Jw/видео.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
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
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/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 RUclips, and there you were
Come on!! You read my mind
Congratulation on 100k ❤️ 👍👍👍👍👍
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
You are amazing buddy.. I love your content. have referred your channel to several others
Very few people in the world can create , innovate and you are one of them.
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
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
mediapipe not install in pycharm
can you help for fix
hi there, i have problem when import HandTrackingModule, the error is ModuleNotFoundError: No module named 'HandTrackingModule', can someone help me with this problem?
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 🤓
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
Hey! I'm having troubles installing autopy. Any help?
New Window named "Image" is not opening at my end when I run the code.
o/p : hi,pycharm. What to do..?
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
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
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.
Wow Thank you so much for this video, what a great help. It works perfectly. My windows is activated now. LIKED AND SUBSCRIBED
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]
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
I keep getting error on HandTrackingModule
. >>AttributeError: module 'HandTrackingModule' has no attribute 'handDetector'
You are so amazing.. teaching all the complex things super simply.. i have learned a lot from you.. thank you..
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.
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
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🙏
Unable to install Autopy
Tried many times
getting error handtrackingmodule has no attribute name handdetector
All workshops are not working
Hi Guys. Does this project works on a Mac aswell?
Keep up the good work!!
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?
I really love your teaching
Thank you! 😃
Thanks for providing this awesome video.
Autopy is not installing in my system any suggestion sir even if i try many times
Waiting for your response sir
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
Nice video, thanks :)
Really Awesome Video.
Dude, you are the exactly best in the world!
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
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
THE BEST RUclips CHANNEL!!!!
Thank you
the second you have given is not properly intended the hand one can you please update that 👋🏼
can you help me i cant install autopy
I am getting "code not accessible" Pylance error in the hand tracking module.Someone please help me
Sir, where can I get mediapipe version 0.8, HandTrackingModule can run on mediapipe 0.8 and mediapipe no longer provides mediapipe version 0.8 now starting from version 0.9
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
why is detector = handDetector() giving an error?
so cool!
I can't install autopy in python 3.9 please help
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
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.
IT's just awesome. THank you!
In the error shows in the detector line sir how to clear it
i cant install autopy. its filed install
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.
i dont know but my autopy is not installing can someone please help me
Hey man love your videos. If possible make a video on "playing gta or any other game using hand tracking"
Can you provide the link for the first part of this project where you wrote the first part of the code? Thanks
Greetings from Peru excellent video you are a great programmer I wish you many successes in your career Thank you for the explanatory video
Thanks for this useful video. I tried it myself too, and I'm wondering how I can run mediapipe on a GPU.
❤❤❤❤ dont have words to say about him. Love you bro.
The curser is not moving as when i only up the index finger webcam is automatically closing. If you know please help me out
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
you project ideas excites me!!
thanks :)
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
what is the name of the development software being used?
Which IDE you have used?