17 #include <mrpt/otherlibs/do_opencv_includes.h> 41 std::vector<std::shared_ptr<COpenNI2Generic::CDevice>>
vDevices;
46 bool setONI2StreamMode(
47 openni::VideoStream& stream,
int w,
int h,
int fps,
48 openni::PixelFormat
format);
49 std::string oni2DevInfoStr(
const openni::DeviceInfo& info,
int tab = 0);
50 bool cmpONI2Device(
const openni::DeviceInfo& i1,
const openni::DeviceInfo& i2);
51 #endif // MRPT_HAS_OPENNI2 65 : m_rgb_format(openni::PIXEL_FORMAT_RGB888),
66 m_depth_format(openni::PIXEL_FORMAT_DEPTH_1_MM)
69 const char* sVerbose = getenv(
"MRPT_HWDRIVERS_VERBOSE");
70 m_verbose = (sVerbose !=
nullptr) && atoi(sVerbose) != 0;
76 "After initialization:\n %s\n",
77 openni::OpenNI::getExtendedError()));
83 int width,
int height,
float fps,
bool open_streams_now)
88 m_rgb_format(openni::PIXEL_FORMAT_RGB888),
89 m_depth_format(openni::PIXEL_FORMAT_DEPTH_1_MM),
94 m_grab_3D_points(true)
96 const char* sVerbose = getenv(
"MRPT_HWDRIVERS_VERBOSE");
97 m_verbose = (sVerbose !=
nullptr) && atoi(sVerbose) != 0;
105 "After initialization:\n %s\n",
106 openni::OpenNI::getExtendedError()));
117 if (openni::OpenNI::initialize() != openni::STATUS_OK)
123 std::cerr <<
"[" << __FUNCTION__ <<
"]" << std::endl
124 <<
" Initialized OpenNI2." << std::endl;
131 #endif // MRPT_HAS_OPENNI2 148 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
159 std::cerr << message;
169 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
171 openni::Array<openni::DeviceInfo> oni2InfoArray;
172 openni::OpenNI::enumerateDevices(&oni2InfoArray);
174 const size_t numDevices = oni2InfoArray.getSize();
177 " Get device list. %d devices connected.\n", (
int)numDevices));
180 std::set<int> newDevices;
181 for (
unsigned i = 0; i < numDevices; i++)
183 const openni::DeviceInfo& info = oni2InfoArray[i];
185 showLog(oni2DevInfoStr(info, 3) +
"\n");
187 bool isExist =
false;
188 for (
unsigned int j = 0, j_end =
vDevices.size();
189 j < j_end && isExist ==
false; ++j)
191 if (cmpONI2Device(info,
vDevices[j]->getInfo()))
196 if (isExist ==
false)
198 newDevices.insert(i);
202 for (
int newDevice : newDevices)
204 const openni::DeviceInfo& info = oni2InfoArray[newDevice];
211 if (device->getSerialNumber(sn))
214 "Device[%d]: serial number: `%u`\n", newDevice, sn));
221 showLog(
" No devices connected -> EXIT\n");
230 #endif // MRPT_HAS_OPENNI2 235 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
238 openni::OpenNI::shutdown();
241 #endif // MRPT_HAS_OPENNI2 247 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
252 return vDevices[sensor_id]->isOpen();
256 #endif // MRPT_HAS_OPENNI2 262 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
271 "Sensor index is higher than the number of connected devices.");
279 mrpt::format(
" The sensor [%d] is already opened\n", sensor_id));
284 "[COpenNI2Generic] DBG: [%s] about to call vDevices[%d]->open()\n",
285 __FUNCTION__, sensor_id);
291 showLog(
" open successfully.\n");
297 std::this_thread::sleep_for(1000ms);
301 #endif // MRPT_HAS_OPENNI2 305 const std::set<unsigned>& serial_required)
308 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
310 unsigned num_open_dev = 0;
311 for (
unsigned sensor_id = 0; sensor_id <
vDevices.size(); sensor_id++)
313 unsigned int serialNum;
314 if (
vDevices[sensor_id]->getSerialNumber(serialNum) ==
false)
321 "[COpenNI2Generic::openDevicesBySerialNum] checking device " 322 "with serial '%d'\n",
325 if (serial_required.find(serialNum) == serial_required.end())
339 "[COpenNI2Generic] DBG: [%s] about to call " 340 "vDevices[%d]->open(%d,%d,%d)\n",
350 "[COpenNI2Generic] DBG: [%s] now has %d devices open\n",
351 __FUNCTION__, num_open_dev);
357 #endif // MRPT_HAS_OPENNI2 361 const unsigned int SerialRequired)
363 std::set<unsigned> serial_required;
364 serial_required.insert(SerialRequired);
369 const unsigned int SerialRequired,
int& sensor_id)
const 372 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
373 for (
size_t i = 0, i_end =
vDevices.size(); i < i_end; ++i)
376 if (
vDevices[i]->getSerialNumber(sn) ==
false)
380 if (sn == SerialRequired)
391 #endif // MRPT_HAS_OPENNI2 397 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
406 "Sensor index is higher than the number of connected devices.");
412 #endif // MRPT_HAS_OPENNI2 426 bool& there_is_obs,
bool& hardware_error,
unsigned sensor_id)
437 "Sensor index is higher than the number of connected devices.");
440 rgb_img, timestamp, there_is_obs, hardware_error) ==
false)
453 #endif // MRPT_HAS_OPENNI2 468 bool& there_is_obs,
bool& hardware_error,
unsigned sensor_id)
479 "Sensor index is higher than the number of connected devices.");
482 depth_img, timestamp, there_is_obs, hardware_error) ==
false)
495 #endif // MRPT_HAS_OPENNI2 508 bool& hardware_error,
unsigned sensor_id)
519 "Sensor index is higher than the number of connected devices.");
522 out_obs, there_is_obs, hardware_error) ==
false)
534 #endif // MRPT_HAS_OPENNI2 541 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
542 if (
isOpen(sensor_id) ==
false)
551 #endif // MRPT_HAS_OPENNI2 558 std::lock_guard<std::recursive_mutex> lock(
vDevices_mx);
559 if (
isOpen(sensor_id) ==
false)
568 #endif // MRPT_HAS_OPENNI2 581 bool setONI2StreamMode(
582 openni::VideoStream& stream,
int w,
int h,
int fps,
583 openni::PixelFormat
format)
588 const openni::Array<openni::VideoMode>& modes =
589 stream.getSensorInfo().getSupportedVideoModes();
590 for (
int i = 0, i_end = modes.getSize(); i < i_end; ++i)
596 if (modes[i].getResolutionX() !=
w)
600 if (modes[i].getResolutionY() != h)
604 if (modes[i].getFps() != fps)
608 if (modes[i].getPixelFormat() !=
format)
613 if (rc != openni::STATUS_OK)
622 std::string oni2DevInfoStr(
const openni::DeviceInfo& info,
int tab)
624 std::stringstream sst;
626 for (
int i = 0; i < tab; ++i)
630 sst << space <<
"name=" << info.getName() << std::endl;
631 sst << space <<
"uri=" << info.getUri() << std::endl;
632 sst << space <<
"vendor=" << info.getVendor() << std::endl;
633 sst << space <<
"product=" << info.getUsbProductId();
637 bool cmpONI2Device(
const openni::DeviceInfo& i1,
const openni::DeviceInfo& i2)
639 return (strcmp(i1.getUri(), i2.getUri()) == 0);
642 COpenNI2Generic::CDevice::CDevice(
643 const openni::DeviceInfo& info, openni::PixelFormat rgb,
644 openni::PixelFormat
depth,
bool verbose)
645 : m_info(info), m_mirror(true), m_verbose(verbose)
647 m_streams[COLOR_STREAM] =
648 CStream::create(m_device, openni::SENSOR_COLOR, rgb, m_log,
m_verbose);
649 m_streams[IR_STREAM] =
650 CStream::create(m_device, openni::SENSOR_IR, rgb, m_log,
m_verbose);
651 m_streams[DEPTH_STREAM] = CStream::create(
655 COpenNI2Generic::CDevice::~CDevice() {
close(); }
656 bool COpenNI2Generic::CDevice::synchMirrorMode()
660 for (
auto& m_stream : m_streams)
662 if (!m_stream)
continue;
666 mirror_support = m_stream->isMirrorSupported();
668 catch (std::logic_error& e)
672 if (mirror_support ==
false)
674 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl;
675 m_log <<
" openni::STREAM_PROPERTY_MIRRORING is not supported on " 676 << m_stream->getName() <<
"." << std::endl;
677 m_log <<
" We assume this is MS Kinect and taken images are " 678 "inverted to right and left." 687 for (
auto& m_stream : m_streams)
689 if (!m_stream)
continue;
690 if (m_stream->isMirrorSupported() ==
false)
694 if (m_stream->setMirror(m_mirror) ==
false)
702 bool COpenNI2Generic::CDevice::startStreams()
706 for (
int i = 0; i < STREAM_TYPE_SIZE; ++i)
708 if (!m_streams[i])
continue;
710 printf(
" [%s] calling m_streams[%d]->start()\n", __FUNCTION__, i);
711 if (m_streams[i]->
start() ==
false)
715 " [%s] m_streams[%d]->start() returned FALSE!\n",
724 " [%s] m_streams[%d]->start() returned TRUE\n", __FUNCTION__,
729 " [COpenNI2Generic::CDevice::startStreams()] %d streams were " 736 bool COpenNI2Generic::CDevice::isOpen()
const 738 return (m_streams[COLOR_STREAM] && m_streams[COLOR_STREAM]->isValid()) ||
739 (m_streams[DEPTH_STREAM] && m_streams[DEPTH_STREAM]->isValid());
742 void COpenNI2Generic::CDevice::close()
744 for (
auto& m_stream : m_streams)
746 if (!m_stream)
continue;
752 bool COpenNI2Generic::CDevice::open(
int w,
int h,
int fps)
757 " [COpenNI2Generic::CDevice::open()] Called with w=%i h=%i " 763 if (rc != openni::STATUS_OK)
765 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
766 <<
" Failed to open device " << getInfo().getUri() <<
" " 767 << openni::OpenNI::getExtendedError() << std::endl;
770 for (
int i = 0; i < STREAM_TYPE_SIZE; ++i)
772 if (!m_streams[i])
continue;
774 printf(
" [%s] calling m_streams[%d]->open()\n", __FUNCTION__, i);
776 if (m_streams[i]->
open(
w, h, fps) ==
false)
780 " [%s] m_streams[%d]->open() returned FALSE\n",
786 " [%s] m_streams[%d]->open() returned OK\n", __FUNCTION__, i);
789 if (synchMirrorMode() ==
false)
795 if (m_streams[DEPTH_STREAM])
798 m_streams[DEPTH_STREAM]->setCloseRange(CloseRange);
799 m_log <<
" Close range: " << (CloseRange ?
"On" :
"Off") << std::endl;
803 printf(
" DBG: checking if imageRegistrationMode is supported\n");
804 if (m_device.isImageRegistrationModeSupported(
805 openni::IMAGE_REGISTRATION_DEPTH_TO_COLOR) &&
806 m_streams[DEPTH_STREAM] && m_streams[DEPTH_STREAM]->isValid() &&
807 m_streams[COLOR_STREAM] && m_streams[COLOR_STREAM]->isValid())
812 if (m_device.setImageRegistrationMode(
813 openni::IMAGE_REGISTRATION_DEPTH_TO_COLOR) != openni::STATUS_OK)
815 m_log <<
" setImageRegistrationMode() Failed:" 816 << openni::OpenNI::getExtendedError() << endl;
820 m_log <<
" setImageRegistrationMode() Success" << endl;
825 m_log <<
" Device doesn't do image registration!" << endl;
830 m_streams[COLOR_STREAM]->disableAutoExposure();
831 printf(
"DBG: returned from disableAutoExposure()\n");
834 if (startStreams() ==
false)
843 bool COpenNI2Generic::CDevice::getNextFrameRGB(
845 bool& there_is_obs,
bool& hardware_error)
852 openni::VideoFrameRef frame;
853 if (m_streams[COLOR_STREAM]->getFrame(
854 frame, timestamp, there_is_obs, hardware_error) ==
false)
858 copyFrame<openni::RGB888Pixel, mrpt::img::CImage>(frame,
img);
864 bool COpenNI2Generic::CDevice::getNextFrameD(
866 bool& there_is_obs,
bool& hardware_error)
873 openni::VideoFrameRef frame;
874 if (m_streams[DEPTH_STREAM]->getFrame(
875 frame, timestamp, there_is_obs, hardware_error) ==
false)
879 copyFrame<openni::DepthPixel, mrpt::math::CMatrixF>(frame,
img);
885 bool COpenNI2Generic::CDevice::getNextFrameRGBD(
887 bool& hardware_error)
891 there_is_obs =
false;
892 hardware_error =
false;
904 openni::VideoFrameRef frame[STREAM_TYPE_SIZE];
905 for (
int i = 0; i < STREAM_TYPE_SIZE; ++i)
907 if (!m_streams[i] || !m_streams[i]->isValid())
continue;
908 if (m_streams[i]->getFrame(
909 frame[i], tm, there_is_obs, hardware_error) ==
false)
913 if (there_is_obs ==
false || hardware_error ==
true)
919 const int width = frame[COLOR_STREAM].getWidth();
920 const int height = frame[COLOR_STREAM].getHeight();
921 if ((frame[DEPTH_STREAM].getWidth() !=
width) ||
924 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
925 <<
" Both frames don't have the same size." << std::endl;
937 const char*
data[STREAM_TYPE_SIZE] = {
938 (
const char*)frame[COLOR_STREAM].getData(),
939 (
const char*)frame[DEPTH_STREAM].getData()};
940 const int step[STREAM_TYPE_SIZE] = {frame[COLOR_STREAM].getStrideInBytes(),
941 frame[DEPTH_STREAM].getStrideInBytes()};
943 for (
int yc = 0; yc <
height; ++yc)
945 const auto* pRgb = (
const openni::RGB888Pixel*)
data[COLOR_STREAM];
946 const auto* pDepth = (
const openni::DepthPixel*)
data[DEPTH_STREAM];
947 for (
int xc = 0; xc <
width; ++xc, ++pDepth, ++pRgb)
957 data[COLOR_STREAM] += step[COLOR_STREAM];
958 data[DEPTH_STREAM] += step[DEPTH_STREAM];
966 const openni::DeviceInfo& info, openni::PixelFormat rgb,
967 openni::PixelFormat
depth,
bool verbose)
969 return Ptr(
new CDevice(info, rgb,
depth, verbose));
972 bool COpenNI2Generic::CDevice::getSerialNumber(
std::string& sn)
977 if (isOpened ==
false)
979 rc = m_device.open(getInfo().getUri());
980 if (rc != openni::STATUS_OK)
982 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
983 <<
" Failed to open device " << getInfo().getUri() <<
" " 984 << openni::OpenNI::getExtendedError() << std::endl;
988 char serialNumber[16];
989 rc = m_device.getProperty(ONI_DEVICE_PROPERTY_SERIAL_NUMBER, &serialNumber);
990 if (rc != openni::STATUS_OK)
992 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
993 <<
" Failed to getProperty(ONI_DEVICE_PROPERTY_SERIAL_NUMBER) " 994 << getInfo().getUri() <<
" " << openni::OpenNI::getExtendedError()
999 if (isOpened ==
false)
1006 bool COpenNI2Generic::CDevice::getSerialNumber(
unsigned int& sn)
1009 if (getSerialNumber(str) ==
false)
1013 std::stringstream sst;
1021 std::ostream& log,
bool verbose)
1024 m_strName(
"Unknown"),
1029 if (m_type == openni::SENSOR_COLOR)
1031 m_strName =
"openni::SENSOR_COLOR";
1033 else if (m_type == openni::SENSOR_DEPTH)
1035 m_strName =
"openni::SENSOR_DEPTH";
1037 else if (m_type == openni::SENSOR_IR)
1039 m_strName =
"openni::SENSOR_IR";
1043 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1044 <<
" Unknown SensorType -> " << m_type << std::endl;
1048 COpenNI2Generic::CDevice::CStream::~CStream() { destroy(); }
1049 bool COpenNI2Generic::CDevice::CStream::isMirrorSupported()
const 1051 if (isValid() ==
false)
1055 return m_stream.isPropertySupported(openni::STREAM_PROPERTY_MIRRORING);
1058 bool COpenNI2Generic::CDevice::CStream::setMirror(
bool flag)
1060 if (isValid() ==
false)
1062 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1063 <<
" " << getName() <<
" is not opened." << std::endl;
1066 if (m_stream.isPropertySupported(openni::STREAM_PROPERTY_MIRRORING) ==
1071 if (m_stream.setMirroringEnabled(flag) != openni::STATUS_OK)
1073 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1074 <<
" setMirroringEnabled() failed: " 1075 << openni::OpenNI::getExtendedError() << std::endl;
1081 bool COpenNI2Generic::CDevice::CStream::isValid()
const 1083 return m_stream.isValid();
1086 void COpenNI2Generic::CDevice::CStream::destroy() { m_stream.destroy(); }
1087 void COpenNI2Generic::CDevice::CStream::setCloseRange(
int&
value)
1091 " [CDevice::CStream::setCloseRange] entry with value=%d\n",
1093 m_stream.setProperty(XN_STREAM_PROPERTY_CLOSE_RANGE,
value);
1096 " [CDevice::CStream::setCloseRange] returned from " 1097 "mstream.setProperty()\n");
1098 m_stream.getProperty(XN_STREAM_PROPERTY_CLOSE_RANGE, &
value);
1101 " [CDevice::CStream::setCloseRange] returned from " 1102 "mstream.getProperty() ... value %d\n",
1106 bool COpenNI2Generic::CDevice::CStream::open(
int w,
int h,
int fps)
1109 if (m_type != openni::SENSOR_COLOR && m_type != openni::SENSOR_DEPTH &&
1110 m_type != openni::SENSOR_IR)
1112 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1113 <<
" Unknown SensorType -> " << m_type << std::endl;
1118 " [COpenNI2Generic::CDevice::CStream::open] opening sensor " 1119 "stream with m_type == %d\n",
1128 rc = m_stream.create(m_device, m_type);
1129 if (rc != openni::STATUS_OK)
1131 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1132 <<
" Couldn't find sensor " << m_strName <<
":" 1133 << openni::OpenNI::getExtendedError() << std::endl;
1134 if (m_type == openni::SENSOR_COLOR)
1136 m_type = openni::SENSOR_IR;
1137 m_strName =
"openni::SENSOR_IR";
1139 printf(
"DBG: changing type to SENSOR_IR (%d)\n", (
int)m_type);
1140 rc = m_stream.create(m_device, m_type);
1145 if (m_verbose) printf(
"returned OK from stream.create()\n");
1146 openni::VideoMode options = m_stream.getVideoMode();
1147 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl;
1148 m_log <<
" " << m_strName << std::endl;
1151 "Initial resolution (%d, %d) FPS %d Format %d",
1152 options.getResolutionX(), options.getResolutionY(),
1153 options.getFps(), options.getPixelFormat())
1155 if (m_verbose) printf(
"DBG: calling setONI2StreamMode()\n");
1156 if (setONI2StreamMode(m_stream,
w, h, fps, m_format) ==
false)
1158 m_log <<
" Can't find desired mode in the " << getName() << std::endl;
1162 if (m_verbose) printf(
"DBG: returned OK from setONI2StreamMode()\n");
1163 if (m_verbose) printf(
"DBG: calling stream.getVideoMode()\n");
1164 options = m_stream.getVideoMode();
1167 "-> (%d, %d) FPS %d Format %d", options.getResolutionX(),
1168 options.getResolutionY(), options.getFps(),
1169 options.getPixelFormat())
1173 " [COpenNI2Generic::CDevice::CStream::open] returning TRUE\n");
1179 if (isValid() ==
false)
1181 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1182 <<
" " << getName() <<
" is not opened." << std::endl;
1185 if (m_stream.start() != openni::STATUS_OK)
1187 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1188 <<
" Couldn't start " << getName()
1189 <<
" stream:" << openni::OpenNI::getExtendedError() << std::endl;
1196 COpenNI2Generic::CDevice::CStream::Ptr
1197 COpenNI2Generic::CDevice::CStream::create(
1199 openni::PixelFormat
format, std::ostream& log,
bool verbose)
1204 bool COpenNI2Generic::CDevice::CStream::getFrame(
1206 bool& there_is_obs,
bool& hardware_error)
1208 there_is_obs =
false;
1209 hardware_error =
false;
1210 if (isValid() ==
false)
1215 if (rc != openni::STATUS_OK)
1217 hardware_error =
true;
1219 mrpt::format(
"Failed to grab frame from %s", getName().c_str());
1222 there_is_obs =
true;
1227 #endif // MRPT_HAS_OPENNI2
void setVerbose(bool verbose)
int getNumDevices() const
The number of available devices at initialization.
bool getDepthSensorParam(mrpt::img::TCamera ¶m, unsigned sensor_id=0) const
#define THROW_EXCEPTION(msg)
mrpt::system::TTimeStamp getCurrentTime()
Returns the current (UTC) system time.
void getNextFrameRGB(mrpt::img::CImage &rgb_img, mrpt::system::TTimeStamp ×tamp, bool &there_is_obs, bool &hardware_error, unsigned sensor_id=0)
The main data retrieving function, to be called after calling loadConfig() and initialize().
mrpt::math::CMatrixF rangeImage
If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters) ...
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement, as from a time-of-flight range camera or any other RGBD sensor.
void getNextFrameRGBD(mrpt::obs::CObservation3DRangeScan &out_obs, bool &there_is_obs, bool &hardware_error, unsigned sensor_id=0)
The main data retrieving function, to be called after calling loadConfig() and initialize().
Contains classes for various device interfaces.
COpenNI2Generic()
Default ctor (width=640, height=480, fps=30)
GLint GLint GLsizei GLsizei GLsizei depth
mrpt::io::CStream CStream
GLubyte GLubyte GLubyte GLubyte w
int m_width
The same options (width, height and fps) are set for all the sensors.
void kill()
Kill the OpenNI2 driver.
std::vector< std::shared_ptr< COpenNI2Generic::CDevice > > vDevices
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
unsigned int openDeviceBySerial(const unsigned int SerialRequired)
Open a RGBD device specified by its serial number.
bool start()
Open all sensor streams (normally called automatically at constructor, no need to call it manually)...
bool getColorSensorParam(mrpt::img::TCamera ¶m, unsigned sensor_id=0) const
bool isOpen(const unsigned sensor_id) const
Whether there is a working connection to the sensor.
mrpt::img::CImage intensityImage
If hasIntensityImage=true, a color or gray-level intensity image of the same size than "rangeImage"...
static int getNumInstances()
Get the number of OpenNI2 cameras currently open via COpenNI2Generic.
This namespace contains representation of robot actions and observations.
bool hasRangeImage
true means the field rangeImage contains valid data
void close(unsigned sensor_id=0)
Close the connection to the sensor (no need to call it manually unless desired for some reason...
Structure to hold the parameters of a pinhole camera model.
std::atomic< int > numInstances(0)
enum Status { eInsideTag=0, eOutsideTag } Status
bool hasPoints3D
true means the field points3D contains valid data.
GLsizei const GLchar ** string
unsigned int openDevicesBySerialNum(const std::set< unsigned > &vSerialRequired)
Open a set of RGBD devices specified by their serial number.
void getNextFrameD(mrpt::math::CMatrixF &depth_img, mrpt::system::TTimeStamp ×tamp, bool &there_is_obs, bool &hardware_error, unsigned sensor_id=0)
The main data retrieving function, to be called after calling loadConfig() and initialize().
This class is a "CSerializable" wrapper for "CMatrixFloat".
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
bool hasIntensityImage
true means the field intensityImage contains valid data
std::recursive_mutex vDevices_mx
void open(unsigned sensor_id=0)
Try to open the camera (all the parameters [resolution,fps,...] must be set before calling this) - us...
bool getDeviceIDFromSerialNum(const unsigned int SerialRequired, int &sensor_id) const
Get the ID of the device corresponding to 'SerialRequired'.
GLenum GLsizei GLenum format
int getConnectedDevices()
Get a list of the connected OpenNI2 sensors.
GLsizei const GLfloat * value
void showLog(const std::string &message) const
~COpenNI2Generic()
Default ctor.
double getHeight(const TPolygon3D &p, const TPoint3D &c)
GLenum GLsizei GLsizei height
bool range_is_depth
true: Kinect-like ranges: entries of rangeImage are distances along the +X axis; false: Ranges in ran...
GLsizei GLsizei GLenum GLenum const GLvoid * data
GLuint GLuint GLsizei GLenum type
A class for storing images as grayscale or RGB bitmaps.
bool hasConfidenceImage
true means the field confidenceImage contains valid data
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.