• Stars
    star
    249
  • Rank 162,099 (Top 4 %)
  • Language
    Python
  • Created over 6 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A gesture controlled calculator.

Simple-OpenCV-Calculator

A gesture controlled calculator.

Note

This project is longer actively maintained. This project is now merged with Sign-Language. See the README of Sign-Language.

Outcome

Check it out here in this video

Requirements

  1. OpenCV
  2. Numpy
  3. Keras with Tesorflow as backend

Creating a gesture

  1. First set your hand histogram. You do not need to do it again if you have already done it. But you do need to do it if the lighting conditions change. To do so type the command given below and follow the instructions below.
python set_hand_hist.py
  • A windows "Set hand histogram" will appear.
  • "Set hand histogram" will have 50 squares (5x10).
  • Put your hand in those squares.
  • Press 'c'. 2 other windows will appear. "res" and "Thresh".
  • On pressing 'c' only the parts of the image which has your skin color should appear on the "res" window. White patches corresponding to this should appear on the "Thresh" window.
  • In case you are not successful then move your hand a little bit and press 'c' again. Repeat this until you get a good histogram.
  • After you get a good histogram press 's' to save the histogram. All the windows close.
  1. The next thing you need to do is create your gestures. That is done by the command given below. On starting executing this program, you will have to enter the gesture number and gesture name/text. Then an OpenCV window called "Capturing gestures" which will appear. In the webcam feed you will see a green window (inside which you will have to do your gesture) and a counter that counts the number of pictures stored.
python create_gestures.py    
  1. Press 'c' when you are ready with your gesture. Capturing gesture will begin after a few seconds. Move your hand a little bit here and there. You can pause capturing by pressing 'c' and resume it by pressing 'c'. Capturing resumes after a few secondAfter the counter reaches 1200 the window will close automatically.
  2. When you are done adding new gestures run the load_images.py file once. You do not need to run this file again until and unless you add a new gesture.
python load_images.py

Displaying all gestures

  1. To see all the gestures that are stored in 'gestures/' folder run this command
python display_all_gestures.py

Training a model

  1. So training can be done with Keras. To train using Keras then use the cnn_keras.py file.
python cnn_keras.py
  1. If you use Keras you will have the model in the root directory by the name cnn_keras2.h5.

You do not need to retrain your model every time. In case you added or removed a gesture then you need to retrain it.

Running the calculator

  1. Make sure you have already run the set_hand_hist.py file to set the histogram.
  2. Run the hand-calculator.py file using the command below
python3 hand-calculator.py
  1. This version uses numbers in American Sign Language.
  2. To confirm a digit make sure you keep the same gesture for 20 frames. On successful confirmation, the number will appear in the vertical center of the black part of the window.
  3. To confirm a number make a fist and keep in the green box for 25 frames. You will get used to the timing :P.
  4. You can have any number of digits for both first number and second number.
  5. Currently there are 10 operators.
  6. During operator selection, 1 means '+', 2 means '-', 3 means '*', 4 means '/', 5 means '%', 6 means '**', 7 means '>>' or right shift operator, 8 means '<<' or left shift operator, 9 means '&' or bitwise AND and 0 means '|' or bitwise OR.

Got a question?

If you have any questions that are bothering you please contact me on my facebook profile. Just do not ask me questions like where do I live, who do I work for etc. Also no questions like what does this line do. If you think a line is redundant or can be removed to make the program better then you can obviously ask me or make a pull request.

More Repositories

1

Sign-Language

A very simple CNN project.
749
star
2

emojify

Turn your facial expression into an emoji
Python
283
star
3

SimpleGestureRecognition

A very simple gesture recognition technique using opencv and python
Jupyter Notebook
129
star
4

Hand-Tracking

Tracking hands using deep learning
Python
75
star
5

Virtual-Mouse

Control your mouse using your webcam
Python
51
star
6

Face-Recognition

Facial Recognition using OpenCV and Python
Python
45
star
7

PhotoStylist

Styling your photos with neural style transfer.
Python
39
star
8

HackingTools

Python
23
star
9

final-year-project

This is my B.Tech Final Year project. The aim of this project is to reduce the number of input devices to one which is the webcam.
Python
20
star
10

Virtual-Keyboard

A very simple virtual keyboard that works with gestures using OpenCV
Python
17
star
11

Create-Custom-Haar-Cascade

This script allows you to create custom haar cascades with ease.
Python
11
star
12

Spam-Detection

A program to detect if a given mail is "spam" or "ham".
Python
6
star
13

Sentiment-Analysis

Sensitivity Analysis of movie review and classifying them as either positive or negative using Python
Python
5
star
14

evilport2.github.io

JavaScript
4
star
15

Gender-Classification

https://www.kaggle.com/crowdflower/twitter-user-gender-classification
Jupyter Notebook
4
star
16

SignLanguageV2

Python
2
star
17

NFS-MW-2013-Remote

An android client app that uses its accelerometer to control cars in NFS MW 2013 video game for PC.
Java
1
star
18

SMS-Facebook

The java code that needs to be injected in the original Facebook apk.
Java
1
star