Hand Gesture Recognition
Dependencies Overview
- OpenCV
- ROS Kinetic (Python 2.7 is required)
- A Camera connected to your device
How to Run
-
Copy this package into your workspace and run
catkin_make
. -
Simply Run
roslaunch gesture_teleop teleop.launch
. A window showing real time video from your laptop webcam will be activated. Place your hand into the region of interest (the green box) and your robot will take actions based on the number of fingers you show. - Two fingers: Drive forward
- Three fingers: Turn left
- Four fingers: Turn right
- Other: Stop
Brief Explaination towards the package
This package contains two nodes.
-
detect.py
: Recognize the number of fingers from webcam and publish a topic of typeString
stating the number of fingers. I won't get into details of the hand-gesture recognition algorithm. Basically, it extracts the hand in the region of insteret by background substraction and compute features to recognize the number of fingers. -
teleop.py
: Subscribe todetect.py
and take actions based on the number of fingers seen.
while not rospy.is_shutdown():
twist = Twist()
if fingers == '2':
twist.linear.x = 0.6
rospy.loginfo("driving forward")
elif fingers == '3':
twist.angular.z = 1
rospy.loginfo("turning left")
elif fingers =='4':
twist.angular.z = 1
rospy.loginfo("turning right")
else:
rospy.loginfo("stoped")
cmd_vel_pub.publish(twist)
rate.sleep()
Later Plan
- Using Kinect on mutant instead of local webcam.
- Furthermore, use depth camera to extract hand to get better quality images
- Incorporate Skeleton tracking into this package to better localize hands (I am using region of insterests to localize hands, which is a bit dumb).