Fawkes API Fawkes Development Version
image_thread.h
1
2/***************************************************************************
3 * image_thread.h - OpenNI image provider thread
4 *
5 * Created: Thu Mar 17 13:58:25 2011
6 * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_OPENNI_IMAGE_THREAD_H_
24#define _PLUGINS_OPENNI_IMAGE_THREAD_H_
25
26#include <aspect/blocked_timing.h>
27#include <aspect/clock.h>
28#include <aspect/configurable.h>
29#include <aspect/logging.h>
30#include <core/threading/thread.h>
31#include <core/utils/lockptr.h>
32#include <plugins/openni/aspect/openni.h>
33
34// OpenNI relies on GNU extension to detect Linux
35#if defined(__linux__) && not defined(linux)
36# define linux true
37#endif
38#if defined(__i386__) && not defined(i386)
39# define i386 true
40#endif
41#include <XnCppWrapper.h>
42
43namespace firevision {
44class SharedMemoryImageBuffer;
45}
46
53{
54public:
56 virtual ~OpenNiImageThread();
57
58 virtual void init();
59 virtual void loop();
60 virtual void finalize();
61
62 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
63protected:
64 virtual void
66 {
67 Thread::run();
68 }
69
70private:
71 xn::ImageGenerator *image_gen_;
72 xn::ImageMetaData * image_md_;
73
76
77 typedef enum { DEBAYER_BILINEAR, DEBAYER_NEAREST_NEIGHBOR, CONVERT_YUV, CONVERT_RGB } CopyMode;
78 CopyMode cfg_copy_mode_;
79
80 unsigned short int usb_vendor_;
81 unsigned short int usb_product_;
82 unsigned int image_width_;
83 unsigned int image_height_;
84
85 fawkes::Time *capture_start_;
86};
87
88#endif
OpenNI Image Provider Thread.
Definition: image_thread.h:53
virtual void loop()
Code to execute in the thread.
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: image_thread.h:65
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
virtual ~OpenNiImageThread()
Destructor.
OpenNiImageThread()
Constructor.
Thread aspect to use blocked timing.
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to log output.
Definition: logging.h:33
Thread aspect to get access to the OpenNI context.
Definition: openni.h:39
Thread class encapsulation of pthreads.
Definition: thread.h:46
A class for handling time.
Definition: time.h:93
Shared memory image buffer.
Definition: shm_image.h:184