Example Code

Smart PC Control (Hand Tracking)

Code and Documents

Attachment

Hello Developers,

Here I have an exciting example which allows you to control your mouse cursor by tracking hand movements with a camera.

The VI makes use of the powerful IMAQ Optical Flow VI from the NI Vision Development Module to track location changes of pixels over consecutive frames.

From here, the program can be simply used to draw crosshairs on your hands and track their movement.

Alternatively, if the Control Mouse Mode (Control) on the Front Panel is True, then a user can take advantage of this feature tracking to interface with Cursor movement and simulate a Left-Click Event.

Instructions:

1. Select your Camera Hardware then run the VI and place your hands in the highlighted areas. Be careful the image is mirrored!

2. This will track your hand movement on-screen whilst drawing crosshairs on the points being tracked.

3. Stop the program and restart with the Control Mouse Mode (Control) set to True. You will go through the same 5 second hand calibration process as before however this time your Front Panel will become Transparent.

4. Now, your right hand movement will control the cursor whilst shaking the left will click!

5. If either of the tracked points go out of the camera's field of view you will be prompted to re-calibrate.

Have Fun!

fp.JPGBD.JPG

Jamie Jones
Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
woqiangzs
Member
Member
on

nice~

civil_engineer
Member
Member
on

Can you please save this project in Labview 2009? Thank you.

Truong Thanh Chung
ElmoSA
Member
Member
on

Hi, could you please save this in LV 2011? Thanks!

bmvalarezo1
Member
Member
on

hi maybe for 2010??

Contributors