openni_device_oni.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011 Willow Garage, Inc.
5  * Suat Gedikli <gedikli@willowgarage.com>
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef __OPENNI_DEVICE_ONI__
39 #define __OPENNI_DEVICE_ONI__
40 
41 #include "openni_device.h"
42 #include "openni_driver.h"
43 
44 namespace openni_wrapper
45 {
46 
53 class DeviceONI : public OpenNIDevice
54 {
55  friend class OpenNIDriver;
56 public:
57  DeviceONI (xn::Context& context, const std::string& file_name, bool repeat = false, bool streaming = true) throw (OpenNIException);
58  virtual ~DeviceONI () throw ();
59 
60  virtual void startImageStream () throw (OpenNIException);
61  virtual void stopImageStream () throw (OpenNIException);
62 
63  virtual void startDepthStream () throw (OpenNIException);
64  virtual void stopDepthStream () throw (OpenNIException);
65 
66  virtual void startIRStream () throw (OpenNIException);
67  virtual void stopIRStream () throw (OpenNIException);
68 
69  virtual bool isImageStreamRunning () const throw (OpenNIException);
70  virtual bool isDepthStreamRunning () const throw (OpenNIException);
71  virtual bool isIRStreamRunning () const throw (OpenNIException);
72 
73  virtual bool isImageResizeSupported (unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const throw ();
74 
75  bool trigger () throw (OpenNIException);
76  bool isStreaming () const throw (OpenNIException);
77 protected:
78  virtual boost::shared_ptr<Image> getCurrentImage (boost::shared_ptr<xn::ImageMetaData> image_meta_data) const throw ();
79 
80  void PlayerThreadFunction () throw (OpenNIException);
81  static void __stdcall NewONIDepthDataAvailable (xn::ProductionNode& node, void* cookie) throw ();
82  static void __stdcall NewONIImageDataAvailable (xn::ProductionNode& node, void* cookie) throw ();
83  static void __stdcall NewONIIRDataAvailable (xn::ProductionNode& node, void* cookie) throw ();
84 
85  xn::Player player_;
87  mutable boost::mutex player_mutex_;
88  boost::condition_variable player_condition_;
89  bool streaming_;
93 };
94 
95 } //namespace openni_wrapper
96 #endif //__OPENNI_DEVICE_ONI__
97 
virtual boost::shared_ptr< Image > getCurrentImage(boost::shared_ptr< xn::ImageMetaData > image_meta_data) const
Driver class implemented as Singleton. This class contains the xn::Context object used by all devices...
Definition: openni_driver.h:58
Image class containing just a reference to image meta data. Thus this class just provides an interfac...
Definition: openni_image.h:54
General exception class.
virtual bool isDepthStreamRunning() const
static void __stdcall NewONIImageDataAvailable(xn::ProductionNode &node, void *cookie)
static void __stdcall NewONIDepthDataAvailable(xn::ProductionNode &node, void *cookie)
static void __stdcall NewONIIRDataAvailable(xn::ProductionNode &node, void *cookie)
#define __stdcall
Definition: openni_device.h:53
Concrete implementation of the interface OpenNIDevice for a virtual device playing back an ONI file...
virtual bool isIRStreamRunning() const
virtual bool isImageResizeSupported(unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const
virtual bool isImageStreamRunning() const
Class representing an astract device for Primesense or MS Kinect devices.
Definition: openni_device.h:66
boost::condition_variable player_condition_
DeviceONI(xn::Context &context, const std::string &file_name, bool repeat=false, bool streaming=true)


openni_camera
Author(s): Patrick Mihelich, Suat Gedikli, Radu Bogdan Rusu
autogenerated on Wed Jun 5 2019 20:15:22