Code Monkey home page Code Monkey logo

hand-detection-and-finger-counter's Introduction

Hand-Detection-Finger-Counting

Detect Hand and count number of fingers using Convex Hull algorithm in OpenCV lib in Python

To run the program on primary camera change line 4 to :

cap = cv2.VideoCapture(0)

Steps Involved

1.Find the roi(region of interest) 2.Hand Segmentation : Convert the video frame from BGR to HSV(or Gray) 3.Perform a Gaussian blur 4.Perform a Threshold 5.Find the Biggest Contour(this will be our hand) 6.Perform a convexHull and mark the ROI(region of interest 7.Count the no. of countors 8.Display it

SEGMENTING THE HAND SKIN

The most common is the RGB, where any pixel is composed by the union of three colors (red, green, blue). However, for color segmenting, the HSV color space is much better, because in there the information of color is dissociated from the information of illumination. HSV stands for Hue (the color information), S (Saturation, e.g., the percentage of ‘color’ present) and V (Value/brightness, e.g., the percentage of ‘white’ color present). Generally, human skin lies between (H=0,S=58) and (H=50,S=173).

For our convenience we have taken the values as Lower skin [0,20,70] Upper skin [20,255,255]

Note : In order to get good segmentation you need to fine-tune HSV bounds

Convex Hull

In order to detect fingertips, we are going to use the Convex Hull technique. In mathematics, Convex Hull is the smallest convex set that contains a set of points. And a convex set is a set of points such that, if we trace a straight line from any pair of points in the set, that line must be also be inside the region. The result is then a nice, smooth region, much easier to be analysed than our contour, that contains many imperfections.

image

hand-detection-and-finger-counter's People

Contributors

abonia1 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.