OpenNI学习笔记

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

OpenNI框架标准篇
The OpenNI Framework is an abstract layer that provides the interface for both physical devices and middleware components.
Sensor Modules
● 3D sensor
● RGB camera
● IR camera
● Audio device (a microphone or an array of microphones)
Middleware components:
● Full body analysis middleware: a software component that processes sensory data and generates body related information (typically data structure that describes joints,orientation, center of mass, and so on).
● Hand point analysis middleware: a software component that processes sensory data and generates the location of a hand point
● Gesture detection middleware: a software component that identifies predefined gestures (for example, a waving hand) and alerts the application.
● Scene Analyzer middleware: a software component that analyzes the image of the scene in order to produce such information as:
o The separation between the foreground of the scene (meaning, the figures) and the background
o The coordinates of the floor plane
o The individual identification of figures in the scene.
OpenNI defines Production Nodes, which encapsulate the functionality relates to the generation of the specific data type. The logic of data generation must be implemented by the modules that plug into OpenNI.
The production node types that are currently supported in OpenNI are:
Sensor-Related Production Nodes
● Device:A node that represents a physical device (for example, a depth sensor, or an RGB camera). The main role of this node is to enable device configuration.
● Depth Generator: A node that generates a depth-map. This node should be implemented by any 3D sensor that wishes to be certified as OpenNI compliant.
● Image Generator: A node that generates colored image-maps. This node should be implemented by any color sensor that wishes to be certified as OpenNI compliant
● IR Generator: A node that generates IR image-maps. This node should be implemented by any IR sensor that wishes to be certified as OpenNI compliant.
●Audio Generator: A node that generates an audio stream. This node should be implemented by any audio device that wishes to be certified as OpenNI compliant.
Middleware-Related Production Nodes
G estures Alert Generator: Generates callbacks to the application when specific gestures are identified.
S cene Analyzer: Analyzes a scene, including the separation of the foreground from the background, identification of figures in the scene, and detection of the floor plane.
The Scene Analyzer’s main output is a labeled depth map, in which each pixel holds a label
that states whether it represents a figure, or it is part of the background.
H and Point Generator: Supports hand detection and tracking. This node generates callbacks that provide alerts when a hand point (meaning, a palm) is detected, and when a
hand point currently being tracked, changes its location.
User Generator: Generates a representation of a (full or partial) body in the 3D scene.
For recording purposes, the following production node types are supported:
R ecorder:Implements data recordings
P layer:Reads data from a recording and plays it
C odec:Used to compress and decompress data in recordings
Production Chains
Different vendors (brand names) can supply their own implementations of the same type of production node.
The OpenNI interface enumerates all possible production chains according to the registered modules. The application can then choose one of these chains, based on the preference for a specific brand, component, or version and so on, and create it.
For example: two 3D sensors(Brand 1 and Brand 2),two body middleware components (Vendor A,B)
So there are four chains:
Vendor A——〉Brand 1,Vendor A——〉Brand 2,Vendor B——〉Brand 1,Vendor B——〉Brand 2;
Capabilities
The Capabilities mechanism supports the flexibility of the registration of multiple middleware components and devices to OpenNI.
Certain non-mandatory extensions to the API are called Capabilities, and reveal additional functionality, enabling providers to decide individually whether to implement an extension.
Each module can declare the capabilities it supports. Furthermore, when requesting enumeration of production chains, the application can specify the capabilities that should be supported as criteria. Only modules that support the requested capability are returned by the enumeration. Currently supported capabilities:
◆ A lternative View:Enables any type of map generator(depth, image, IR) to transform its data to appear as if the sensor is placed in another location (represented by another production node, usually another sensor).
◆ C ropping:Enables a map generator(depth, image, IR) to output a selected area of the frame as opposed to the entire frame. When cropping is enabled, the size of the generated map is reduced to fit a lower resolution (less pixels). For example, if the map generator is working in VGA resolution (640x480) and the application chooses to crop at 300x200, the next pixel row will begin after 300 pixels. Cropping can be very useful for performance boosting.
◆ F rame Sync: Enables two sensors producing frame data (for example, depth and image) to
synchronize their frames so that they arrive at the same time.
◆ M irror:Enables mirroring of the data produced by a generator. Mirroring is useful if the sensor is placed in front of the user, as the image captured by the sensor is mirrored, so the right hand appears as the left hand of the mirrored figure.
◆ P ose Detection: Enables a user generator to recognize when the user is posed in a specific position.
◆ S keleton:Enables a user generator to output the skeletal data of the user. This data includes the location of the skeletal joints, the ability to track skeleton positions and the user calibration capabilities.
◆ U ser Position:Enables a Depth Generator to optimize the output depth map that is generated for a specific area of the scene.
◆ E rror State: Enables a node to report that it is in "Error" status, meaning that on a practical level, the node may not function properly.
◆ L ock Aware: Enables a node to be locked outside the context boundary. For more information, see Sharing Devices between Applications and Locking Nodes.
The xn::Generator::StartGenerating() function is used to begin generating.
Any generator should internally store new data, until explicitly requested to update to the newest available data. This means that Data Generators "hide" new data internally, using the UpdateData request function. update it using the xn::Generator::WaitAndUpdateData() function.
xn::Context::WaitOneUpdateAll(): Waits for a specific node to have new data. Once new data is available from this node, all nodes are updated. This is especially useful when several nodes are producing data, but only one determines the progress of the application.
xn::Context::WaitNoneUpdateAll():Does not wait for anything. All nodes are immediately updated.
Any、One、None、And;
The above four functions exit after a timeout of two seconds.
Sharing Devices between Applications and Locking Nodes
if several applications all using the same hardware device are running simultaneously, their configuration must be synchronized.
OpenNI has two modes that enable multiple applications to share a hardware device:
Full Sharing (default): In this mode, the application declares that it can handle any configuration of this node. OpenNI interface enables registering to callback functions of any configuration change, so the application can be notified whenever a configuration changes (by the same application, or by another application using the same hardware device).
Locking Configuration: In this mode, an application dec l ares that it wants to lock the current configuration of a specific node. OpenNI will therefore not allow "Set" functions to be called on this node. If the node represents a hardware device (or anything else that can be shared between processes), it should implement the "Lock Aware" capability, which enables locking across process boundaries.
OpenNI provides a simple licensing mechanism that can be used by modules and applications. During the enumeration process, when OpenNI searches for valid production chains, the module can check the licenses list. If the requested license is not registered, the module is able to hide itself, meaning that it will return zero results and therefore not be counted as a possible production chain.
OpenNI also provides a global registry for license keys。

Recording
Recordings are a powerful debug tool. They enable full capture of the data and the ability to later stream it back so that applications can simulate an exact replica of the situation to be debugged. OpenNI supports recordings of the production nodes chain; both the entire configuration of each node, and all data streamed from a node. nimRecorder module, which defines a new file format (".ONI") - and implements a Recorder node and a Player node for this format.
Each production node has an error status, indicating whether it is currently functional.
The context is the main object in OpenNI. A context is an object that holds the complete state of applications using OpenNI. The same application can create more than one context, but the contexts cannot share information.
To free the memory used by the context, the application should call the shutdown function.
OpenNI Metadata objects encapsulate a set of properties that relate to specific data alongside the data itself.
Each configuration option in OpenNI interfaces comprises the following functions:
A Set function for modifying the configuration.
A Get function for providing the current value.
R egister and Unregister functions, enabling registration for callback functions to be called when this option changes.
Data Generators
Map Generator
Main functionalities:
O utput Mode property: Controls the configuration by which to generate the map
C ropping capability
A lternative Viewpoint capability
F rame Sync capability
Depth Generator
Main Functionalities:
G et depth map: Provides the depth map
G et Device Max Depth: The maximum distance available for this depth generator
F ield of V iew property:Configures the values of the horizontal and vertical angles of the sensor
Image Generator
Main Functionalities:
G et Image Map: Provides the color image map
P ixel format property
IR Generator
Scene Analyzer
Audio Generator
Gesture Generator
Main Functionalities:
A dd/Remove Gesture: Turn on/off a gesture. Once turned on, the generator will start looking for this gesture.
G et Active Gestures: Provides the names of the gestures that are currently active
R egister/Unregister Gesture callbacks
R egister/Unregister Gesture change
Hand Point Generator
Start/Stop Tracking: Start/stop tracking a specific hand (according to its position)
Register/Unregister Hand Callbacks: The following actions will generate hand callbacks:
o When a new hand is created
o When an existing hand is in a new position
o When an existing hand disappears
User Generator
Main Functionalities:
G et Number of Users: Provides the number of users currently detected in the scene
G et Users: Provides the current users
G et User CoM: Returns the location of the center of mass of the user
G et User Pixels: Provides the pixels that represent the user. The output is a map of the pixels of the entire scene, where the pixels that represent the body are labeled User ID.
R egister/Unregister user callbacks: The following actions will generate user callbacks: o When a new user is identified
o When an existing user disappears
6. If you wish to use an XML file to configure OpenNI, you can start from the basic XML file that can be found in the OpenNI Data folder.
OpenNI enables the application to acquire a full list of modules that failed to enumerate, including why each one failed, by using the xn::EnumerationErrors function.
Configuration Using XML file OpenNI supports using XML as a configuration script. The configuration XML script can be used for creating nodes and configuring them, as well as for
configuring the context itself (adding license keys, etc.). an XML script can be executed by calling xn::Context::RunXmlScript()and passing it the XML script as a string, or by calling xn::Context::RunXmlScriptFromFile() and passing it an XML file to load.
参考文献:
OpenNI documentation:
[1] Concepts Section;
SensorKinect 驱动篇
它的Source文件中包含了八个文件:Extenal、Utils、XnCommon、XnCore、XnDDK、XnDeviceFile、XnDeviceSensorV2、XnFormats.
NITE中间件篇
1.NITE Algorithms 1.3
1.1Control by gestures
Working distance of the controlling user is 1m - 3.5m, and User’s hand should not be occluded.
有两种方式来获得设备的控制权,”click” and “wave”,The “click” movement should be long enough (at least 20cm). For the “wave” gesture, this happens after the hand did 2 waves.
支持的手势有:
Click、Wave、Swipe left、Swipe right、Raise hand candidate、Hand candidate moved.
支持的状态有:
Gesture started,Gesture completed – Occurs once the entire gesture is recognized by the framework.
1.2User Segmentation
Each user in the scene is given a unique and persistent ID, The skeleton tracking algorithm uses this label map to generate a skeleton.
If the user is not visible for more than 10 seconds, the user is considered lost and
an event is generated by the API.
1.3Skeleton Tracking
Calibration is used to adjust the skeleton model to the user’s body proportions. The calibration step currently takes a few seconds (~<3s).
The API returns positions and orientations of the skeleton joints. The joint positions are, in a way, more accurate than the joint angles. A confidence value is returned for the individual joints but it is fairly basic(0,1).
图示了右参考方向
2.NITE Controls User Guide
The concept on which NITE middleware was designed is based on two key paradigms: the hand control paradigm and full body control paradigm.
A gesture widget is a predefined palm movement, e.g. a wave, a circle, a push etc. NITE tracks the palms until identifying a complete widget maneuver.
NITE middleware includes both a computer vision engine, and a framework that provides the application with gesture-based UI controls. This division is essentially the two layers :
1.NITE Algorithms.
a.Scene segmentation – individual users and objects are separated from the background
and tagged accordingly.
b.Hand point detection and tracking – Users hands are detected and followed.
c.Full body tracking – a set of locations of body joints, based on the scene segmentation
output.
2.NITE Controls - A layer of application framework that analyzes the hand points generated by
NITE Algorithms
The main purpose of OpenNI is to form a standard API that enables communication with both:
Vision and audio sensors (the devices that ‘see’ and ‘hear’ the figures and their surroundings .)
Vision and audio perception middleware (the software components that analyze the audio and visual data that is recorded from the scene, and comprehend it).
OpenNI supplies a set of APIs to be implemented by the sensor devices, and a set of APIs to be implemented by the middleware components.
Push Detector:
The following parameters can be configured:
Imm ediate Duration – the period of time in which a movement is detected as push
Immediate Minimum Velocity – the minimum velocity in the time span to define as push.
Immediate Offset
Maximum angle between immediate and Z
Minimum angle betwe e n immediate and previous
Previous duration
Previous minimum velocity
Previous offset
Swipe Detector:
Motion Speed Threshold – the minimal speed for recognizing a gesture as a swipe.
Motion Time - The minimal duration for recognizing a gesture as a swipe.
X Angle Threshold – the allowed deviation from X-axis, to recognize a gesture as a Swipe left or right.
Y Angle Threshold – the allowed deviation from Y-axis, to recognize a gesture as a Swipe up or down.
Wave detector:
The following parameters can be configured:
Flip Count – the number of direction changes that constitute a wave gesture
Max Deviation –the allowed deviation from the motion plane, since the motion is expected to be right-left.
Min length – the length (in mm) of the motion before a direction change (a flip). Circle Detector:
The following parameters can be configured:
Minimum Points – the minimal number of points to try to match as a circle.
Min/Max Radius – The minimal/maximal radius for which a circle is valid
Close to Existing Circle – how close may the new point be to the existing circles circumference to be considered the same circle
Existing Weight – The circle size and center is always changing according to the hand points that are added. Each new point is taken into consideration for the description of the circle (its location and radius). This parameter controls the weight that each object gets – the existing circle compared to the new point - when coming to decide how to change the circle description.
Max Errors – determines the number of allowed errors, where errors are points that do not match the circle. When the maximal number of points is reached, the circle is no longer valid.。

相关文档
最新文档