A method of detecting and recognising hand gestures using openCV

hand gesture recognition using convexity

hand gesture recognition using convexityThis post is about to introduce an efficient method of detecting and recognising hand gestures using the convexity detection of openCV, as illustrated in the picture on the left. In contrast to the previous work of detecting hand contours, this method steps further to recognise gestures of hand pretty accurately, meanwhile this shows possibilities of extend such work into using simple hand gestures to manipulate computer applications.

For more details, here is a relevant tutorial video made by original author who explains who this works.

Here gives the source code of this video demonstration.

You can download the full code at:
1) Full Demo Solution (Code + video 43Mb)
2) Full Demo Code

All copyrights relevant to source codes and method explanations are reserved by the original author Luca Del Tongo, please refer to his blog for more details and any enquiries.

Author: Andol Li

A HCI researcher, a digital media lecturer, an information product designer, and a python/php/java coder.

183 Comments On “ A method of detecting and recognising hand gestures using openCV”

    • @Amir AI is not required to recognise the hand gestures since the recognition work mostly relies on computer vision like image analysis, in another words, computer vision is a necessary part for machines’ artificial intelligence because these devices need to recognise what they have seem.

  1. can you please the provide any demo code for opencv 2.1 usig microsoft visual studio 2008 professional. i am just learning this if possible can you provide me some links to read about gesture recogition

    • @John VS2010 is an option, also it can be VS 2008 or Eclipse. To use the hand gesture recognition with openCV, firstly installing the openCV and including relevant libraries, of course. Secondly checking the algorithms used in the example of this post, and then use similar functions to done similar work. Actually the key function of this demonstration is the function called ‘CvConvexityDefect’, which can be referred here http://www.andol.me/hci/797.htm

  2. Hi, Andol, thank you for your reply. I want to also start to doing the gesture recognition project, and I only know how to using the C++.
    Would you mind to tell me why you used the C# to implement the project, why not using C or C++? Thank you.

    • @John As you have noticed the library used in the demonstration video, the author uses Emgu CV, which comes with better compatibility. Surely you can use C++ instead of C#, more information you can refer the author’s website here.

  3. hello, i want a full documentation on the opencv library, especially for edge detection and extraction of landmarks for example a hand in 2D, thank you

  4. hey i m trying to run the program in visual studio 2008 visual c++ directories but there are lot of errors. can you please provide the source code for the hand gesture recognition in.cpp
    i hope i am not bothering you

    • Hi, Swaroop, please refer this ‘http://blogs.ugidotnet.org/wetblog’ and contact the author for further help since the source codes were developed by him.

  5. hey i wanna send data to my avr microcontroller from the visual studio whats the procedure
    say i detect a gesture and i wanna control a motor through microcontroller so how do i send the data

    • This is beyond my research experiences, but you can google relevant posts about using visual studio to control a motor. Here is one of these references:
      The only means of communication between the Arduino and the PC is the serial port.
      The PC can write data to the serial port. The Arduino can read from the serial port.
      Given that a means of communication exists, the only difficulty you will have will be choosing which language to use to write the application that runs on the PC.
      Visual Studio is a programming environment, not a programming language. You can use it to write applications in Visual Basic, C, C++, C#, Java, etc. Each language will have it’s own mechanism for interfacing with the serial port.

  6. Dear Andol,
    How to detect the hands, whether could we threshold the image, over differentiating the color with the Hand and other surrounding,… Whether could color alone be sufficient to detect the Hand…?

    • yes, threshold then following differentiating colours is a possible way, but detecting hands by colours is not so robust as expected, because the backgrounds are never known what they will be.

  7. Dear Andol,
    Can U pls help me with the Hand detection…? we are working with some colors painted in our hand..?How to that normally and exactly without any colors…? Are would U suggest that painting the color will be a good process…?

    • Hi Ponraju, what you talked about is possible, to extract the background from dynamic images it is available to use functions relating to threshold, smooth, houghlines and houghcircles. Specific details of these functions can be found through openCV manuals.

  8. I am newbie to OpenCV and I have been really interested in computer vision after seeing some amazing hacks on the internet for the kinect. I plan to do some of the stuff you have mentioned in this article and just want to thank you for taking the time to post this article.

  9. Hi Andol,
    Thank for your great video
    I am trying to run the code you posted, but i am have this run time error:
    Unable to create capture from .\..\..\..\M2U00253.MPG

    • I got it,the video was missing.

      I have another question, what should i do to run the program itself so it captures from the cam not from your video?
      Thank you!

      • @Soofta Thought these functions in openCV might help:
        CvCapture* cvCreateFileCapture( const char* filename );
        CvCapture* cvCreateCameraCapture( int index );
        void cvReleaseCapture( CvCapture** capture );

        • dear andol,
          I did not get the way you explained the way to use the web cam feed directly instead of the video can you please explain that in detail

  10. Dear ANDOL,
    Could you say please basically say how to match two images? in fact how to compare two images and say that they are same or different?

    • @Ponraju My thoughts are, if you can extract some key points from two images, them compare these key points, the differences between these two images can be told.

  11. Dear ANDOL,
    What U think that would be a primary problem that is unsolved in the field of image processing? Could you suggest some?

    • @Ponraju I think, the primary problem of computer vision, of course i guess, that is to make the computer to understand the visions captured through the camera or similar devices.

      • Ya that could be more general? But could you be specific please? So that solving them in near future make a big difference?

  12. Hey. We’re a group of 3 and are planning to do a project on hand gesture recognition. We’re final year Computer Science engineering students. Project duration is about 3 months or lesser. Completely unaware of OpenCV and OpenGl.
    What would you suggest we do?

1 2 3 5
Leave a comment
Due to technical adjustments, the comment function is shortly closed and will be re-openning soon. Thanks.

Copyrights 2006-2018 © All rights reserved
Theme Tree2, re-designed by Andol Li, powered by WordPress and Bootsrap
WWW.ANDOL.ME | 浙ICP备15040508号-1
公安备案图标 浙公网安备33010602004018号
Back to top