SlideShare uma empresa Scribd logo
1 de 18
1
INTRODUCTION
● About Me?
– Besjan Xhika
– My Background
● What this Presentation il About?
– Gesture Recognition Devices
– My Experiments with Leap Motion
2
GESTURE RECOGNITION DEVICES
● BODY
– Kinect (Microsoft)
– Asus Xtion
– Carmine (PrimeSense)
– DS311 (SoftKinetic)
● HANDS
– Leap Motion
– Creative* Interactive Gesture
Camera (Intel)
– Capri (Embedded Solution,
PrimeSense)
– DS325 (SoftKinetic)
– MYO
3
LEAP MOTION
4
LEAP MOTION
● Detects and Tracks Hands, Fingers and Finger-Like Tools
● Reports Discrete Positions, Gestures and Motion
● The FOV is an Inverted Pyramid Centered on the Device
● The Effective Range Extends From 25 to 600 mm
● Employs a Right-Handed Cartesian Coordinate System
● Provides Updates as a Set or Frame of Data
● Leap Motion Visualizer
5
LEAP MOTION IN A
MEDICAL APPLICATION
● InVesalius is a Medical Software Used to Reconstruct
Structures of the Human Body
● The Leap Device Simulates the Mouse
● Python was Used
● Example Integration of Leap Motion with InVesalius
6
API OVERVIEW
The Applications can use the Leap API to Access the Data of Hands
and Fingers that the Device Captures One Frame at a Time
– Leap.Controller: The interface between the Leap and the application
– Leap.Listener: Used to handle events dispatched by the Leap
– Leap.Frame: Contains a set of hand and finger tracking data
– Leap.Hand: Contains tracking data for a detected hand
– Leap.Finger: Contains tracking data for a detected finger
– Leap.Vector: Represents a 3D position or directional vector
– Leap.Gesture: Represents a recognized gesture.
7
def main():
# Implements callback functions to handle events dispatched by the Leap
listener = Listener()
# The Controller class provides the main interface between the Leap and the application
controller = Leap.Controller()
# Allows the application to run in the background
controller.set_policy_flags(Leap.Controller.POLICY_BACKGROUND_FRAMES)
# Have the sample listener receive events from the controller
controller.add_listener(listener)
# Keep this process running until Enter is pressed
sys.stdin.readline()
# Remove the sample listener when done
controller.remove_listener(listener)
CREATING A CONTROLLER OBJECT
8
class Listener(Leap.Listener):
def on_init(self, controller):
# Dispatched once when the controller to which the listener is registered is initialized
print "Initialized"
def on_connect(self, controller):
# Dispatched when the controller connects to the Leap and is ready to begin sending
frames of motion tracking data
print "Connected"
# Enable gestures
controller.enable_gesture(Leap.Gesture.TYPE_CIRCLE)
def on_disconnect(self, controller):
# Dispatched if the controller disconnects from the Leap
print "Disconnected"
def on_exit(self, controller):
# Dispatched to a listener when it is removed from a controller
print "Exited"
def on_frame(self, controller):
# Dispatched when a new frame of motion tracking data is available
...
SUBCLASSING THE LISTENER CLASS
9
def on_frame(self, controller):
# Get the most recent frame
frame = controller.frame()
if not frame.hands.empty:
# MOUSE CURSOR
firstHand = frame.hands[0]
if not firstHand.fingers.empty:
xPos = 5*firstHand.palm_position.x + self.screenWidth/2
yPos = 1500 - (4*firstHand.palm_position.y - 300 + self.screenHeight/2)
ctypes.windll.user32.SetCursorPos(int(xPos), int(yPos))
GETTING A FRAME OF DATA (Part I)
10
# MOUSE CLICKS
secondHand = frame.hands[1]
if not secondHand.fingers.empty and len(secondHand.fingers) == 1:
for gesture in frame.gestures():
if gesture.type == Leap.Gesture.TYPE_CIRCLE:
circle = Leap.CircleGesture(gesture)
if circle.pointable.direction.angle_to(circle.normal) <= Leap.PI/4: clockwiseness = "clockwise"
else: clockwiseness = "counterclockwise"
if circle.state == Leap.Gesture.STATE_STOP:
# MOUSE CLICK
if clockwiseness == "clockwise":
print "MOUSE CLICK"
ctypes.windll.user32.mouse_event(0x0002, 0, 0, 0, 0)
ctypes.windll.user32.mouse_event(0x0004, 0, 0, 0, 0)
# MOUSE CLICK + HOLD
else:
if not self.leftclickHold:
print "CLICK + HOLD"
ctypes.windll.user32.mouse_event(0x0002, 0, 0, 0, 0)
else:
print "CLICK + RELEASE"
ctypes.windll.user32.mouse_event(0x0004, 0, 0, 0, 0)
self.leftclickHold = not self.leftclickHold
GETTING A FRAME OF DATA (Part II)
11
OTHER EXAMPLE
APPLICATIONS
12
VIDEO GAMES
13
ART
14
USER INTERFACES
15
GOOGLE EARTH
16
KEYBOARD
17
Q & A
18
THANK YOU
● Blog
– bxhika.wordpress.com
● Twitter
– @BesjanXhika
● E-Mail
– xhikab@gmail.com

Mais conteúdo relacionado

Destaque

Euclid powerpoint
Euclid powerpointEuclid powerpoint
Euclid powerpoint
41497777
 
Internet of Things and Big Data: Vision and Concrete Use Cases
Internet of Things and Big Data: Vision and Concrete Use CasesInternet of Things and Big Data: Vision and Concrete Use Cases
Internet of Things and Big Data: Vision and Concrete Use Cases
MongoDB
 

Destaque (10)

Euclid powerpoint
Euclid powerpointEuclid powerpoint
Euclid powerpoint
 
Leap motion
Leap motionLeap motion
Leap motion
 
Artificial eye
Artificial eyeArtificial eye
Artificial eye
 
Radar Application
Radar ApplicationRadar Application
Radar Application
 
artificial eye
artificial eyeartificial eye
artificial eye
 
radar technology
radar technologyradar technology
radar technology
 
Gesture recognition
Gesture recognitionGesture recognition
Gesture recognition
 
Internet of Things and Big Data: Vision and Concrete Use Cases
Internet of Things and Big Data: Vision and Concrete Use CasesInternet of Things and Big Data: Vision and Concrete Use Cases
Internet of Things and Big Data: Vision and Concrete Use Cases
 
Gesture recognition technology
Gesture recognition technology Gesture recognition technology
Gesture recognition technology
 
Gesture recognition using artificial neural network,a technology for identify...
Gesture recognition using artificial neural network,a technology for identify...Gesture recognition using artificial neural network,a technology for identify...
Gesture recognition using artificial neural network,a technology for identify...
 

Semelhante a Gesture recognition

2 track kinect@Bicocca - hardware e funzinamento
2   track kinect@Bicocca - hardware e funzinamento2   track kinect@Bicocca - hardware e funzinamento
2 track kinect@Bicocca - hardware e funzinamento
Matteo Valoriani
 
Modeling Motion in Matlab 7.19.11_v4_Taylor_KKedits
Modeling Motion in Matlab 7.19.11_v4_Taylor_KKeditsModeling Motion in Matlab 7.19.11_v4_Taylor_KKedits
Modeling Motion in Matlab 7.19.11_v4_Taylor_KKedits
Anthony Taylor
 

Semelhante a Gesture recognition (20)

Lidnug Presentation - Kinect - The How, Were and When of developing with it
Lidnug Presentation - Kinect - The How, Were and When of developing with itLidnug Presentation - Kinect - The How, Were and When of developing with it
Lidnug Presentation - Kinect - The How, Were and When of developing with it
 
Android
AndroidAndroid
Android
 
Leap Motion
Leap MotionLeap Motion
Leap Motion
 
2 track kinect@Bicocca - hardware e funzinamento
2   track kinect@Bicocca - hardware e funzinamento2   track kinect@Bicocca - hardware e funzinamento
2 track kinect@Bicocca - hardware e funzinamento
 
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
 
Android Jumpstart Jfokus
Android Jumpstart JfokusAndroid Jumpstart Jfokus
Android Jumpstart Jfokus
 
Oculus Rift DK2 + Leap Motion Tutorial
Oculus Rift DK2 + Leap Motion TutorialOculus Rift DK2 + Leap Motion Tutorial
Oculus Rift DK2 + Leap Motion Tutorial
 
Building Self-Defending Applications With OWASP AppSensor JavaOne 2016
Building Self-Defending Applications With OWASP AppSensor JavaOne 2016Building Self-Defending Applications With OWASP AppSensor JavaOne 2016
Building Self-Defending Applications With OWASP AppSensor JavaOne 2016
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
 
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)
 
QuantumLeap, a Framework for Engineering Gestural User Interfaces based on th...
QuantumLeap, a Framework for Engineering Gestural User Interfaces based on th...QuantumLeap, a Framework for Engineering Gestural User Interfaces based on th...
QuantumLeap, a Framework for Engineering Gestural User Interfaces based on th...
 
Android Lab Test : Using the sensor gyroscope (english)
Android Lab Test : Using the sensor gyroscope (english)Android Lab Test : Using the sensor gyroscope (english)
Android Lab Test : Using the sensor gyroscope (english)
 
Control Buggy using Leap Sensor Camera in Data Mining Domain
Control Buggy using Leap Sensor Camera in Data Mining DomainControl Buggy using Leap Sensor Camera in Data Mining Domain
Control Buggy using Leap Sensor Camera in Data Mining Domain
 
On the Development of A Real-Time Multi-Sensor Activity Recognition System
On the Development of A Real-Time Multi-Sensor Activity Recognition SystemOn the Development of A Real-Time Multi-Sensor Activity Recognition System
On the Development of A Real-Time Multi-Sensor Activity Recognition System
 
AllDayDevOps 2019 AppSensor
AllDayDevOps 2019 AppSensorAllDayDevOps 2019 AppSensor
AllDayDevOps 2019 AppSensor
 
Modeling Motion in Matlab 7.19.11_v4_Taylor_KKedits
Modeling Motion in Matlab 7.19.11_v4_Taylor_KKeditsModeling Motion in Matlab 7.19.11_v4_Taylor_KKedits
Modeling Motion in Matlab 7.19.11_v4_Taylor_KKedits
 
iCrOSS 2013_Pentest
iCrOSS 2013_PentestiCrOSS 2013_Pentest
iCrOSS 2013_Pentest
 
Track 1 session 1 - st dev con 2016 - contextual awareness
Track 1   session 1 - st dev con 2016 - contextual awarenessTrack 1   session 1 - st dev con 2016 - contextual awareness
Track 1 session 1 - st dev con 2016 - contextual awareness
 
Leap motion
Leap motionLeap motion
Leap motion
 
AppSensor Near Real-Time Event Detection and Response - DevNexus 2016
AppSensor Near Real-Time Event Detection and Response - DevNexus 2016AppSensor Near Real-Time Event Detection and Response - DevNexus 2016
AppSensor Near Real-Time Event Detection and Response - DevNexus 2016
 

Último

Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
drmarathore
 
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
amitlee9823
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
ehyxf
 
CHEAP Call Girls in Mayapuri (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Mayapuri  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Mayapuri  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Mayapuri (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
➥🔝 7737669865 🔝▻ Deoghar Call-girls in Women Seeking Men 🔝Deoghar🔝 Escorts...
➥🔝 7737669865 🔝▻ Deoghar Call-girls in Women Seeking Men  🔝Deoghar🔝   Escorts...➥🔝 7737669865 🔝▻ Deoghar Call-girls in Women Seeking Men  🔝Deoghar🔝   Escorts...
➥🔝 7737669865 🔝▻ Deoghar Call-girls in Women Seeking Men 🔝Deoghar🔝 Escorts...
amitlee9823
 
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in DammamAbortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
ahmedjiabur940
 
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get CytotecAbortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
CHEAP Call Girls in Ashok Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Ashok Nagar  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Ashok Nagar  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Ashok Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
amitlee9823
 
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
amitlee9823
 

Último (20)

Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
 
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
Vip Mumbai Call Girls Kalyan Call On 9920725232 With Body to body massage wit...
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
 
VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...
VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...
VVIP Pune Call Girls Gahunje WhatSapp Number 8005736733 With Elite Staff And ...
 
CHEAP Call Girls in Mayapuri (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Mayapuri  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Mayapuri  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Mayapuri (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
➥🔝 7737669865 🔝▻ Deoghar Call-girls in Women Seeking Men 🔝Deoghar🔝 Escorts...
➥🔝 7737669865 🔝▻ Deoghar Call-girls in Women Seeking Men  🔝Deoghar🔝   Escorts...➥🔝 7737669865 🔝▻ Deoghar Call-girls in Women Seeking Men  🔝Deoghar🔝   Escorts...
➥🔝 7737669865 🔝▻ Deoghar Call-girls in Women Seeking Men 🔝Deoghar🔝 Escorts...
 
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in DammamAbortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
Abortion Pill for sale in Riyadh ((+918761049707) Get Cytotec in Dammam
 
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
 
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get CytotecAbortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get Cytotec
 
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
 
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
 
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
HLH PPT.ppt very important topic to discuss
HLH PPT.ppt very important topic to discussHLH PPT.ppt very important topic to discuss
HLH PPT.ppt very important topic to discuss
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Deira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort Girls
Deira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort GirlsDeira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort Girls
Deira Dubai Escorts +0561951007 Escort Service in Dubai by Dubai Escort Girls
 
CHEAP Call Girls in Ashok Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Ashok Nagar  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Ashok Nagar  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Ashok Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
SM-N975F esquematico completo - reparación.pdf
SM-N975F esquematico completo - reparación.pdfSM-N975F esquematico completo - reparación.pdf
SM-N975F esquematico completo - reparación.pdf
 
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Banashankari Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
 

Gesture recognition

  • 1. 1 INTRODUCTION ● About Me? – Besjan Xhika – My Background ● What this Presentation il About? – Gesture Recognition Devices – My Experiments with Leap Motion
  • 2. 2 GESTURE RECOGNITION DEVICES ● BODY – Kinect (Microsoft) – Asus Xtion – Carmine (PrimeSense) – DS311 (SoftKinetic) ● HANDS – Leap Motion – Creative* Interactive Gesture Camera (Intel) – Capri (Embedded Solution, PrimeSense) – DS325 (SoftKinetic) – MYO
  • 4. 4 LEAP MOTION ● Detects and Tracks Hands, Fingers and Finger-Like Tools ● Reports Discrete Positions, Gestures and Motion ● The FOV is an Inverted Pyramid Centered on the Device ● The Effective Range Extends From 25 to 600 mm ● Employs a Right-Handed Cartesian Coordinate System ● Provides Updates as a Set or Frame of Data ● Leap Motion Visualizer
  • 5. 5 LEAP MOTION IN A MEDICAL APPLICATION ● InVesalius is a Medical Software Used to Reconstruct Structures of the Human Body ● The Leap Device Simulates the Mouse ● Python was Used ● Example Integration of Leap Motion with InVesalius
  • 6. 6 API OVERVIEW The Applications can use the Leap API to Access the Data of Hands and Fingers that the Device Captures One Frame at a Time – Leap.Controller: The interface between the Leap and the application – Leap.Listener: Used to handle events dispatched by the Leap – Leap.Frame: Contains a set of hand and finger tracking data – Leap.Hand: Contains tracking data for a detected hand – Leap.Finger: Contains tracking data for a detected finger – Leap.Vector: Represents a 3D position or directional vector – Leap.Gesture: Represents a recognized gesture.
  • 7. 7 def main(): # Implements callback functions to handle events dispatched by the Leap listener = Listener() # The Controller class provides the main interface between the Leap and the application controller = Leap.Controller() # Allows the application to run in the background controller.set_policy_flags(Leap.Controller.POLICY_BACKGROUND_FRAMES) # Have the sample listener receive events from the controller controller.add_listener(listener) # Keep this process running until Enter is pressed sys.stdin.readline() # Remove the sample listener when done controller.remove_listener(listener) CREATING A CONTROLLER OBJECT
  • 8. 8 class Listener(Leap.Listener): def on_init(self, controller): # Dispatched once when the controller to which the listener is registered is initialized print "Initialized" def on_connect(self, controller): # Dispatched when the controller connects to the Leap and is ready to begin sending frames of motion tracking data print "Connected" # Enable gestures controller.enable_gesture(Leap.Gesture.TYPE_CIRCLE) def on_disconnect(self, controller): # Dispatched if the controller disconnects from the Leap print "Disconnected" def on_exit(self, controller): # Dispatched to a listener when it is removed from a controller print "Exited" def on_frame(self, controller): # Dispatched when a new frame of motion tracking data is available ... SUBCLASSING THE LISTENER CLASS
  • 9. 9 def on_frame(self, controller): # Get the most recent frame frame = controller.frame() if not frame.hands.empty: # MOUSE CURSOR firstHand = frame.hands[0] if not firstHand.fingers.empty: xPos = 5*firstHand.palm_position.x + self.screenWidth/2 yPos = 1500 - (4*firstHand.palm_position.y - 300 + self.screenHeight/2) ctypes.windll.user32.SetCursorPos(int(xPos), int(yPos)) GETTING A FRAME OF DATA (Part I)
  • 10. 10 # MOUSE CLICKS secondHand = frame.hands[1] if not secondHand.fingers.empty and len(secondHand.fingers) == 1: for gesture in frame.gestures(): if gesture.type == Leap.Gesture.TYPE_CIRCLE: circle = Leap.CircleGesture(gesture) if circle.pointable.direction.angle_to(circle.normal) <= Leap.PI/4: clockwiseness = "clockwise" else: clockwiseness = "counterclockwise" if circle.state == Leap.Gesture.STATE_STOP: # MOUSE CLICK if clockwiseness == "clockwise": print "MOUSE CLICK" ctypes.windll.user32.mouse_event(0x0002, 0, 0, 0, 0) ctypes.windll.user32.mouse_event(0x0004, 0, 0, 0, 0) # MOUSE CLICK + HOLD else: if not self.leftclickHold: print "CLICK + HOLD" ctypes.windll.user32.mouse_event(0x0002, 0, 0, 0, 0) else: print "CLICK + RELEASE" ctypes.windll.user32.mouse_event(0x0004, 0, 0, 0, 0) self.leftclickHold = not self.leftclickHold GETTING A FRAME OF DATA (Part II)
  • 18. 18 THANK YOU ● Blog – bxhika.wordpress.com ● Twitter – @BesjanXhika ● E-Mail – xhikab@gmail.com