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 
__stdcall
#define __stdcall
Definition: openni_device.h:53
openni_wrapper::DeviceONI::isDepthStreamRunning
virtual bool isDepthStreamRunning() const
Definition: openni_device_oni.cpp:141
openni_wrapper::OpenNIDevice
Class representing an astract device for Primesense or MS Kinect devices.
Definition: openni_device.h:66
openni_wrapper::DeviceONI::player_condition_
boost::condition_variable player_condition_
Definition: openni_device_oni.h:88
openni_wrapper::DeviceONI::stopIRStream
virtual void stopIRStream()
Definition: openni_device_oni.cpp:130
openni_wrapper::DeviceONI::isImageStreamRunning
virtual bool isImageStreamRunning() const
Definition: openni_device_oni.cpp:136
openni_wrapper::DeviceONI::image_stream_running_
bool image_stream_running_
Definition: openni_device_oni.h:91
openni_device.h
openni_wrapper::DeviceONI::depth_stream_running_
bool depth_stream_running_
Definition: openni_device_oni.h:90
boost
openni_wrapper
Definition: openni_depth_image.h:45
openni_wrapper::DeviceONI::isImageResizeSupported
virtual bool isImageResizeSupported(unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const
Definition: openni_device_oni.cpp:201
openni_wrapper::DeviceONI::player_thread_
boost::thread player_thread_
Definition: openni_device_oni.h:86
openni_wrapper::DeviceONI::player_
xn::Player player_
Definition: openni_device_oni.h:85
openni_wrapper::DeviceONI::NewONIImageDataAvailable
static void __stdcall NewONIImageDataAvailable(xn::ProductionNode &node, void *cookie)
Definition: openni_device_oni.cpp:182
openni_wrapper::DeviceONI::NewONIIRDataAvailable
static void __stdcall NewONIIRDataAvailable(xn::ProductionNode &node, void *cookie)
Definition: openni_device_oni.cpp:189
openni_wrapper::DeviceONI::streaming_
bool streaming_
Definition: openni_device_oni.h:89
openni_wrapper::Image
Image class containing just a reference to image meta data. Thus this class just provides an interfac...
Definition: openni_image.h:54
openni_wrapper::DeviceONI::startIRStream
virtual void startIRStream()
Definition: openni_device_oni.cpp:124
openni_wrapper::OpenNIException
General exception class.
Definition: openni_exception.h:58
openni_wrapper::DeviceONI::isStreaming
bool isStreaming() const
Definition: openni_device_oni.cpp:163
openni_wrapper::DeviceONI::NewONIDepthDataAvailable
static void __stdcall NewONIDepthDataAvailable(xn::ProductionNode &node, void *cookie)
Definition: openni_device_oni.cpp:175
openni_wrapper::DeviceONI::stopImageStream
virtual void stopImageStream()
Definition: openni_device_oni.cpp:106
openni_wrapper::DeviceONI
Concrete implementation of the interface OpenNIDevice for a virtual device playing back an ONI file.
Definition: openni_device_oni.h:53
openni_driver.h
openni_wrapper::DeviceONI::DeviceONI
DeviceONI(xn::Context &context, const std::string &file_name, bool repeat=false, bool streaming=true)
Definition: openni_device_oni.cpp:46
openni_wrapper::DeviceONI::isIRStreamRunning
virtual bool isIRStreamRunning() const
Definition: openni_device_oni.cpp:146
openni_wrapper::DeviceONI::startImageStream
virtual void startImageStream()
Definition: openni_device_oni.cpp:100
openni_wrapper::DeviceONI::PlayerThreadFunction
void PlayerThreadFunction()
Definition: openni_device_oni.cpp:168
openni_wrapper::DeviceONI::ir_stream_running_
bool ir_stream_running_
Definition: openni_device_oni.h:92
openni_wrapper::DeviceONI::getCurrentImage
virtual boost::shared_ptr< Image > getCurrentImage(boost::shared_ptr< xn::ImageMetaData > image_meta_data) const
Definition: openni_device_oni.cpp:196
openni_wrapper::DeviceONI::startDepthStream
virtual void startDepthStream()
Definition: openni_device_oni.cpp:112
openni_wrapper::DeviceONI::trigger
bool trigger()
Definition: openni_device_oni.cpp:151
openni_wrapper::DeviceONI::player_mutex_
boost::mutex player_mutex_
Definition: openni_device_oni.h:87
openni_wrapper::OpenNIDriver
Driver class implemented as Singleton. This class contains the xn::Context object used by all devices...
Definition: openni_driver.h:58
openni_wrapper::DeviceONI::stopDepthStream
virtual void stopDepthStream()
Definition: openni_device_oni.cpp:118


openni_camera
Author(s): Patrick Mihelich, Suat Gedikli, Radu Bogdan Rusu
autogenerated on Thu Apr 21 2022 02:37:23