AsithaL
AsithaL

Reputation: 59

How to control a button using motion in opencv?

I want to control a button using hand motions. For example, in a video frame I create a circle-shaped button. Then when I move my hand to that circle I want to play an mp3 file, and when I move my hand to another circle the mp3 song stops playing. How can I do this? i am working in windows7 OS and i use microsoft visual studio 2008 for work...

Upvotes: 0

Views: 452

Answers (2)

Miguel Prada
Miguel Prada

Reputation: 96

You have infinite options to do that. Probably the easiest is trying to do background segmentation and then check if there's anything which is not background that overlaps with the button area. It would work with any part of your body, not only your hands, but that might not be an issue.

Another option would be to try to detect and track your hands based on skin color. For this you need to obtain an histogram of the skin color and then use it with the camshift tracker. A nice way to obtain the skin color on runtime would be running a face detector (haarcascade) and getting the color from the detected region.

I'm sure there are hundreds of additional ways to do it.

Also, if you can get your hands on a Kinect camera it could help a lot. Check OpenNI and the MS Kinect SDK to see what it enables you to do.

Upvotes: 1

rossb83
rossb83

Reputation: 1762

The first thing you will have to do is create a haar cascade xml file and train it on human hands.

Upvotes: 0

Related Questions