All Projects → lzane → Fingers Detection Using Opencv And Python

lzane / Fingers Detection Using Opencv And Python

Licence: mit
A simple Fingers Detection (or Gesture Recognition) using OpenCV and Python with background substraction 简单手势识别

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Fingers Detection Using Opencv And Python

Car Finding Lane Lines
Finding Lane Lines using Python and OpenCV
Stars: ✭ 299 (-11.28%)
Mutual labels:  opencv
Face Tracking With Anime Characters
Hello! I have made a Python project where YURI from the game doki doki literature club accesses the webcam and stares directly into the players soul. Hope you enjoy!
Stars: ✭ 320 (-5.04%)
Mutual labels:  opencv
Poseflow
PoseFlow: Efficient Online Pose Tracking (BMVC'18)
Stars: ✭ 330 (-2.08%)
Mutual labels:  opencv
Pigo
Fast face detection, pupil/eyes localization and facial landmark points detection library in pure Go.
Stars: ✭ 3,542 (+951.04%)
Mutual labels:  opencv
Finger Detection And Tracking
Finger Detection and Tracking using OpenCV and Python
Stars: ✭ 317 (-5.93%)
Mutual labels:  opencv
Mobilenet Ssd Realsense
[High Performance / MAX 30 FPS] RaspberryPi3(RaspberryPi/Raspbian Stretch) or Ubuntu + Multi Neural Compute Stick(NCS/NCS2) + RealSense D435(or USB Camera or PiCamera) + MobileNet-SSD(MobileNetSSD) + Background Multi-transparent(Simple multi-class segmentation) + FaceDetection + MultiGraph + MultiProcessing + MultiClustering
Stars: ✭ 322 (-4.45%)
Mutual labels:  opencv
Adversarial Examples Pytorch
Implementation of Papers on Adversarial Examples
Stars: ✭ 293 (-13.06%)
Mutual labels:  opencv
Php Opencv Examples
Tutorial for computer vision and machine learning in PHP 7/8 by opencv (installation + examples + documentation)
Stars: ✭ 333 (-1.19%)
Mutual labels:  opencv
Detecttext
Detect text with stroke width transform.
Stars: ✭ 318 (-5.64%)
Mutual labels:  opencv
Emotion
😄 Recognizes human faces and their corresponding emotions from a video or webcam feed. Powered by OpenCV and Deep Learning.
Stars: ✭ 324 (-3.86%)
Mutual labels:  opencv
Amazon Rekognition Video Analyzer
A working prototype for capturing frames off of a live MJPEG video stream, identifying objects in near real-time using deep learning, and triggering actions based on an objects watch list.
Stars: ✭ 309 (-8.31%)
Mutual labels:  opencv
Opencv Mobile
The minimal opencv for Android, iOS and ARM Linux
Stars: ✭ 310 (-8.01%)
Mutual labels:  opencv
Facemoji
😆 A voice chatbot that can imitate your expression. OpenCV+Dlib+Live2D+Moments Recorder+Turing Robot+Iflytek IAT+Iflytek TTS
Stars: ✭ 320 (-5.04%)
Mutual labels:  opencv
Footfall
Application that allows you to monitor the traffic in and out of your building, using the RPi Camera and openFrameworks
Stars: ✭ 301 (-10.68%)
Mutual labels:  opencv
Idcardocr
离线环境下第二代居民身份证信息识别
Stars: ✭ 328 (-2.67%)
Mutual labels:  opencv
Vehicle License Plate Recognition
🔥 🔥🔥基于Python的车牌检测和识别系统:
Stars: ✭ 293 (-13.06%)
Mutual labels:  opencv
Face Landmark Android
Android AR Camera
Stars: ✭ 320 (-5.04%)
Mutual labels:  opencv
Text Image Augmentation
Geometric Augmentation for Text Image
Stars: ✭ 333 (-1.19%)
Mutual labels:  opencv
Hplayer
A multi-screen player using Qt + FFmpeg.
Stars: ✭ 330 (-2.08%)
Mutual labels:  opencv
Autocrop
😌 Automatically detects and crops faces from batches of pictures.
Stars: ✭ 320 (-5.04%)
Mutual labels:  opencv

for people using python2 and opencv2, please check out the lzane:py2_opencv2 branch.

for people using opencv4, please change line 96 in the new.py to contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) according to the opencv api change.

Environment

  • OS: MacOS El Capitan
  • Platform: Python 3
  • Librarys:
    • OpenCV 3
    • appscript

Demo Videos

How to run it?

  • run it in python
  • press 'b' to capture the background model (Remember to move your hand out of the blue rectangle)
  • press 'r' to reset the backgroud model
  • press 'ESC' to exit

Process

Capture original image

Capture video from camera and pick up a frame.

Alt text

Capture background model & Background subtraction

Use background subtraction method called Gaussian Mixture-based Background/Foreground Segmentation Algorithm to subtract background.

For more information about the method, check Zivkovic2004

Here I use the OpenCV's built-in function BackgroundSubtractorMOG2 to subtract background.

bgModel = cv2.BackgroundSubtractorMOG2(0, bgSubThreshold)

Build a background subtractor model

fgmask = bgModel.apply(frame)

Apply the model to a frame

res = cv2.bitwise_and(frame, frame, mask=fgmask)

Get the foreground(hand) image

Alt text

Gaussian blur & Threshold

gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

First convert the image to gray scale.

blur = cv2.GaussianBlur(gray, (blurValue, blurValue), 0)

By Gaussian blurring, we create smooth transition from one color to another and reduce the edge content.

Alt text

ret, thresh = cv2.threshold(blur, threshold, 255, cv2.THRESH_BINARY)

We use thresholding to create binary images from grayscale images.

Alt text

Contour & Hull & Convexity

We now need to find out the hand contour from the binary image we created before and detect fingers (or in other words, recognize gestures)

contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

This function will find all the contours from the binary image. We need to get the biggest contours (our hand) based on their area since we can assume that our hand will be the biggest contour in this situation. (it's obvious)

After picking up our hand, we can create its hull and detect the defects by calling :

hull = cv2.convexHull(res)
defects = cv2.convexityDefects(res, hull)

Alt text

Now we have the number of fingers. How to use this information? It's based on your imagination...

I add in a keyboard simulation package named appscript as interface to control Chrome's dinosaur game.

Alt text


References & Tutorials

  1. OpenCV documentation: http://docs.opencv.org/2.4.13/
  2. Opencv python hand gesture recognition: http://creat-tabu.blogspot.com/2013/08/opencv-python-hand-gesture-recognition.html
  3. Mahaveerverma's hand gesture recognition project: hand-gesture-recognition-opencv
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].