If you are curious about how Tony Stark (Iron Man) virtual computer work then this project is a little approach toward it, I hope you will enjoy it.
In this project, I make a virtual calculator. When the code will execute it will use a webcam input and show the video which it captures in addition to that it will also draw a virtual calculator on the output video. User needs to raise his hand and by using the index finger or middle finger or ring finger he/she click virtually on the calculator and can perform any operation he/she wants. the result will display on the display board in the top part of the calculator. It is recommended to use all your fingers for better performance but you can also try it with 3 or 4 fingers.
Youtube video for demonstration
It is a central file that uses other files function, output, etc, and makes the program run.
It will contain all function which is used by index.py. It is use to organize the code.
When this code will run 3 windows are open, One will show normal video of input, 2nd window will show binary video, and 3rd window will show 7 trackbars, you can play with the first 6 trackbars to get a good binary video of yours in which your hand is properly distinctable. When it has done then close it.
NOTE:- If you want to reset all values then click on the reset trackbar.
This file is used to adjust calculator position and size by using trackbars.
NOTE:- Don't make a value of X less than 400.
This folder contains all numerical values used by the program. By these values, I try to make my code a little bit dynamic.
hsv_values.txt -> It will store the HSV value which is used to remove the background from the video which is a capture.
values.txt -> It will store (x,y) coordinate if the top-left corner of calculator and height and width of a smallest block of the calculator.
- OpenCV-python
- Numpy
Numpy is only use to save and read values of some array
- Clone This Repository
git clone https://github.com/iTs-rd/Virtual-Calculator.git
2. Install The Required Packages
cd Virtual-Calculator
pip install -r requirements.txt
If above code doesn't work replace pip by pip3.
It will install everything you need. If you have already installed some of the required packages it will skip that.
To run the program simply enter this line
python index.py
When you run index.py it will open 2 windows one is of your normal live video and the other is small in size which shows a video of your right half part and also in binary form. If the smaller window will not removing your background properly or there is so much noise try to change your background by moving to another place or follow #1.3
First of all, You have to check your hand is properly detected or not. by entering this command
python Set_HSV_values.py
It will open 3 windows, One will show normal video of input, 2nd window will show B&W video, and 3rd window will show 7 trackbars, you can play with the first 6 trackbars to get a good B&W video of yours in which your hand is properly distinctable. When it has done then close it.
NOTE:- If you wants to reset all values then click on reset trackbar.
If all done the program is ready to run
Enter this command
python calc_size_position.py
It will open 2 windows one is your normal live video with calculator drawn on it and another window will contain 5 trackbars to change position, size of calculator.
NOTE:- Rest button is used to reset calculator position.
Run these code line by line
git clone https://github.com/iTs-rd/Virtual-Calculator.git
cd Virtual-Calculator
pip install -r requirements.txt
python index.py
The idea for this project is from a youtube video. Email- Rudresh.gupta.che19@iitbhu.ac.in
Linkedin- https://www.linkedin.com/in/rudresh-gupta-b87a84190