create account

Control Your Mouse with Hand Gestures and Camera by engportal

View this thread on: hive.blogpeakd.comecency.com
· @engportal · (edited)
$19.67
Control Your Mouse with Hand Gestures and Camera
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. 

https://www.youtube.com/embed/X5gDggyGZMU

## 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.](https://www.python.org/downloads/release/python-3810/)

**2)** **Rust**
[Download link. ](https://www.rust-lang.org/tools/install)  

**3)** **OpenCV**
I have tested it with opencv-python 4.5.5.62. [More info](https://pypi.org/project/opencv-python/).
Run in the terminal:
> pip3.8 install opencv-python

**4)** **Hand Tracking Module**
I have tested it with HandTrackingModule 0.1. [More info](https://pypi.org/project/HandTrackingModule/).
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](https://pypi.org/project/setuptools-rust/).
Run in the terminal:
> pip3.8 install setuptools-rust

**6)** **Autopy**
I have tested it with autopy 4.0.0. [More info](https://pypi.org/project/autopy/).
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
1) Download the source files:
[AIVirtualMouseProject.py](https://odysee.com/@EngPortal:c/6YvD9shMMTE8zPF:9?r=7tFFMZweTFZW9JUnx6tJjyYHEb2JWi2Q)
[HandTrackingModule.py](https://odysee.com/@EngPortal:c/iLsZV4KH2n:0?r=7tFFMZweTFZW9JUnx6tJjyYHEb2JWi2Q)

2) Put these two files into a single folder.

3) 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

4) To navigate your mouse, you stick only your second finger out and move your hand around.

5) To perform left-click, you stick the middle finger out in addition to your second finger and touch them together.

6) If you want to program different gestures or more functionality, you can modify the source code.

7) 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](https://www.waivio.com/object/opencv) 
[#python](https://www.waivio.com/object/python) 
[#ai](https://www.waivio.com/object/ai) 
[#computervision](https://www.waivio.com/object/computervision) 
[#opensource](https://www.waivio.com/object/opensource) 
[#programming](https://www.waivio.com/object/programming) 
[#python3](https://www.waivio.com/object/python3) 
[#engineer](https://www.waivio.com/object/engineer) 
[#engineering](https://www.waivio.com/object/engineering) 
[#software](https://www.waivio.com/object/software) 
[#developer](https://www.waivio.com/object/developer) 
[#development](https://www.waivio.com/object/development) 
👍  , , , , , , , , , , , ,
properties (23)
authorengportal
permlinkcontrol-your-mouse-with-hand-gestures-and-camera
categorywaivio
json_metadata{"community":"waivio","app":"waivio/1.0.0","format":"markdown","timeOfPostCreation":1641326267619,"host":"www.waivio.com","users":["EngPortal"],"links":["https://www.python.org/downloads/release/python-3810/","https://www.rust-lang.org/tools/install","https://pypi.org/project/opencv-python/","https://pypi.org/project/HandTrackingModule/","https://pypi.org/project/setuptools-rust/","https://pypi.org/project/autopy/","https://odysee.com/@EngPortal:c/6YvD9shMMTE8zPF:9?r=7tFFMZweTFZW9JUnx6tJjyYHEb2JWi2Q","https://odysee.com/@EngPortal:c/iLsZV4KH2n:0?r=7tFFMZweTFZW9JUnx6tJjyYHEb2JWi2Q","http://www.waivio.com/object/opencv","http://www.waivio.com/object/python"],"image":[],"wobj":{"wobjects":[{"object_type":"hashtag","objectName":"opencv","author_permlink":"opencv","percent":12},{"object_type":"hashtag","objectName":"python","author_permlink":"python","percent":8},{"object_type":"hashtag","objectName":"ai","author_permlink":"ai","percent":8},{"object_type":"hashtag","objectName":"computervision","author_permlink":"computervision","percent":8},{"object_type":"hashtag","objectName":"opensource","author_permlink":"opensource","percent":8},{"object_type":"hashtag","objectName":"programming","author_permlink":"programming","percent":8},{"object_type":"hashtag","objectName":"python3","author_permlink":"python3","percent":8},{"object_type":"hashtag","objectName":"engineer","author_permlink":"engineer","percent":8},{"object_type":"hashtag","objectName":"engineering","author_permlink":"engineering","percent":8},{"object_type":"hashtag","objectName":"software","author_permlink":"software","percent":8},{"object_type":"hashtag","objectName":"developer","author_permlink":"developer","percent":8},{"object_type":"hashtag","objectName":"development","author_permlink":"development","percent":8}]},"tags":["waivio","opencv","python","ai","computervision","opensource","programming","python3","engineer","engineering","software","developer","development"]}
created2022-01-04 07:09:54
last_update2022-01-04 19:57:45
depth0
children5
last_payout2022-01-11 07:09:54
cashout_time1969-12-31 23:59:59
total_payout_value9.266 HBD
curator_payout_value10.404 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,903
author_reputation102,653,252,763
root_title"Control Your Mouse with Hand Gestures and Camera"
beneficiaries
0.
accountvasiliyxx
weight1,000
1.
accountwaivio
weight100
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id109,142,686
net_rshares11,902,411,354,356
author_curate_reward""
vote details (13)
@hivebuzz ·
Congratulations @engportal! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@engportal/upvoted.png?202201100940"></td><td>You received more than 10 upvotes.<br>Your next target is to reach 50 upvotes.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@engportal) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Check out the last post from @hivebuzz:**
<table><tr><td><a href="/hivebuzz/@hivebuzz/pum-202201-8"><img src="https://images.hive.blog/64x128/https://i.imgur.com/4rgjfmA.png"></a></td><td><a href="/hivebuzz/@hivebuzz/pum-202201-8">Hive Power Up Month - Feedback from Day 7</a></td></tr></table>

###### Support the HiveBuzz project. [Vote](https://hivesigner.com/sign/update_proposal_votes?proposal_ids=%5B%22199%22%5D&approve=true) for [our proposal](https://peakd.com/me/proposals/199)!
properties (22)
authorhivebuzz
permlinknotify-engportal-20220110t101139
categorywaivio
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2022-01-10 10:11:39
last_update2022-01-10 10:11:39
depth1
children0
last_payout2022-01-17 10:11:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,119
author_reputation370,665,759,351,061
root_title"Control Your Mouse with Hand Gestures and Camera"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id109,341,562
net_rshares0
@kk8888aa ·
Very cool!
properties (22)
authorkk8888aa
permlinkre-engportal-control-your-mouse-with-hand-gestures-and-camera-20220104t072120975z
categorywaivio
json_metadata{"community":"waivio","app":"waivio/1.0.0","format":"markdown","timeOfPostCreation":1641280883975,"tags":["waivio"],"users":[],"links":[],"image":[],"wobj":{"wobjects":[]}}
created2022-01-04 07:21:24
last_update2022-01-04 07:21:24
depth1
children0
last_payout2022-01-11 07:21:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length10
author_reputation735,310,528,458
root_title"Control Your Mouse with Hand Gestures and Camera"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id109,142,935
net_rshares0
@lovesniper ·
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]( https://peakd.com/hive-174578/@ybanezkim26/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](https://peakd.com/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](https://giftgiver.site/).

Also, as this the hive can be quite confusing, the newly launched [Newbies Guide](https://peakd.com/@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](https://discord.gg/wKPunkz9wK) server if you have any questions!

properties (22)
authorlovesniper
permlinkre-engportal-r56g99
categorywaivio
json_metadata{"tags":["waivio"],"app":"peakd/2021.09.1"}
created2022-01-04 08:44:00
last_update2022-01-04 08:44:00
depth1
children0
last_payout2022-01-11 08:44:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,691
author_reputation1,530,551,637,990,420
root_title"Control Your Mouse with Hand Gestures and Camera"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id109,144,361
net_rshares0
@quang2203 ·
Amazing!!!
properties (22)
authorquang2203
permlinkre-engportal-2023213t15410131z
categorywaivio
json_metadata{"tags":["waivio","opencv","python","ai","computervision","opensource","programming","python3","engineer","engineering","software","developer","development"],"app":"ecency/3.0.31-vision","format":"markdown+html"}
created2023-02-13 08:04:09
last_update2023-02-13 08:04:09
depth1
children0
last_payout2023-02-20 08:04:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length10
author_reputation-16,958,552,309
root_title"Control Your Mouse with Hand Gestures and Camera"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,735,992
net_rshares0
@vasiliyxx ·
I have created a new channel @engportal where I will be making engineering related posts.
properties (22)
authorvasiliyxx
permlinkre-engportal-control-your-mouse-with-hand-gestures-and-camera-20220104t072641052z
categorywaivio
json_metadata{"community":"waivio","app":"waivio/1.0.0","format":"markdown","timeOfPostCreation":1641281204053,"tags":["waivio"],"users":["engportal"],"links":["/@engportal"],"image":[],"wobj":{"wobjects":[]}}
created2022-01-04 07:26:42
last_update2022-01-04 07:26:42
depth1
children0
last_payout2022-01-11 07:26:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length89
author_reputation373,629,718,688
root_title"Control Your Mouse with Hand Gestures and Camera"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id109,143,030
net_rshares0