supereight
Loading...
Searching...
No Matches
reader_openni.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014 University of Edinburgh, Imperial College London, University of Manchester
3 * SPDX-FileCopyrightText: 2016-2019 Emanuele Vespa
4 * SPDX-FileCopyrightText: 2020-2022 Smart Robotics Lab, Imperial College London, Technical University of Munich
5 * SPDX-FileCopyrightText: 2020-2022 Nils Funk
6 * SPDX-FileCopyrightText: 2020-2022 Sotiris Papatheodorou
7 * SPDX-License-Identifier: MIT
8 */
9
10#ifndef __READER_OPENNI_HPP
11#define __READER_OPENNI_HPP
12
13#include "reader_base.hpp"
14
15#ifdef SE_OPENNI2
16# include <openni2/OpenNI.h>
17#endif
18
19namespace se {
20
24class OpenNIReader : public Reader {
25 public:
31
33
35 void restart();
36
41 std::string name() const;
42
43 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
44
45 private:
46#ifdef SE_OPENNI2
47 template<typename T>
48 class MyFrameAllocator : public openni::VideoStream::FrameAllocator {
49 public:
50 MyFrameAllocator(T* buffer) : buffer_(buffer)
51 {
52 }
53 void* allocateFrameBuffer(int)
54 {
55 return buffer_;
56 }
57 void freeFrameBuffer(void*)
58 {
59 }
60
61 private:
62 T* buffer_;
63 };
64
65 std::unique_ptr<MyFrameAllocator<uint16_t>> depth_allocator_;
66 std::unique_ptr<MyFrameAllocator<uint8_t>> rgb_allocator_;
67
68 openni::Status rc_;
69 openni::Device device_;
70 openni::VideoStream depth_stream_;
71 openni::VideoStream rgb_stream_;
72 openni::VideoFrameRef depth_frame_;
73 openni::VideoFrameRef rgb_frame_;
74 std::unique_ptr<uint16_t> depth_image_;
75 std::unique_ptr<uint8_t> rgb_image_;
76#endif
77
78 ReaderStatus nextDepth(Image<float>& depth_image);
79
80 ReaderStatus nextColour(Image<RGB>& colour_image);
81};
82
83} // namespace se
84
85#endif
Reader for the Microsoft Kinect and Asus Xtion using the OpenNI2 driver.
Definition reader_openni.hpp:24
void restart()
Restart reading from the beginning.
OpenNIReader(const Config &c)
Construct an OpenNIReader from a Config.
std::string name() const
The name of the reader.
Base abstract class for dataset readers.
Definition reader_base.hpp:79
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14
ReaderStatus
The result of trying to read a depth/RGB image or a pose.
Definition reader_base.hpp:45
Definition reader_base.hpp:81