Monday 4 February 2013

Virtual Mouse using Hand gestures Matlab Code

1. Take a sample Video

2. Use any motion tracking algorithm like camshift or kalman to detect and track the motion of your hand movements.

Get code here : Motion detection and tracking matlab code


3. Now track the centroids

 like this ----
        bb = stats(object).BoundingBox;
        bc = stats(object).Centroid;

4. Now move the cursor as per centroids last recorded location

use this piece of code to move the cursor


         import java.awt.Robot;
         cursor = Robot;
         cursor.mouseMove(bc(1), bc(2));


5. Clicking mechanism :

Now where you want a clicking operation during motion detection use this code

import java.awt.Robot;
import java.awt.event.*;

cursor = Robot;

cursor.mousePress(InputEvent.BUTTON1_MASK);

For more hardware access help : Click here


1 comment:

  1. Grateful to check out your website... I seem to be ahead to more excellent sites, and I wish that you wrote more informative posts like this one. Thanks for sharing !

    ReplyDelete