report.tex 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046
  1. \documentclass[twoside,openright]{uva-bachelor-thesis}
  2. \usepackage[english]{babel}
  3. \usepackage[utf8]{inputenc}
  4. \usepackage{hyperref,graphicx,tikz,subfigure,float}
  5. % Link colors
  6. \hypersetup{colorlinks=true,linkcolor=black,urlcolor=blue,citecolor=DarkGreen}
  7. % Title Page
  8. \title{A generic architecture for gesture-based interaction}
  9. \author{Taddeüs Kroes}
  10. \supervisors{Dr. Robert G. Belleman (UvA)}
  11. \signedby{Dr. Robert G. Belleman (UvA)}
  12. \begin{document}
  13. % Title page
  14. \maketitle
  15. \begin{abstract}
  16. Applications that use complex gesture-based interaction need to translate
  17. primitive messages from low-level device drivers to complex, high-level
  18. gestures, and map these gestures to elements in an application. This report
  19. presents a generic architecture for the detection of complex gestures in an
  20. application. The architecture translates device driver messages to a common
  21. set of ``events''. The events are then delegated to a tree of ``event
  22. areas'', which are used to separate groups of events and assign these
  23. groups to an element in the application. Gesture detection is performed on
  24. a group of events assigned to an event area, using detection units called
  25. ``gesture tackers''. An implementation of the architecture as a daemon
  26. process would be capable of serving gestures to multiple applications at
  27. the same time. A reference implementation and two test case applications
  28. have been created to test the effectiveness of the architecture design.
  29. % TODO: conclusions
  30. \end{abstract}
  31. % Set paragraph indentation
  32. \parindent 0pt
  33. \parskip 1.5ex plus 0.5ex minus 0.2ex
  34. % Table of content on separate page
  35. \tableofcontents
  36. \chapter{Introduction}
  37. \label{chapter:introduction}
  38. Surface-touch devices have evolved from pen-based tablets to single-touch
  39. trackpads, to multi-touch devices like smartphones and tablets. Multi-touch
  40. devices enable a user to interact with software using hand gestures, making the
  41. interaction more expressive and intuitive. These gestures are more complex than
  42. primitive ``click'' or ``tap'' events that are used by single-touch devices.
  43. Some examples of more complex gestures are ``pinch''\footnote{A ``pinch''
  44. gesture is formed by performing a pinching movement with multiple fingers on a
  45. multi-touch surface. Pinch gestures are often used to zoom in or out on an
  46. object.} and ``flick''\footnote{A ``flick'' gesture is the act of grabbing an
  47. object and throwing it in a direction on a touch surface, giving it momentum to
  48. move for some time after the hand releases the surface.} gestures.
  49. The complexity of gestures is not limited to navigation in smartphones. Some
  50. multi-touch devices are already capable of recognizing objects touching the
  51. screen \cite[Microsoft Surface]{mssurface}. In the near future, touch screens
  52. will possibly be extended or even replaced with in-air interaction (Microsoft's
  53. Kinect \cite{kinect} and the Leap \cite{leap}).
  54. The interaction devices mentioned above generate primitive events. In the case
  55. of surface-touch devices, these are \emph{down}, \emph{move} and \emph{up}
  56. events. Application programmers who want to incorporate complex, intuitive
  57. gestures in their application face the challenge of interpreting these
  58. primitive events as gestures. With the increasing complexity of gestures, the
  59. complexity of the logic required to detect these gestures increases as well.
  60. This challenge limits, or even deters the application developer to use complex
  61. gestures in an application.
  62. The main question in this research project is whether a generic architecture
  63. for the detection of complex interaction gestures can be designed, with the
  64. capability of managing the complexity of gesture detection logic. The ultimate
  65. goal would be to create an implementation of this architecture that can be
  66. extended to support a wide range of complex gestures. With the existence of
  67. such an implementation, application developers do not need to reinvent gesture
  68. detection for every new gesture-based application.
  69. \section{Contents of this document}
  70. The scope of this thesis is limited to the detection of gestures on
  71. multi-touch surface devices. It presents a design for a generic gesture
  72. detection architecture for use in multi-touch based applications. A
  73. reference implementation of this design is used in some test case
  74. applications, whose purpose is to test the effectiveness of the design and
  75. detect its shortcomings.
  76. Chapter \ref{chapter:related} describes related work that inspired a design
  77. for the architecture. The design is presented in chapter
  78. \ref{chapter:design}. Chapter \ref{chapter:testapps} presents a reference
  79. implementation of the architecture, and two test case applications that
  80. show the practical use of its components as presented in chapter
  81. \ref{chapter:design}. Finally, some suggestions for future research on the
  82. subject are given in chapter \ref{chapter:futurework}.
  83. \chapter{Related work}
  84. \label{chapter:related}
  85. Applications that use gesture-based interaction need a graphical user
  86. interface (GUI) on which gestures can be performed. The creation of a GUI
  87. is a platform-specific task. For instance, Windows and Linux support
  88. different window managers. To create a window in a platform-independent
  89. application, the application would need to include separate functionalities
  90. for supported platforms. For this reason, GUI-based applications are often
  91. built on top of an application framework that abstracts platform-specific
  92. tasks. Frameworks often include a set of tools and events that help the
  93. developer to easily build advanced GUI widgets.
  94. % Existing frameworks (and why they're not good enough)
  95. Some frameworks, such as Nokia's Qt \cite{qt}, provide support for basic
  96. multi-touch gestures like tapping, rotation or pinching. However, the
  97. detection of gestures is embedded in the framework code in an inseparable
  98. way. Consequently, an application developer who wants to use multi-touch
  99. interaction in an application, is forced to use an application framework
  100. that includes support for those multi-touch gestures that are required by
  101. the application. Kivy \cite{kivy} is a GUI framework for Python
  102. applications, with support for multi-touch gestures. It uses a basic
  103. gesture detection algorithm that allows developers to define custom
  104. gestures to some degree \cite{kivygesture} using a set of touch point
  105. coordinates. However, these frameworks do not provide support for extension
  106. with custom complex gestures.
  107. Many frameworks are also device-specific, meaning that they are developed
  108. for use on either a tablet, smartphone, PC or other device. OpenNI
  109. \cite{OpenNI2010}, for example, provides API's for only natural interaction
  110. (NI) devices such as webcams and microphones. The concept of complex
  111. gesture-based interaction, however, is applicable to a much wider set of
  112. devices. VRPN \cite{VRPN} provides a software library that abstracts the
  113. output of devices, which enables it to support a wide set of devices used
  114. in Virtual Reality (VR) interaction. The framework makes the low-level
  115. events of these devices accessible in a client application using network
  116. communication. Gesture detection is not included in VRPN.
  117. % Methods of gesture detection
  118. The detection of high-level gestures from low-level events can be
  119. approached in several ways. GART \cite{GART} is a toolkit for the
  120. development of gesture-based applications, which states that the best way
  121. to classify gestures is to use machine learning. The programmer trains an
  122. application to recognize gestures using a machine learning library from the
  123. toolkit. Though multi-touch input is not directly supported by the toolkit,
  124. the level of abstraction does allow for it to be implemented in the form of
  125. a ``touch'' sensor. The reason to use machine learning is that gesture
  126. detection ``is likely to become increasingly complex and unmanageable''
  127. when using a predefined set of rules to detect whether some sensor input
  128. can be classified as a specific gesture.
  129. The alternative to machine learning is to define a predefined set of rules
  130. for each gesture. Manoj Kumar \cite{win7touch} presents a Windows 7
  131. application, written in Microsofts .NET, which detects a set of basic
  132. directional gestures based on the movement of a stylus. The complexity of
  133. the code is managed by the separation of different gesture types in
  134. different detection units called ``gesture trackers''. The application
  135. shows that predefined gesture detection rules do not necessarily produce
  136. unmanageable code.
  137. \section{Analysis of related work}
  138. Implementations for the support of complex gesture based interaction do
  139. already exist. However, gesture detection in these implementations is
  140. device-specific (Nokia Qt and OpenNI) or limited to use within an
  141. application framework (Kivy).
  142. An abstraction of device output allows VRPN and GART to support multiple
  143. devices. However, VRPN does not incorporate gesture detection. GART does,
  144. but only in the form of machine learning algorithms. Many applications for
  145. mobile phones and tablets only use simple gestures such as taps. For this
  146. category of applications, machine learning is an excessively complex method
  147. of gesture detection. Manoj Kumar shows that when managed well, a
  148. predefined set of gesture detection rules is sufficient to detect simple
  149. gestures.
  150. This thesis explores the possibility to create an architecture that
  151. combines support for multiple input devices with different methods of
  152. gesture detection.
  153. \chapter{Design}
  154. \label{chapter:design}
  155. % Diagrams are defined in a separate file
  156. \input{data/diagrams}
  157. \section{Introduction}
  158. Application frameworks are a necessity when it comes to fast,
  159. cross-platform development. A generic architecture design should aim to be
  160. compatible with existing frameworks, and provide a way to detect and extend
  161. gestures independent of the framework. Since an application framework is
  162. written in a specific programming language, the architecture should be
  163. accessible for applications using a language-independent method of
  164. communication. This intention leads towards the concept of a dedicated
  165. gesture detection application that serves gestures to multiple applications
  166. at the same time.
  167. This chapter describes a design for such an architecture. The architecture
  168. components are shown by figure \ref{fig:fulldiagram}. Sections
  169. \ref{sec:multipledrivers} to \ref{sec:daemon} explain the use of all
  170. components in detail.
  171. \fulldiagram
  172. \newpage
  173. \section{Supporting multiple drivers}
  174. \label{sec:multipledrivers}
  175. The TUIO protocol \cite{TUIO} is an example of a driver that can be used by
  176. multi-touch devices. TUIO uses ALIVE- and SET-messages to communicate
  177. low-level touch events (see appendix \ref{app:tuio} for more details).
  178. These messages are specific to the API of the TUIO protocol. Other drivers
  179. may use different messages types. To support more than one driver in the
  180. architecture, there must be some translation from device-specific messages
  181. to a common format for primitive touch events. After all, the gesture
  182. detection logic in a ``generic'' architecture should not be implemented
  183. based on device-specific messages. The event types in this format should be
  184. chosen so that multiple drivers can trigger the same events. If each
  185. supported driver would add its own set of event types to the common format,
  186. the purpose of it being ``common'' would be defeated.
  187. A minimal expectation for a touch device driver is that it detects simple
  188. touch points, with a ``point'' being an object at an $(x, y)$ position on
  189. the touch surface. This yields a basic set of events: $\{point\_down,
  190. point\_move, point\_up\}$.
  191. The TUIO protocol supports fiducials\footnote{A fiducial is a pattern used
  192. by some touch devices to identify objects.}, which also have a rotational
  193. property. This results in a more extended set: $\{point\_down, point\_move,
  194. point\_up, object\_down, object\_move, object\_up,\\ object\_rotate\}$.
  195. Due to their generic nature, the use of these events is not limited to the
  196. TUIO protocol. Another driver that can keep apart rotated objects from
  197. simple touch points could also trigger them.
  198. The component that translates device-specific messages to common events, is
  199. called the \emph{event driver}. The event driver runs in a loop, receiving
  200. and analyzing driver messages. When a sequence of messages is analyzed as
  201. an event, the event driver delegates the event to other components in the
  202. architecture for translation to gestures.
  203. Support for a touch driver can be added by adding an event driver
  204. implementation. The choice of event driver implementation that is used in an
  205. application is dependent on the driver support of the touch device being
  206. used.
  207. Because event driver implementations have a common output format in the
  208. form of events, multiple event drivers can be used at the same time (see
  209. figure \ref{fig:multipledrivers}). This design feature allows low-level
  210. events from multiple devices to be aggregated into high-level gestures.
  211. \multipledriversdiagram
  212. \section{Event areas: connecting gesture events to widgets}
  213. \label{sec:areas}
  214. Touch input devices are unaware of the graphical input
  215. widgets\footnote{``Widget'' is a name commonly used to identify an element
  216. of a graphical user interface (GUI).} rendered by an application, and
  217. therefore generate events that simply identify the screen location at which
  218. an event takes place. User interfaces of applications that do not run in
  219. full screen modus are contained in a window. Events which occur outside the
  220. application window should not be handled by the application in most cases.
  221. What's more, a widget within the application window itself should be able
  222. to respond to different gestures. E.g. a button widget may respond to a
  223. ``tap'' gesture to be activated, whereas the application window responds to
  224. a ``pinch'' gesture to be resized. In order to restrict the occurence of a
  225. gesture to a particular widget in an application, the events used for the
  226. gesture must be restricted to the area of the screen covered by that
  227. widget. An important question is if the architecture should offer a
  228. solution to this problem, or leave the task of assigning gestures to
  229. application widgets to the application developer.
  230. If the architecture does not provide a solution, the ``gesture detection''
  231. component in figure \ref{fig:fulldiagram} receives all events that occur on
  232. the screen surface. The gesture detection logic thus uses all events as
  233. input to detect a gesture. This leaves no possibility for a gesture to
  234. occur at multiple screen positions at the same time. The problem is
  235. illustrated in figure \ref{fig:ex1}, where two widgets on the screen can be
  236. rotated independently. The rotation detection component that detects
  237. rotation gestures receives all four fingers as input. If the two groups of
  238. finger events are not separated by clustering them based on the area in
  239. which they are placed, only one rotation event will occur.
  240. \examplefigureone
  241. A gesture detection component could perform a heuristic way of clustering
  242. based on the distance between events. However, this method cannot guarantee
  243. that a cluster of events corresponds with a particular application widget.
  244. In short, a gesture detection component is difficult to implement without
  245. awareness of the location of application widgets. Secondly, the
  246. application developer still needs to direct gestures to a particular widget
  247. manually. This requires geometric calculations in the application logic,
  248. which is a tedious and error-prone task for the developer.
  249. The architecture described here groups events that occur inside the area
  250. covered by a widget, before passing them on to a gesture detection
  251. component. Different gesture detection components can then detect gestures
  252. simultaneously, based on different sets of input events. An area of the
  253. screen surface is represented by an \emph{event area}. An event area
  254. filters input events based on their location, and then delegates events to
  255. gesture detection components that are assigned to the event area. Events
  256. which are located outside the event area are not delegated to its gesture
  257. detection components.
  258. In the example of figure \ref{fig:ex1}, the two rotatable widgets can be
  259. represented by two event areas, each having a different rotation detection
  260. component. Each event area can consist of four corner locations of the
  261. square it represents. To detect whether an event is located inside a
  262. square, the event areas use a point-in-polygon (PIP) test \cite{PIP}. It is
  263. the task of the client application to update the corner locations of the
  264. event area with those of the widget.
  265. \subsection{Callback mechanism}
  266. When a gesture is detected by a gesture detection component, it must be
  267. handled by the client application. A common way to handle events in an
  268. application is a ``callback'' mechanism: the application developer binds a
  269. function to an event, that is called when the event occurs. Because of the
  270. familiarity of this concept with developers, the architecture uses a
  271. callback mechanism to handle gestures in an application. Callback handlers
  272. are bound to event areas, since event areas control the grouping of events
  273. and thus the occurrence of gestures in an area of the screen.
  274. \subsection{Area tree}
  275. \label{sec:tree}
  276. A basic data structure of event areas in the architecture would be a list
  277. of event areas. When the event driver delegates an event, it is accepted by
  278. each event area that contains the event coordinates.
  279. If the architecture were to be used in combination with an application
  280. framework, each widget that responds to gestures should have a mirroring
  281. event area that synchronizes its location with that of the widget. Consider
  282. a panel with five buttons that all listen to a ``tap'' event. If the
  283. location of the panel changes as a result of movement of the application
  284. window, the positions of all buttons have to be updated too.
  285. This process is simplified by the arrangement of event areas in a tree
  286. structure. A root event area represents the panel, containing five other
  287. event areas which are positioned relative to the root area. The relative
  288. positions do not need to be updated when the panel area changes its
  289. position. GUI frameworks use this kind of tree structure to manage
  290. graphical widgets.
  291. If the GUI toolkit provides an API for requesting the position and size of
  292. a widget, a recommended first step when developing an application is to
  293. create a subclass of the area that automatically synchronizes with the
  294. position of a widget from the GUI framework. For example, the test
  295. application described in section \ref{sec:testapp} extends the GTK
  296. \cite{GTK} application window widget with the functionality of a
  297. rectangular event area, to direct touch events to an application window.
  298. \subsection{Event propagation}
  299. \label{sec:eventpropagation}
  300. Another problem occurs when event areas overlap, as shown by figure
  301. \ref{fig:eventpropagation}. When the white square is dragged, the gray
  302. square should stay at its current position. This means that events that are
  303. used for dragging of the white square, should not be used for dragging of
  304. the gray square. The use of event areas alone does not provide a solution
  305. here, since both the gray and the white event area accept an event that
  306. occurs within the white square.
  307. The problem described above is a common problem in GUI applications, and
  308. there is a common solution (used by GTK \cite{gtkeventpropagation}, among
  309. others). An event is passed to an ``event handler''. If the handler returns
  310. \texttt{true}, the event is considered ``handled'' and is not
  311. ``propagated'' to other widgets. Applied to the example of the draggable
  312. squares, the rotation detection component of the white square should stop
  313. the propagation of events to the event area of the gray square.
  314. In the example, rotation of the white square has priority over rotation of
  315. the gray square because the white area is the widget actually being touched
  316. at the screen surface. In general, events should be delegated to event
  317. areas according to the order in which the event areas are positioned over
  318. each other. The tree structure in which event areas are arranged, is an
  319. ideal tool to determine the order in which an event is delegated. An
  320. object touching the screen is essentially touching the deepest event area
  321. in the tree that contains the triggered event, which must be the first to
  322. receive the event. When the gesture trackers of the event area are
  323. finished with the event, it is propagated to the siblings and parent in the
  324. event area tree. Optionally, a gesture tracker can stop the propagation of
  325. the event by its corresponding event area. Figure
  326. \ref{fig:eventpropagation} demonstrates event propagation in the example of
  327. the draggable squares.
  328. \eventpropagationfigure
  329. An additional type of event propagation is ``immediate propagation'', which
  330. indicates propagation of an event from one gesture detection component to
  331. another. This is applicable when an event area uses more than one gesture
  332. detection component. When regular propagation is stopped, the event is
  333. propagated to other gesture detection components first, before actually
  334. being stopped. One of the components can also stop the immediate
  335. propagation of an event, so that the event is not passed to the next
  336. gesture detection component, nor to the ancestors of the event area.
  337. The concept of an event area is based on the assumption that the set of
  338. originating events that form a particular gesture, can be determined
  339. exclusively based on the location of the events. This is a reasonable
  340. assumption for simple touch objects whose only parameter is a position,
  341. such as a pen or a human finger. However, more complex touch objects can
  342. have additional parameters, such as rotational orientation or color. An
  343. even more generic concept is the \emph{event filter}, which detects whether
  344. an event should be assigned to a particular gesture detection component
  345. based on all available parameters. This level of abstraction provides
  346. additional methods of interaction. For example, a camera-based multi-touch
  347. surface could make a distinction between gestures performed with a blue
  348. gloved hand, and gestures performed with a green gloved hand.
  349. As mentioned in the introduction chapter [\ref{chapter:introduction}], the
  350. scope of this thesis is limited to multi-touch surface based devices, for
  351. which the \emph{event area} concept suffices. Section \ref{sec:eventfilter}
  352. explores the possibility of event areas to be replaced with event filters.
  353. \section{Detecting gestures from low-level events}
  354. \label{sec:gesture-detection}
  355. The low-level events that are grouped by an event area must be translated
  356. to high-level gestures in some way. Simple gestures, such as a tap or the
  357. dragging of an element using one finger, are easy to detect by comparing
  358. the positions of sequential $point\_down$ and $point\_move$ events. More
  359. complex gestures, like the writing of a character from the alphabet,
  360. require more advanced detection algorithms.
  361. Sequences of events that are triggered by a multi-touch based surfaces are
  362. often of a manageable complexity. An imperative programming style is
  363. sufficient to detect many common gestures, like rotation and dragging. The
  364. imperative programming style is also familiar and understandable for a wide
  365. range of application developers. Therefore, the architecture should support
  366. this style of gesture detection. A problem with an imperative programming
  367. style is that the explicit detection of different gestures requires
  368. different gesture detection components. If these components are not managed
  369. well, the detection logic is prone to become chaotic and over-complex.
  370. A way to detect more complex gestures based on a sequence of input events,
  371. is with the use of machine learning methods, such as the Hidden Markov
  372. Models (HMM)\footnote{A Hidden Markov Model (HMM) is a statistical model
  373. without a memory, it can be used to detect gestures based on the current
  374. input state alone.} used for sign language detection by Gerhard Rigoll et
  375. al. \cite{conf/gw/RigollKE97}. A sequence of input states can be mapped to
  376. a feature vector that is recognized as a particular gesture with a certain
  377. probability. An advantage of using machine learning with respect to an
  378. imperative programming style, is that complex gestures are described
  379. without the use of explicit detection logic, thus reducing code complexity.
  380. For example, the detection of the character `A' being written on the screen
  381. is difficult to implement using explicit detection code, whereas a trained
  382. machine learning system can produce a match with relative ease.
  383. To manage complexity and support multiple styles of gesture detection
  384. logic, the architecture has adopted the tracker-based design as described
  385. by Manoj Kumar \cite{win7touch}. Different detection components are wrapped
  386. in separate gesture tracking units called \emph{gesture trackers}. The
  387. input of a gesture tracker is provided by an event area in the form of
  388. events. Each gesture detection component is wrapped in a gesture tracker
  389. with a fixed type of input and output. Internally, the gesture tracker can
  390. adopt any programming style. A character recognition component can use an
  391. HMM, whereas a tap detection component defines a simple function that
  392. compares event coordinates.
  393. When a gesture tracker detects a gesture, this gesture is triggered in the
  394. corresponding event area. The event area then calls the callbacks which are
  395. bound to the gesture type by the application.
  396. The use of gesture trackers as small detection units allows extendability
  397. of the architecture. A developer can write a custom gesture tracker and
  398. register it in the architecture. The tracker can use any type of detection
  399. logic internally, as long as it translates low-level events to high-level
  400. gestures.
  401. An example of a possible gesture tracker implementation is a
  402. ``transformation tracker'' that detects rotation, scaling and translation
  403. gestures.
  404. \section{Serving multiple applications}
  405. \label{sec:daemon}
  406. The design of the architecture is essentially complete with the components
  407. specified in this chapter. However, one specification has not yet been
  408. discussed: the ability to address the architecture using a method of
  409. communication independent of the application's programming language.
  410. If the architecture and a gesture-based application are written in the same
  411. language, the main loop of the architecture can run in a separate thread of
  412. the application. If the application is written in a different language, the
  413. architecture has to run in a separate process. Since the application needs
  414. to respond to gestures that are triggered by the architecture, there must
  415. be a communication layer between the separate processes.
  416. A common and efficient way of communication between two separate processes
  417. is through the use of a network protocol. In this particular case, the
  418. architecture can run as a daemon\footnote{``daemon'' is a name Unix uses to
  419. indicate that a process runs as a background process.} process, listening
  420. to driver messages and triggering gestures in registered applications.
  421. \vspace{-0.3em}
  422. \daemondiagram
  423. An advantage of a daemon setup is that it can serve multiple applications
  424. at the same time. Alternatively, each application that uses gesture
  425. interaction would start its own instance of the architecture in a separate
  426. process, which would be less efficient. The network communication layer
  427. also allows the architecture and a client application to run on separate
  428. machines, thus distributing computational load. The other machine may even
  429. use a different operating system.
  430. %\section{Example usage}
  431. %\label{sec:example}
  432. %
  433. %This section describes an extended example to illustrate the data flow of
  434. %the architecture. The example application listens to tap events on a button
  435. %within an application window. The window also contains a draggable circle.
  436. %The application window can be resized using \emph{pinch} gestures. Figure
  437. %\ref{fig:examplediagram} shows the architecture created by the pseudo code
  438. %below.
  439. %
  440. %\begin{verbatim}
  441. %initialize GUI framework, creating a window and nessecary GUI widgets
  442. %
  443. %create a root event area that synchronizes position and size with the application window
  444. %define 'rotation' gesture handler and bind it to the root event area
  445. %
  446. %create an event area with the position and radius of the circle
  447. %define 'drag' gesture handler and bind it to the circle event area
  448. %
  449. %create an event area with the position and size of the button
  450. %define 'tap' gesture handler and bind it to the button event area
  451. %
  452. %create a new event server and assign the created root event area to it
  453. %
  454. %start the event server in a new thread
  455. %start the GUI main loop in the current thread
  456. %\end{verbatim}
  457. %
  458. %\examplediagram
  459. \chapter{Implementation and test applications}
  460. \label{chapter:testapps}
  461. A reference implementation of the design has been written in Python. Two test
  462. applications have been created to test if the design ``works'' in a practical
  463. application, and to detect its flaws. One application is mainly used to test
  464. the gesture tracker implementations. The other application uses multiple event
  465. areas in a tree structure, demonstrating event delegation and propagation. The
  466. second application also defines a custom gesture tracker.
  467. To test multi-touch interaction properly, a multi-touch device is required. The
  468. University of Amsterdam (UvA) has provided access to a multi-touch table from
  469. PQlabs. The table uses the TUIO protocol \cite{TUIO} to communicate touch
  470. events. See appendix \ref{app:tuio} for details regarding the TUIO protocol.
  471. %The reference implementation and its test applications are a Proof of Concept,
  472. %meant to show that the architecture design is effective.
  473. %that translates TUIO messages to some common multi-touch gestures.
  474. \section{Reference implementation}
  475. \label{sec:implementation}
  476. The reference implementation is written in Python and available at
  477. \cite{gitrepos}. The following component implementations are included:
  478. \textbf{Event drivers}
  479. \begin{itemize}
  480. \item TUIO driver, using only the support for simple touch points with an
  481. $(x, y)$ position.
  482. \end{itemize}
  483. \textbf{Event areas}
  484. \begin{itemize}
  485. \item Circular area
  486. \item Rectangular area
  487. \item Polygon area
  488. \item Full screen area
  489. \end{itemize}
  490. \textbf{Gesture trackers}
  491. \begin{itemize}
  492. \item Basic tracker, supports $point\_down,~point\_move,~point\_up$ gestures.
  493. \item Tap tracker, supports $tap,~single\_tap,~double\_tap$ gestures.
  494. \item Transformation tracker, supports $rotate,~pinch,~drag,~flick$ gestures.
  495. \end{itemize}
  496. The implementation does not include a network protocol to support the daemon
  497. setup as described in section \ref{sec:daemon}. Therefore, it is only usable in
  498. Python programs. The two test programs are also written in Python.
  499. The event area implementations contain some geometric functions to determine
  500. whether an event should be delegated to an event area. All gesture trackers
  501. have been implemented using an imperative programming style. Sections
  502. \ref{sec:basictracker} to \ref{sec:transformationtracker} describe the gesture
  503. tracker implementations in detail.
  504. \subsection{Basic tracker}
  505. \label{sec:basictracker}
  506. The ``basic tracker'' implementation exists only to provide access to low-level
  507. events in an application. Low-level events are only handled by gesture
  508. trackers, not by the application itself. Therefore, the basic tracker maps
  509. \emph{point\_\{down,move,up\}} events to equally named gestures that can be
  510. handled by the application.
  511. \subsection{Tap tracker}
  512. \label{sec:taptracker}
  513. The ``tap tracker'' detects three types of tap gestures:
  514. \begin{enumerate}
  515. \item The basic \emph{tap} gesture is triggered when a touch point releases
  516. the touch surface within a certain time and distance of its initial
  517. position. When a \emph{point\_down} event is received, its location is
  518. saved along with the current timestamp. On the next \emph{point\_up}
  519. event of the touch point, the difference in time and position with its
  520. saved values are compared with predefined thresholds to determine
  521. whether a \emph{tap} gesture should be triggered.
  522. \item A \emph{double tap} gesture consists of two sequential \emph{tap}
  523. gestures that are located within a certain distance of each other, and
  524. occur within a certain time window. When a \emph{tap} gesture is
  525. triggered, the tracker saves it as the ``last tap'' along with the
  526. current timestamp. When another \emph{tap} gesture is triggered, its
  527. location and the current timestamp are compared with those of the
  528. ``last tap'' gesture to determine whether a \emph{double tap} gesture
  529. should be triggered. If so, the gesture is triggered at the location of
  530. the ``last tap'', because the second tap may be less accurate.
  531. \item A separate thread handles detection of \emph{single tap} gestures at
  532. a rate of thirty times per second. When the time since the ``last tap''
  533. exceeds the maximum time between two taps of a \emph{double tap}
  534. gesture, a \emph{single tap} gesture is triggered.
  535. \end{enumerate}
  536. The \emph{single tap} gesture exists to be able to make a distinction between
  537. single and double tap gestures. This distinction is not possible with the
  538. regular \emph{tap} gesture, since the first \emph{tap} gesture has already been
  539. handled by the application when the second \emph{tap} of a \emph{double tap}
  540. gesture is triggered.
  541. \subsection{Transformation tracker}
  542. \label{sec:transformationtracker}
  543. The transformation tracker triggers \emph{rotate}, \emph{pinch}, \emph{drag}
  544. and \emph{flick} gestures. These gestures use the centroid of all touch points.
  545. A \emph{rotate} gesture uses the difference in angle relative to the centroid
  546. of all touch points, and \emph{pinch} uses the difference in distance. Both
  547. values are normalized using division by the number of touch points $N$. A
  548. \emph{pinch} gesture contains a scale factor, and therefore uses a division of
  549. the current by the previous average distance to the centroid. Any movement of
  550. the centroid is used for \emph{drag} gestures. When a dragged touch point is
  551. released, a \emph{flick} gesture is triggered in the direction of the
  552. \emph{drag} gesture.
  553. Figure \ref{fig:transformationtracker} shows an example situation in which a
  554. touch point is moved, triggering a \emph{pinch} gesture, a \emph{rotate}
  555. gesture and a \emph{drag} gesture.
  556. \transformationtracker
  557. The \emph{pinch} gesture in figure \ref{fig:pinchrotate} uses the ratio
  558. $d_2:d_1$ to calculate its $scale$ parameter. Note that the difference in
  559. distance $d_2 - d_1$ and the difference in angle $\alpha$ both relate to a
  560. single touch point. The \emph{pinch} and \emph{rotate} gestures that are
  561. triggered relate to all touch points, using the average of distances and
  562. angles. Since all except one of the touch points have not moved, their
  563. differences in distance and angle are zero. Thus, the averages can be
  564. calculated by dividing the differences in distance and angle of the moved touch
  565. point by the number of touch points $N$. The $scale$ parameter represents the
  566. scale relative to the previous situation, which results in the following
  567. formula:
  568. $$pinch.scale = \frac{d_1 + \frac{d_2 - d_1}{N}}{d_1}$$
  569. The angle used for the \emph{rotate} gesture is only divided by the number of
  570. touch points to obtain an average rotation of all touch points:
  571. $$rotate.angle = \frac{\alpha}{N}$$
  572. \section{Full screen Pygame application}
  573. %The goal of this application was to experiment with the TUIO
  574. %protocol, and to discover requirements for the architecture that was to be
  575. %designed. When the architecture design was completed, the application was rewritten
  576. %using the new architecture components. The original variant is still available
  577. %in the ``experimental'' folder of the Git repository \cite{gitrepos}.
  578. An implementation of the detection of some simple multi-touch gestures (single
  579. tap, double tap, rotation, pinch and drag) using Processing\footnote{Processing
  580. is a Java-based programming environment with an export possibility for Android.
  581. See also \cite{processing}.} can be found in a forum on the Processing website
  582. \cite{processingMT}. The application has been ported to Python and adapted to
  583. receive input from the TUIO protocol. The implementation is fairly simple, but
  584. it yields some appealing results (see figure \ref{fig:draw}). In the original
  585. application, the detection logic of all gestures is combined in a single class
  586. file. As predicted by the GART article \cite{GART}, this leads to over-complex
  587. code that is difficult to read and debug.
  588. The original application code consists of two main classes. The ``multi-touch
  589. server'' starts a ``TUIO server'' that translates TUIO events to ``point
  590. \{down,move,up\}'' events. Detection of ``tap'' and ``double tap'' gestures is
  591. performed immediately after an event is received. Other gesture detection runs
  592. in a separate thread, using the following loop:
  593. \begin{verbatim}
  594. 60 times per second do:
  595. detect `single tap' based on the time since the latest `tap' gesture
  596. if points have been moved, added or removed since last iteration do:
  597. calculate the centroid of all points
  598. detect `drag' using centroid movement
  599. detect `rotation' using average orientation of all points to centroid
  600. detect `pinch' using average distance of all points to centroid
  601. \end{verbatim}
  602. There are two problems with the implementation described above. In the first
  603. place, low-level events are not grouped before gesture detection. The gesture
  604. detection uses all events for a single gesture. Therefore, only one element at
  605. a time can be rotated/resized etc. (see also section \ref{sec:areas}).
  606. Secondly, all detection code is located in the same class file. To extend the
  607. application with new gestures, a programmer must extend the code in this class
  608. file and therefore understand its structure. Since the main loop calls specific
  609. gesture detection components explicitly in a certain order, the programmer must
  610. alter the main loop to call custom gesture detection code. This is a problem
  611. because this way of extending code is not scalable over time. The class file
  612. would become more and more complex when extended with new gestures. The two
  613. problems have been solved using event areas and gesture trackers from the
  614. reference implementation. The gesture detection code has been separated into
  615. two different gesture trackers, which are the ``tap'' and ``transformation''
  616. trackers mentioned in section \ref{sec:implementation}.
  617. The positions of all touch objects and their centroid are drawn using the
  618. Pygame library. Since the Pygame library does not provide support to find the
  619. location of the display window, the root event area captures events in the
  620. entire screen surface. The application can be run either full screen or in
  621. windowed mode. If windowed, screen-wide gesture coordinates are mapped to the
  622. size of the Pyame window. In other words, the Pygame window always represents
  623. the entire touch surface. The output of the application can be seen in figure
  624. \ref{fig:draw}.
  625. \begin{figure}[h!]
  626. \center
  627. \includegraphics[scale=0.4]{data/pygame_draw.png}
  628. \caption{Output of the experimental drawing program. It draws all touch
  629. points and their centroid on the screen (the centroid is used for rotation
  630. and pinch detection). It also draws a green rectangle which responds to
  631. rotation and pinch events.}
  632. \label{fig:draw}
  633. \end{figure}
  634. \section{GTK+/Cairo application}
  635. \label{sec:testapp}
  636. The second test application uses the GIMP toolkit (GTK+) \cite{GTK} to create
  637. its user interface. Since GTK+ defines a main event loop that is started in
  638. order to use the interface, the architecture implementation runs in a separate
  639. thread.
  640. The application creates a main window, whose size and position are synchronized
  641. with the root event area of the architecture. The synchronization is handled
  642. automatically by a \texttt{GtkEventWindow} object, which is a subclass of
  643. \texttt{gtk.Window}. This object serves as a layer that connects the event area
  644. functionality of the architecture to GTK+ windows. The following Python code
  645. captures the essence of the synchronization layer:
  646. \begin{verbatim}
  647. class GtkEventWindow(Window):
  648. def __init__(self, width, height):
  649. Window.__init__(self)
  650. # Create an event area to represent the GTK window in the gesture
  651. # detection architecture
  652. self.area = RectangularArea(0, 0, width, height)
  653. # The "configure-event" signal is triggered by GTK when the position or
  654. # size of the window are updated
  655. self.connect("configure-event", self.sync_area)
  656. def sync_area(self, win, event):
  657. # Synchronize the position and size of the event area with that of the
  658. # GTK window
  659. self.area.width = event.width
  660. self.area.height = event.height
  661. self.area.set_position(*event.get_coords())
  662. \end{verbatim}
  663. The application window contains a number of polygons which can be dragged,
  664. resized and rotated. Each polygon is represented by a separate event area to
  665. allow simultaneous interaction with different polygons. The main window also
  666. responds to transformation, by transforming all polygons. Additionally, double
  667. tapping on a polygon changes its color.
  668. An ``overlay'' event area is used to detect all fingers currently touching the
  669. screen. The application defines a custom gesture tracker, called the ``hand
  670. tracker'', which is used by the overlay. The hand tracker uses distances
  671. between detected fingers to detect which fingers belong to the same hand (see
  672. section \ref{sec:handtracker} for details). The application draws a line from
  673. each finger to the hand it belongs to, as visible in figure \ref{fig:testapp}.
  674. \begin{figure}[h!]
  675. \center
  676. \includegraphics[scale=0.32]{data/testapp.png}
  677. \caption{
  678. Screenshot of the second test application. Two polygons can be dragged,
  679. rotated and scaled. Separate groups of fingers are recognized as hands,
  680. each hand is drawn as a centroid with a line to each finger.
  681. }
  682. \label{fig:testapp}
  683. \end{figure}
  684. To manage the propagation of events used for transformations and tapping, the
  685. applications arranges its event areas in a tree structure as described in
  686. section \ref{sec:tree}. Each transformable event area has its own
  687. ``transformation tracker'', which stops the propagation of events used for
  688. transformation gestures. Because the propagation of these events is stopped,
  689. overlapping polygons do not cause a problem. Figure \ref{fig:testappdiagram}
  690. shows the tree structure used by the application.
  691. \testappdiagram
  692. Note that the overlay event area, though covering the entire screen surface, is
  693. not used as the root of the event area tree. Instead, the overlay is placed on
  694. top of the application window (being a rightmost sibling of the application
  695. window event area in the tree). This is necessary, because the transformation
  696. trackers in the application window stop the propagation of events. The hand
  697. tracker needs to capture all events to be able to give an accurate
  698. representations of all fingers touching the screen Therefore, the overlay
  699. should delegate events to the hand tracker before they are stopped by a
  700. transformation tracker. Placing the overlay over the application window forces
  701. the screen event area to delegate events to the overlay event area first. The
  702. event area implementation delegates events to its children in right-to left
  703. order, because area's that are added to the tree later are assumed to be
  704. positioned over their previously added siblings.
  705. \subsection{Hand tracker}
  706. \label{sec:handtracker}
  707. The hand tracker sees each touch point as a finger. Based on a predefined
  708. distance threshold, each finger is assigned to a hand. Each hand consists of a
  709. list of finger locations, and the centroid of those locations.
  710. When a new finger is detected on the touch surface (a \emph{point\_down} event),
  711. the distance from that finger to all hand centroids is calculated. The hand to
  712. which the distance is the shortest can be the hand that the finger belongs to.
  713. If the distance is larger than the predefined distance threshold, the finger is
  714. assumed to be a new hand and \emph{hand\_down} gesture is triggered. Otherwise,
  715. the finger is assigned to the closest hand. In both cases, a
  716. \emph{finger\_down} gesture is triggered.
  717. Each touch point is assigned an ID by the reference implementation. When the
  718. hand tracker assigns a finger to a hand after a \emph{point\_down} event, its
  719. touch point ID is saved in a hash map\footnote{In computer science, a hash
  720. table or hash map is a data structure that uses a hash function to map
  721. identifying values, known as keys (e.g., a person's name), to their associated
  722. values (e.g., their telephone number). Source:
  723. \url{http://en.wikipedia.org/wiki/Hashmap}} with the \texttt{Hand} object. When
  724. a finger moves (a \emph{point\_move} event) or releases the touch surface
  725. (\emph{point\_up}), The corresponding hand is loaded from the hash map and
  726. triggers a \emph{finger\_move} or \emph{finger\_up} gesture. If a released
  727. finger is the last of a hand, that hand is removed with a \emph{hand\_up}
  728. gesture.
  729. \section{Results}
  730. \label{sec:results}
  731. % TODO: Evalueer of de implementatie en testapplicaties voldoen aan de
  732. % verwachtingen/eisen die je hebt gesteld in je ontwerp.
  733. \chapter{Conclusions}
  734. \label{chapter:conclusions}
  735. To support different devices, there must be an abstraction of device drivers so
  736. that gesture detection can be performed on a common set of low-level events.
  737. This abstraction is provided by the event driver.
  738. % Door input van meerdere drivers door dezelfde event driver heen te laten gaan
  739. % is er ondersteuning voor meerdere apparaten tegelijkertijd.
  740. Gestures must be able to occur within a certain area of a touch surface that is
  741. covered by an application widget. Therefore, low-level events must be divided
  742. into separate groups before any gesture detection is performed. Event areas
  743. provide a way to accomplish this. Overlapping event areas are ordered in a tree
  744. structure that can be synchronized with the widget tree of the application.
  745. Some applications require the ability to handle an event exclusively for an
  746. event area. An event propagation mechanism provides a solution for this: the
  747. propagation of an event in the tree structure can be stopped after gesture
  748. detection in an event area.
  749. The detection of complex gestures can be approached in several ways. If
  750. explicit detection code for different gesture is not managed well, program code
  751. can become needlessly complex. A tracker-based design, in which the detection
  752. of different types of gesture is separated into different gesture trackers,
  753. reduces complexity and provides a way to extend a set of detection algorithms.
  754. A gesture trackers implementation is flexible, e.g. complex detection
  755. algorithms such as machine learning can be used simultaneously with other
  756. gesture trackers that use explicit detection.
  757. % TODO: terugkomen op resultaten uit testimplementatie
  758. \chapter{Suggestions for future work}
  759. \label{chapter:futurework}
  760. \section{A generic method for grouping events}
  761. \label{sec:eventfilter}
  762. As mentioned in section \ref{sec:areas}, the concept of an event area is based
  763. on the assumption that the set of originating events that form a particular
  764. gesture, can be determined based exclusively on the location of the events.
  765. Since this thesis focuses on multi-touch surface based devices, and every
  766. object on a multi-touch surface has a position, this assumption is valid.
  767. However, the design of the architecture is meant to be more generic; to provide
  768. a structured design for managing gesture detection.
  769. An in-air gesture detection device, such as the Microsoft Kinect \cite{kinect},
  770. provides 3D positions. Some multi-touch tables work with a camera that can also
  771. determine the shape and rotational orientation of objects touching the surface.
  772. For these devices, events delegated by the event driver have more parameters
  773. than a 2D position alone. The term ``area'' is not suitable to describe a group
  774. of events that consist of these parameters.
  775. A more generic term for a component that groups similar events is the
  776. \emph{event filter}. The concept of an event filter is based on the same
  777. principle as event areas, which is the assumption that gestures are formed from
  778. a subset of all events. However, an event filter takes all parameters of an
  779. event into account. An application on the camera-based multi-touch table could
  780. be to group all objects that are triangular into one filter, and all
  781. rectangular objects into another. Or, to separate small finger tips from large
  782. ones to be able to recognize whether a child or an adult touches the table.
  783. \section{Using a state machine for gesture detection}
  784. All gesture trackers in the reference implementation are based on the explicit
  785. analysis of events. Gesture detection is a widely researched subject, and the
  786. separation of detection logic into different trackers allows for multiple types
  787. of gesture detection in the same architecture. An interesting question is
  788. whether multi-touch gestures can be described in a formal way so that explicit
  789. detection code can be avoided.
  790. \cite{GART} and \cite{conf/gw/RigollKE97} propose the use of machine learning
  791. to recognize gestures. To use machine learning, a set of input events forming a
  792. particular gesture must be represented as a feature vector. A learning set
  793. containing a set of feature vectors that represent some gesture ``teaches'' the
  794. machine what the feature of the gesture looks like.
  795. An advantage of using explicit gesture detection code is the fact that it
  796. provides a flexible way to specify the characteristics of a gesture, whereas
  797. the performance of feature vector-based machine learning is dependent on the
  798. quality of the learning set.
  799. A better method to describe a gesture might be to specify its features as a
  800. ``signature''. The parameters of such a signature must be be based on input
  801. events. When a set of input events matches the signature of some gesture, the
  802. gesture is be triggered. A gesture signature should be a complete description
  803. of all requirements the set of events must meet to form the gesture.
  804. A way to describe signatures on a multi-touch surface can be by the use of a
  805. state machine of its touch objects. The states of a simple touch point could be
  806. ${down, move, hold, up}$ to indicate respectively that a point is put down, is
  807. being moved, is held on a position for some time, and is released. In this
  808. case, a ``drag'' gesture can be described by the sequence $down - move - up$
  809. and a ``select'' gesture by the sequence $down - hold$. If the set of states is
  810. not sufficient to describe a desired gesture, a developer can add additional
  811. states. For example, to be able to make a distinction between an element being
  812. ``dragged'' or ``thrown'' in some direction on the screen, two additional
  813. states can be added: ${start, stop}$ to indicate that a point starts and stops
  814. moving. The resulting state transitions are sequences $down - start - move -
  815. stop - up$ and $down - start - move - up$ (the latter does not include a $stop$
  816. to indicate that the element must keep moving after the gesture had been
  817. performed). The two sequences distinguish a ``drag'' gesture from a ``flick''
  818. gesture respectively.
  819. An additional way to describe even more complex gestures is to use other
  820. gestures in a signature. An example is to combine $select - drag$ to specify
  821. that an element must be selected before it can be dragged.
  822. The application of a state machine to describe multi-touch gestures is a
  823. subject well worth exploring in the future.
  824. \section{Daemon implementation}
  825. Section \ref{sec:daemon} proposes the use of a network protocol to communicate
  826. between an architecture implementation and (multiple) gesture-based
  827. applications, as illustrated in figure \ref{fig:daemon}. The reference
  828. implementation does not support network communication. If the architecture
  829. design is to become successful in the future, the implementation of network
  830. communication is a must. ZeroMQ (or $\emptyset$MQ) \cite{ZeroMQ} is a
  831. high-performance software library with support for a wide range of programming
  832. languages. A good basis for a future implementation could use this library as
  833. the basis for its communication layer.
  834. If an implementation of the architecture will be released, a good idea would be
  835. to do so within a community of application developers. A community can
  836. contribute to a central database of gesture trackers, making the interaction
  837. from their applications available for use in other applications.
  838. Ideally, a user can install a daemon process containing the architecture so
  839. that it is usable for any gesture-based application on the device. Applications
  840. that use the architecture can specify it as being a software dependency, or
  841. include it in a software distribution.
  842. \bibliographystyle{plain}
  843. \bibliography{report}{}
  844. \appendix
  845. \chapter{The TUIO protocol}
  846. \label{app:tuio}
  847. The TUIO protocol \cite{TUIO} defines a way to geometrically describe tangible
  848. objects, such as fingers or objects on a multi-touch table. Object information
  849. is sent to the TUIO UDP port (3333 by default).
  850. For efficiency reasons, the TUIO protocol is encoded using the Open Sound
  851. Control \cite[OSC]{OSC} format. An OSC server/client implementation is
  852. available for Python: pyOSC \cite{pyOSC}.
  853. A Python implementation of the TUIO protocol also exists: pyTUIO \cite{pyTUIO}.
  854. However, the execution of an example script yields an error regarding Python's
  855. built-in \texttt{socket} library. Therefore, the reference implementation uses
  856. the pyOSC package to receive TUIO messages.
  857. The two most important message types of the protocol are ALIVE and SET
  858. messages. An ALIVE message contains the list of session id's that are currently
  859. ``active'', which in the case of multi-touch a table means that they are
  860. touching the screen. A SET message provides geometric information of a session
  861. id, such as position, velocity and acceleration.
  862. Each session id represents an object. The only type of objects on the
  863. multi-touch table are what the TUIO protocol calls ``2DCur'', which is a (x, y)
  864. position on the screen.
  865. ALIVE messages can be used to determine when an object touches and releases the
  866. screen. For example, if a session id was in the previous message but not in the
  867. current, The object it represents has been lifted from the screen.
  868. SET provide information about movement. In the case of simple (x, y) positions,
  869. only the movement vector of the position itself can be calculated. For more
  870. complex objects such as fiducials, arguments like rotational position and
  871. acceleration are also included.
  872. ALIVE and SET messages can be combined to create ``point down'', ``point move''
  873. and ``point up'' events.
  874. TUIO coordinates range from $0.0$ to $1.0$, with $(0.0, 0.0)$ being the left
  875. top corner of the screen and $(1.0, 1.0)$ the right bottom corner. To focus
  876. events within a window, a translation to window coordinates is required in the
  877. client application, as stated by the online specification
  878. \cite{TUIO_specification}:
  879. \begin{quote}
  880. In order to compute the X and Y coordinates for the 2D profiles a TUIO
  881. tracker implementation needs to divide these values by the actual sensor
  882. dimension, while a TUIO client implementation consequently can scale these
  883. values back to the actual screen dimension.
  884. \end{quote}
  885. \end{document}