I came across OpenCV modules that allow controlling your computer mouse pointer with your finger in space using open-source computer vision software and a webcam.
I slightly modified the source code to make it runnable. The python source code is attached at the bottom.
This can be useful if you want to attach a monitor to a wall without a mouse, and a person can interact with it through a camera.
Satisfying the Prerequisites
1) Python version 3.8.10
This is the latest version of Python that is compatible with Autopy module. Other older versions may also work, but I haven’t tested them. I did confirm that Python 3.9 will not work. Download link.
2) Rust
Download link.
3) OpenCV
I have tested it with opencv-python 4.5.5.62. More info.
Run in the terminal:
pip3.8 install opencv-python
4) Hand Tracking Module
I have tested it with HandTrackingModule 0.1. More info.
Run in the terminal:
pip3.8 install HandTrackingModule
5) Setuptools plugin for Rust extensions
I have tested it with setuptools-rust 1.1.2. More info.
Run in the terminal:
pip3.8 install setuptools-rust
6) Autopy
I have tested it with autopy 4.0.0. More info.
Run in the terminal:
rustup toolchain add nightly-2019-10-05 --profile minimal
rustup default nightly-2019-10-05
pip3.8 install autopy
If you find that any other python module is missing in the error message, install it.
If PIP Module Installation Fails
Try running the pip installation in the command prompt window with admin privileges (“Run as Administrator” for Windows, or with sudo for Linux and MacOS). Or,
Try running the command with user privileges:
pip3.8 install modulenameexample --user
Running the Program
Download the source files:
AIVirtualMouseProject.py
HandTrackingModule.pyPut these two files into a single folder.
Run the AIVirtualMouseProject.py through Python3.8 or the environment that you configured.
If you have multiple cameras, or you have a problem with your camera source, try changing the channel from 1 to 0. For example:
cap = cv2.VideoCapture(1) # for external USB camera, usually additional camera
or
cap = cv2.VideoCapture(0) # for primary camera, usually built-in laptop camera
To navigate your mouse, you stick only your second finger out and move your hand around.
To perform left-click, you stick the middle finger out in addition to your second finger and touch them together.
If you want to program different gestures or more functionality, you can modify the source code.
To exit the program, you can either press CTRL+C on Linux or MacOS if the program was started from the terminal, or you can terminate the program from the Task Manager.
#opencv
#python
#ai
#computervision
#opensource
#programming
#python3
#engineer
#engineering
#software
#developer
#development
Very cool!
I have created a new channel @engportal where I will be making engineering related posts.
Hello, @engportal
This is @fionasfavourites from the @ocd (Original Content Decentralized) curation team. We noticed you shared your first post here on Hive - congratulations and welcome! It would also be awesome if you could do an introduction post, so our community can get to know you better. For an example of what an intro post is like, you can check out this one by my friend & curation team member - Keeping Up With the Buzz – My Introduction to the Hive Community.
Speaking of community, we have many different ones here on the blockchain, devoted to all kinds of interests. Here's a link so you can check them all out – Hive Communities.
Also since you're new, you may run into an RC (Resource Credits) error when trying to comment/post because you don't yet have enough Hive in your account yet. For assistance with a temporary delegation to get you started, be sure to check out the Gift Giver site.
Also, as this the hive can be quite confusing, the newly launched Newbies Guide is a growing repository of useful – easy to understand – posts about how the Hive ecosystem works.
For now, @lovesniper will follow your account and we are looking forward to seeing your intro post. Also, you are welcome to tag me (@fionasfavourites) and please mention @lovesniper in your intro post in order for us to be notified, so we can consider your post for OCD curation. Feel free to hop into the OCD Discord server if you have any questions!
Congratulations @engportal! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):
Your next target is to reach 50 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out the last post from @hivebuzz:
Support the HiveBuzz project. Vote for our proposal!
Amazing!!!