使用 LeapMotion 插件跟踪手和手指
Overview概述#
LeapMotion plugin allows you to track hands and fingers in your UNIGINE-based application.LeapMotion 插件允许您在基于 UNIGINE 的应用程序中跟踪手和手指。
The Leap Motion system recognizes and tracks hands and fingers. The device operates in an intimate proximity with high precision and tracking frame rate and reports discrete positions and motion.Leap Motion 系统识别并跟踪手和手指。该设备以高精度和跟踪帧速率近距离运行,并报告离散位置和运动。
The Leap Motion controller uses optical sensors and infrared light. The sensors are directed along the Y axis — upward when the controller is in its standard operating position — and have a field of view of about 150 degrees. The effective range of the Leap Motion Controller extends from approximately 25 to 600 millimeters above the device (1 inch to 2 feet).Leap Motion 控制器使用光学传感器和红外光。传感器沿 Y 轴定向——当控制器处于标准操作位置时向上——并且具有大约 150 度的视野。 Leap Motion 控制器的有效范围从设备上方大约 25 毫米到 600 毫米(1 英寸到 2 英尺)。
Detection and tracking work best when the controller has a clear, high-contrast view of an object's silhouette. The Leap Motion software combines its sensor data with an internal model of the human hand to help cope with challenging tracking conditions.当控制器具有清晰、高对比度的物体轮廓视图时,检测和跟踪效果最佳。 Leap Motion 软件将其传感器数据与人手的内部模型相结合,以帮助应对具有挑战性的跟踪条件。
Coordinate System坐标系#
The Leap Motion system uses a right-handed Cartesian coordinate system. The origin is centered at the top of the Leap Motion Controller. The X and Z axes lie in the horizontal plane, with the X axis running parallel to the long edge of the device. The Y axis is vertical, with positive values increasing upwards (in contrast to the downward orientation of most computer graphics coordinate systems). The Z axis has positive values increasing toward the user.Leap Motion 系统使用右手笛卡尔坐标系。原点在 Leap Motion 控制器的顶部居中。 X 轴和 Z 轴位于水平面,X 轴平行于设备的长边。 Y 轴是垂直的,正值向上增加(与大多数计算机图形坐标系的向下方向相反)。 Z 轴具有朝向用户增加的正值。
Hands手#
The hand model provides information about the identity, position, and other characteristics of a detected hand, the arm to which the hand is attached, and lists of the fingers associated with the hand.手部模型提供有关检测到的手的身份、位置和其他特征、手所附着的手臂以及与手相关联的手指列表的信息。
Hands are represented by the Hand class.手由 Hand 类表示。
Arms武器#
An arm is a bone-like object that provides the orientation, length, width, and end points of an arm. When the elbow is not in view, the Leap Motion controller estimates its position based on past observations as well as typical human proportion.手臂是一个类似骨骼的对象,它提供了手臂的方向、长度、宽度和端点。当肘部不在视野中时,Leap Motion 控制器会根据过去的观察以及典型的人体比例估计其位置。
Fingers手指#
The Leap Motion controller provides information about each finger on a hand. If all or part of a finger is not visible, the finger characteristics are estimated based on recent observations and the anatomical model of the hand. Fingers are identified by type name, i.e. thumb, index, middle, ring, pinky.Leap Motion 控制器提供有关手上每个手指的信息。如果手指的全部或部分不可见,则基于最近的观察和手的解剖模型来估计手指特征。手指由类型名称标识,即 thumb, index, middle, ring, pinky。
Fingers are represented by the Finger class.手指由 Finger 类表示。
Bones骨头#
Each finger has a set of bones describing the position and orientation of corresponding anatomical finger bones. All fingers contain four bones ordered from base to tip.每个手指都有一组骨骼,描述相应解剖手指骨骼的位置和方向。所有手指都包含从根部到尖端排列的四根骨头。
Bones are represented by the Bone class.骨骼由 Bone 类表示。
The bones are identified as:骨骼被识别为:
- Metacarpal — the bone inside the hand connecting the finger to the wrist (except the thumb).Metacarpal — 将手指连接到手腕(拇指除外)的手内部骨骼。
- Proximal Phalanx — the bone at the base of the finger, connected to the palm.Proximal Phalanx — 手指根部的骨骼,与手掌相连。
- Intermediate Phalanx — the middle bone of the finger, between the tip and the base.Intermediate Phalanx — 手指的中间骨骼,在尖端和基部之间。
- Distal Phalanx — the terminal bone at the end of the finger.Distal Phalanx — 手指末端的终端骨骼。
Sensor Images传感器图像#
Along with the computed tracking data, you can get the raw sensor images from the Leap Motion cameras.连同计算出的跟踪数据,您可以从 Leap Motion 相机获取原始传感器图像。
The image data contains the measured IR brightness values and the calibration data required to correct for the complex lens distortion. You can use the sensor images for augmented reality applications, especially when the Leap Motion hardware is mounted to a VR headset.图像数据包含测量的红外亮度值和校正复杂镜头畸变所需的校准数据。您可以将传感器图像用于增强现实应用程序,尤其是当 Leap Motion 硬件安装到 VR 耳机时。
See Also也可以看看#
- C++ sample illustrating the basic aspects of working with the plugin: source/samples/3rdparty/LeapMotionVisualizer说明使用插件的基本方面的 C++ 示例:source/samples/3rdparty/LeapMotionVisualizer
LeapMotion API:
- The LeapMotion interface article for more details on managing LeapMotion via API.有关通过 API 管理 LeapMotion 的更多详细信息,请参阅 LeapMotion 接口文章。
- The LeapMotion Arm class article for more details on managing arms via API.有关通过 API 管理武器的更多详细信息,请参阅 LeapMotion Arm 类文章。
- The LeapMotion Bone class article for more details on managing finger bones via API.有关通过 API 管理手指骨骼的更多详细信息,请参阅 LeapMotion Bone 类文章。
- The LeapMotion Finger class article for more details on managing fingers via API.有关通过 API 管理手指的更多详细信息,请参阅 LeapMotion Finger 类文章。
- The LeapMotion Hand class article for more details on managing hands via API.有关通过 API 管理手牌的更多详细信息,请参阅 LeapMotion Hand 类文章。
Implementing Unigine Application with LeapMotion Support使用 LeapMotion 支持实现 Unigine 应用程序#
To use the LeapMotion plugin in your UNIGINE application, perform the following:要在 UNIGINE 应用程序中使用 LeapMotion 插件,请执行以下操作:
- Download the Leap Motion SDK and install Leap Motion device drivers.下载 Leap Motion SDK 并安装 Leap Motion 设备驱动程序。
-
Create a new project with LeapMotion support via UNIGINE SDK Browser: click Plugins, check the LeapMotion support (LeapMotion plugin) option in the form that opens and click OK.通过 UNIGINE SDK 浏览器创建一个支持 LeapMotion 的新项目:单击 Plugins,在打开的表单中选中 LeapMotion support (LeapMotion plugin) 选项,然后单击 OK。
LeapMotion Plugin on Plugins PanelPlugins 面板上的 LeapMotion 插件To add LeapMotion support to the existing project, in UNIGINE SDK Browser, click Other Actions -> Configure Project -> Plugins -> LeapMotion support (LeapMotion plugin) -> OK. 要将 LeapMotion 支持添加到现有项目,请在 UNIGINE SDK Browser 中单击 Other Actions -> Configure Project -> Plugins -> LeapMotion support (LeapMotion plugin) -> OK。 - Implement your application.实施您的应用程序。
- Launch the LeapMotion plugin on the application start-up.发射应用程序启动时的 LeapMotion 插件。
Launching LeapMotion启动 LeapMotion#
To launch the plugin, specify the extern_plugin command line option on the application start-up as follows:要启动插件,请在应用程序启动时指定 extern_plugin 命令行选项,如下所示:
main_x64d -extern_plugin LeapMotion
If you run the application via UNIGINE SDK Browser, specify the command-line options given above in the Customize Run Options form.如果您通过 UNIGINE SDK 浏览器运行应用程序,请在 Customize Run Options 表单中指定上面给出的命令行选项。