- OpenNI Cookbook
- Soroush Falahati
- 395字
- 2021-08-13 16:30:18
Introduction
In this chapter, we will introduce primary datatypes of the OpenNI and the NiTE along with some basic information about how to access and select a data stream. Then we will try to show you some examples of events triggered by devices such as connecting or disconnecting an OpenNI supported device from computer.
But first, let's get some background about the whole OpenNI's principle first.
The OpenNI object
OpenNI object is the starting point of everything in the framework. Using the OpenNI class we can access a list of connected devices as well as the version of OpenNI itself. Then using this information we can access a device object and read data.
This class uses the singleton pattern, which means there is only one instance of this class and all of its methods are static.
Also in OpenNI 2 we have the ability to register two callback functions by OpenNI object for capturing device connected and device disconnected events.
The device object
Device object is representing the actual physical device where each device supports a number of sensors (for example, depth, color, and IR) that can be accessed using Device object. We need to ask for access to a device before using its sensor's output. Also using this object, we can access some device-wide settings. Read more in Chapter 4, More about Low-level Outputs.
The VideoStream object
Using the VideoStream object we can access the output data of color, IR, and depth sensors. VideoStream in the new version of OpenNI supports event-based reading that gives us the ability to register a callback function to execute when a new frame of data becomes available.
Sharing devices between applications
Unlike OpenNI 1.x, where we could share a device between two or more applications at the same time, we can't share a sensor's output at all with OpenNI 2.x. In the new design, the first application always locks the device; not only is there no way for the second app to change settings of sensors, there is no way to even use the output of locked sensors in any way as well.
VideoStream paused state
Most of the time, a sensor will not start producing data output when initialized until the programmer asks it to start generating data using the openni:VideoStream::start()
function. Also it is possible to stop a stream from generating data using the openni:VideoStream::stop()
function.
- 自然語言處理實戰(zhàn):預(yù)訓(xùn)練模型應(yīng)用及其產(chǎn)品化
- Python機器學(xué)習(xí):數(shù)據(jù)分析與評分卡建模(微課版)
- Python從小白到大牛
- 計算機圖形學(xué)編程(使用OpenGL和C++)(第2版)
- Maven Build Customization
- PaaS程序設(shè)計
- ADI DSP應(yīng)用技術(shù)集錦
- AutoCAD VBA參數(shù)化繪圖程序開發(fā)與實戰(zhàn)編碼
- Learning Selenium Testing Tools(Third Edition)
- 從Excel到Python:用Python輕松處理Excel數(shù)據(jù)(第2版)
- RISC-V體系結(jié)構(gòu)編程與實踐(第2版)
- 移動界面(Web/App)Photoshop UI設(shè)計十全大補
- WordPress 4.0 Site Blueprints(Second Edition)
- Advanced Express Web Application Development
- 單片機原理及應(yīng)用技術(shù)