17 #include <mrpt/otherlibs/do_opencv_includes.h> 25 #if !defined(MRPT_OS_WINDOWS) 39 std::vector<std::shared_ptr<COpenNI2Generic::CDevice>>
41 std::vector<std::shared_ptr<COpenNI2Generic::CDevice>>();
45 bool setONI2StreamMode(
46 openni::VideoStream& stream,
int w,
int h,
int fps,
47 openni::PixelFormat
format);
48 std::string oni2DevInfoStr(
const openni::DeviceInfo& info,
int tab = 0);
49 bool cmpONI2Device(
const openni::DeviceInfo& i1,
const openni::DeviceInfo& i2);
50 #endif // MRPT_HAS_OPENNI2 61 m_rgb_format(openni::PIXEL_FORMAT_RGB888),
62 m_depth_format(openni::PIXEL_FORMAT_DEPTH_1_MM),
67 m_grab_3D_points(true)
69 const char* sVerbose = getenv(
"MRPT_HWDRIVERS_VERBOSE");
70 m_verbose = (sVerbose !=
nullptr) && atoi(sVerbose) != 0;
77 "After initialization:\n %s\n",
78 openni::OpenNI::getExtendedError()))
84 int width,
int height,
float fps,
bool open_streams_now)
89 m_rgb_format(openni::PIXEL_FORMAT_RGB888),
90 m_depth_format(openni::PIXEL_FORMAT_DEPTH_1_MM),
95 m_grab_3D_points(true)
97 const char* sVerbose = getenv(
"MRPT_HWDRIVERS_VERBOSE");
98 m_verbose = (sVerbose !=
nullptr) && atoi(sVerbose) != 0;
100 if (open_streams_now)
107 "After initialization:\n %s\n",
108 openni::OpenNI::getExtendedError()))
119 if (openni::OpenNI::initialize() != openni::STATUS_OK)
125 std::cerr <<
"[" << __FUNCTION__ <<
"]" << std::endl
126 <<
" Initialized OpenNI2." << std::endl;
133 #endif // MRPT_HAS_OPENNI2 157 std::cerr << message;
168 openni::Array<openni::DeviceInfo> oni2InfoArray;
169 openni::OpenNI::enumerateDevices(&oni2InfoArray);
171 const size_t numDevices = oni2InfoArray.getSize();
175 " Get device list. %d devices connected.\n", (
int)numDevices));
178 std::set<int> newDevices;
179 for (
unsigned i = 0; i < numDevices; i++)
181 const openni::DeviceInfo& info = oni2InfoArray[i];
183 showLog(oni2DevInfoStr(info, 3) +
"\n");
185 bool isExist =
false;
186 for (
unsigned int j = 0, j_end =
vDevices.size();
187 j < j_end && isExist ==
false; ++j)
189 if (cmpONI2Device(info,
vDevices[j]->getInfo()))
194 if (isExist ==
false)
196 newDevices.insert(i);
201 it_end = newDevices.end();
204 const openni::DeviceInfo& info = oni2InfoArray[*it];
211 if (device->getSerialNumber(sn))
214 mrpt::format(
"Device[%d]: serial number: `%u`\n", *it, sn));
221 showLog(
" No devices connected -> EXIT\n");
230 #endif // MRPT_HAS_OPENNI2 237 openni::OpenNI::shutdown();
240 #endif // MRPT_HAS_OPENNI2 250 return vDevices[sensor_id]->isOpen();
254 #endif // MRPT_HAS_OPENNI2 268 "Sensor index is higher than the number of connected devices.")
276 mrpt::format(
" The sensor [%d] is already opened\n", sensor_id));
281 "[COpenNI2Generic] DBG: [%s] about to call vDevices[%d]->open()\n",
282 __FUNCTION__, sensor_id);
288 showLog(
" open successfully.\n");
294 std::this_thread::sleep_for(1000ms);
298 #endif // MRPT_HAS_OPENNI2 302 const std::set<unsigned>& serial_required)
306 unsigned num_open_dev = 0;
307 for (
unsigned sensor_id = 0; sensor_id <
vDevices.size(); sensor_id++)
309 unsigned int serialNum;
310 if (
vDevices[sensor_id]->getSerialNumber(serialNum) ==
false)
317 "[COpenNI2Generic::openDevicesBySerialNum] checking device " 318 "with serial '%d'\n",
321 if (serial_required.find(serialNum) == serial_required.end())
335 "[COpenNI2Generic] DBG: [%s] about to call " 336 "vDevices[%d]->open(%d,%d,%d)\n",
346 "[COpenNI2Generic] DBG: [%s] now has %d devices open\n",
347 __FUNCTION__, num_open_dev);
353 #endif // MRPT_HAS_OPENNI2 357 const unsigned int SerialRequired)
359 std::set<unsigned> serial_required;
360 serial_required.insert(SerialRequired);
365 const unsigned int SerialRequired,
int& sensor_id)
const 368 for (
size_t i = 0, i_end =
vDevices.size(); i < i_end; ++i)
371 if (
vDevices[i]->getSerialNumber(sn) ==
false)
375 if (sn == SerialRequired)
386 #endif // MRPT_HAS_OPENNI2 400 "Sensor index is higher than the number of connected devices.")
406 #endif // MRPT_HAS_OPENNI2 420 bool& hardware_error,
unsigned sensor_id)
431 "Sensor index is higher than the number of connected devices.")
434 rgb_img, timestamp, there_is_obs, hardware_error) ==
false)
447 #endif // MRPT_HAS_OPENNI2 462 bool& hardware_error,
unsigned sensor_id)
473 "Sensor index is higher than the number of connected devices.")
476 depth_img, timestamp, there_is_obs, hardware_error) ==
false)
489 #endif // MRPT_HAS_OPENNI2 502 bool& hardware_error,
unsigned sensor_id)
513 "Sensor index is higher than the number of connected devices.")
516 out_obs, there_is_obs, hardware_error) ==
false)
528 #endif // MRPT_HAS_OPENNI2 535 if (
isOpen(sensor_id) ==
false)
544 #endif // MRPT_HAS_OPENNI2 551 if (
isOpen(sensor_id) ==
false)
560 #endif // MRPT_HAS_OPENNI2 573 bool setONI2StreamMode(
574 openni::VideoStream& stream,
int w,
int h,
int fps,
575 openni::PixelFormat
format)
580 const openni::Array<openni::VideoMode>& modes =
581 stream.getSensorInfo().getSupportedVideoModes();
582 for (
int i = 0, i_end = modes.getSize(); i < i_end; ++i)
588 if (modes[i].getResolutionX() !=
w)
592 if (modes[i].getResolutionY() != h)
596 if (modes[i].getFps() != fps)
600 if (modes[i].getPixelFormat() !=
format)
605 if (rc != openni::STATUS_OK)
614 std::string oni2DevInfoStr(
const openni::DeviceInfo& info,
int tab)
616 std::stringstream sst;
618 for (
int i = 0; i < tab; ++i)
622 sst << space <<
"name=" << info.getName() << std::endl;
623 sst << space <<
"uri=" << info.getUri() << std::endl;
624 sst << space <<
"vendor=" << info.getVendor() << std::endl;
625 sst << space <<
"product=" << info.getUsbProductId();
629 bool cmpONI2Device(
const openni::DeviceInfo& i1,
const openni::DeviceInfo& i2)
631 return (strcmp(i1.getUri(), i2.getUri()) == 0);
634 COpenNI2Generic::CDevice::CDevice(
635 const openni::DeviceInfo& info, openni::PixelFormat rgb,
636 openni::PixelFormat
depth,
bool verbose)
637 : m_info(info), m_mirror(true), m_verbose(verbose)
639 m_streams[COLOR_STREAM] =
640 CStream::create(m_device, openni::SENSOR_COLOR, rgb, m_log,
m_verbose);
641 m_streams[IR_STREAM] =
642 CStream::create(m_device, openni::SENSOR_IR, rgb, m_log,
m_verbose);
643 m_streams[DEPTH_STREAM] = CStream::create(
647 COpenNI2Generic::CDevice::~CDevice() {
close(); }
648 bool COpenNI2Generic::CDevice::synchMirrorMode()
652 for (
int i = 0; i < STREAM_TYPE_SIZE; ++i)
654 if (!m_streams[i])
continue;
658 mirror_support = m_streams[i]->isMirrorSupported();
660 catch (std::logic_error& e)
664 if (mirror_support ==
false)
666 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl;
667 m_log <<
" openni::STREAM_PROPERTY_MIRRORING is not supported on " 668 << m_streams[i]->getName() <<
"." << std::endl;
669 m_log <<
" We assume this is MS Kinect and taken images are " 670 "inverted to right and left." 679 for (
int i = 0; i < STREAM_TYPE_SIZE; ++i)
681 if (!m_streams[i])
continue;
682 if (m_streams[i]->isMirrorSupported() ==
false)
686 if (m_streams[i]->setMirror(m_mirror) ==
false)
694 bool COpenNI2Generic::CDevice::startStreams()
698 for (
int i = 0; i < STREAM_TYPE_SIZE; ++i)
700 if (!m_streams[i])
continue;
702 printf(
" [%s] calling m_streams[%d]->start()\n", __FUNCTION__, i);
703 if (m_streams[i]->
start() ==
false)
707 " [%s] m_streams[%d]->start() returned FALSE!\n",
716 " [%s] m_streams[%d]->start() returned TRUE\n", __FUNCTION__,
721 " [COpenNI2Generic::CDevice::startStreams()] %d streams were " 728 bool COpenNI2Generic::CDevice::isOpen()
const 730 return (m_streams[COLOR_STREAM] && m_streams[COLOR_STREAM]->isValid()) ||
731 (m_streams[DEPTH_STREAM] && m_streams[DEPTH_STREAM]->isValid());
734 void COpenNI2Generic::CDevice::close()
736 for (
int i = 0; i < STREAM_TYPE_SIZE; ++i)
738 if (!m_streams[i])
continue;
739 m_streams[i]->destroy();
744 bool COpenNI2Generic::CDevice::open(
int w,
int h,
int fps)
749 " [COpenNI2Generic::CDevice::open()] Called with w=%i h=%i " 755 if (rc != openni::STATUS_OK)
757 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
758 <<
" Failed to open device " << getInfo().getUri() <<
" " 759 << openni::OpenNI::getExtendedError() << std::endl;
762 for (
int i = 0; i < STREAM_TYPE_SIZE; ++i)
764 if (!m_streams[i])
continue;
766 printf(
" [%s] calling m_streams[%d]->open()\n", __FUNCTION__, i);
768 if (m_streams[i]->
open(
w, h, fps) ==
false)
772 " [%s] m_streams[%d]->open() returned FALSE\n",
778 " [%s] m_streams[%d]->open() returned OK\n", __FUNCTION__, i);
781 if (synchMirrorMode() ==
false)
787 if (m_streams[DEPTH_STREAM])
790 m_streams[DEPTH_STREAM]->setCloseRange(CloseRange);
791 m_log <<
" Close range: " << (CloseRange ?
"On" :
"Off") << std::endl;
795 printf(
" DBG: checking if imageRegistrationMode is supported\n");
796 if (m_device.isImageRegistrationModeSupported(
797 openni::IMAGE_REGISTRATION_DEPTH_TO_COLOR) &&
798 m_streams[DEPTH_STREAM] && m_streams[DEPTH_STREAM]->isValid() &&
799 m_streams[COLOR_STREAM] && m_streams[COLOR_STREAM]->isValid())
804 if (m_device.setImageRegistrationMode(
805 openni::IMAGE_REGISTRATION_DEPTH_TO_COLOR) != openni::STATUS_OK)
807 m_log <<
" setImageRegistrationMode() Failed:" 808 << openni::OpenNI::getExtendedError() << endl;
812 m_log <<
" setImageRegistrationMode() Success" << endl;
817 m_log <<
" Device doesn't do image registration!" << endl;
822 m_streams[COLOR_STREAM]->disableAutoExposure();
823 printf(
"DBG: returned from disableAutoExposure()\n");
826 if (startStreams() ==
false)
835 bool COpenNI2Generic::CDevice::getNextFrameRGB(
837 bool& hardware_error)
844 openni::VideoFrameRef frame;
845 if (m_streams[COLOR_STREAM]->getFrame(
846 frame, timestamp, there_is_obs, hardware_error) ==
false)
850 copyFrame<openni::RGB888Pixel, mrpt::utils::CImage>(frame,
img);
856 bool COpenNI2Generic::CDevice::getNextFrameD(
858 bool& hardware_error)
865 openni::VideoFrameRef frame;
866 if (m_streams[DEPTH_STREAM]->getFrame(
867 frame, timestamp, there_is_obs, hardware_error) ==
false)
871 copyFrame<openni::DepthPixel, mrpt::math::CMatrix>(frame,
img);
877 bool COpenNI2Generic::CDevice::getNextFrameRGBD(
879 bool& hardware_error)
883 there_is_obs =
false;
884 hardware_error =
false;
896 openni::VideoFrameRef frame[STREAM_TYPE_SIZE];
897 for (
int i = 0; i < STREAM_TYPE_SIZE; ++i)
899 if (!m_streams[i] || !m_streams[i]->isValid())
continue;
900 if (m_streams[i]->getFrame(
901 frame[i], tm, there_is_obs, hardware_error) ==
false)
905 if (there_is_obs ==
false || hardware_error ==
true)
911 const int width = frame[COLOR_STREAM].getWidth();
912 const int height = frame[COLOR_STREAM].getHeight();
913 if ((frame[DEPTH_STREAM].getWidth() !=
width) ||
916 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
917 <<
" Both frames don't have the same size." << std::endl;
929 const char*
data[STREAM_TYPE_SIZE] = {
930 (
const char*)frame[COLOR_STREAM].getData(),
931 (
const char*)frame[DEPTH_STREAM].getData()};
932 const int step[STREAM_TYPE_SIZE] = {frame[COLOR_STREAM].getStrideInBytes(),
933 frame[DEPTH_STREAM].getStrideInBytes()};
935 for (
int yc = 0; yc <
height; ++yc)
937 const openni::RGB888Pixel* pRgb =
938 (
const openni::RGB888Pixel*)
data[COLOR_STREAM];
939 const openni::DepthPixel* pDepth =
940 (
const openni::DepthPixel*)
data[DEPTH_STREAM];
941 for (
int xc = 0; xc <
width; ++xc, ++pDepth, ++pRgb)
951 data[COLOR_STREAM] += step[COLOR_STREAM];
952 data[DEPTH_STREAM] += step[DEPTH_STREAM];
960 const openni::DeviceInfo& info, openni::PixelFormat rgb,
961 openni::PixelFormat
depth,
bool verbose)
963 return Ptr(
new CDevice(info, rgb,
depth, verbose));
966 bool COpenNI2Generic::CDevice::getSerialNumber(
std::string& sn)
971 if (isOpened ==
false)
973 rc = m_device.open(getInfo().getUri());
974 if (rc != openni::STATUS_OK)
976 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
977 <<
" Failed to open device " << getInfo().getUri() <<
" " 978 << openni::OpenNI::getExtendedError() << std::endl;
982 char serialNumber[16];
983 rc = m_device.getProperty(ONI_DEVICE_PROPERTY_SERIAL_NUMBER, &serialNumber);
984 if (rc != openni::STATUS_OK)
986 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
987 <<
" Failed to getProperty(ONI_DEVICE_PROPERTY_SERIAL_NUMBER) " 988 << getInfo().getUri() <<
" " << openni::OpenNI::getExtendedError()
993 if (isOpened ==
false)
1000 bool COpenNI2Generic::CDevice::getSerialNumber(
unsigned int& sn)
1003 if (getSerialNumber(str) ==
false)
1007 std::stringstream sst;
1013 COpenNI2Generic::CDevice::CStream::CStream(
1015 std::ostream& log,
bool verbose)
1018 m_strName(
"Unknown"),
1023 if (m_type == openni::SENSOR_COLOR)
1025 m_strName =
"openni::SENSOR_COLOR";
1027 else if (m_type == openni::SENSOR_DEPTH)
1029 m_strName =
"openni::SENSOR_DEPTH";
1031 else if (m_type == openni::SENSOR_IR)
1033 m_strName =
"openni::SENSOR_IR";
1037 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1038 <<
" Unknown SensorType -> " << m_type << std::endl;
1042 COpenNI2Generic::CDevice::CStream::~CStream() { destroy(); }
1043 bool COpenNI2Generic::CDevice::CStream::isMirrorSupported()
const 1045 if (isValid() ==
false)
1049 return m_stream.isPropertySupported(openni::STREAM_PROPERTY_MIRRORING);
1052 bool COpenNI2Generic::CDevice::CStream::setMirror(
bool flag)
1054 if (isValid() ==
false)
1056 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1057 <<
" " << getName() <<
" is not opened." << std::endl;
1060 if (m_stream.isPropertySupported(openni::STREAM_PROPERTY_MIRRORING) ==
1065 if (m_stream.setMirroringEnabled(flag) != openni::STATUS_OK)
1067 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1068 <<
" setMirroringEnabled() failed: " 1069 << openni::OpenNI::getExtendedError() << std::endl;
1075 bool COpenNI2Generic::CDevice::CStream::isValid()
const 1077 return m_stream.isValid();
1080 void COpenNI2Generic::CDevice::CStream::destroy() { m_stream.destroy(); }
1081 void COpenNI2Generic::CDevice::CStream::setCloseRange(
int&
value)
1085 " [CDevice::CStream::setCloseRange] entry with value=%d\n",
1087 m_stream.setProperty(XN_STREAM_PROPERTY_CLOSE_RANGE,
value);
1090 " [CDevice::CStream::setCloseRange] returned from " 1091 "mstream.setProperty()\n");
1092 m_stream.getProperty(XN_STREAM_PROPERTY_CLOSE_RANGE, &
value);
1095 " [CDevice::CStream::setCloseRange] returned from " 1096 "mstream.getProperty() ... value %d\n",
1100 bool COpenNI2Generic::CDevice::CStream::open(
int w,
int h,
int fps)
1103 if (m_type != openni::SENSOR_COLOR && m_type != openni::SENSOR_DEPTH &&
1104 m_type != openni::SENSOR_IR)
1106 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1107 <<
" Unknown SensorType -> " << m_type << std::endl;
1112 " [COpenNI2Generic::CDevice::CStream::open] opening sensor " 1113 "stream with m_type == %d\n",
1122 rc = m_stream.create(m_device, m_type);
1123 if (rc != openni::STATUS_OK)
1125 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1126 <<
" Couldn't find sensor " << m_strName <<
":" 1127 << openni::OpenNI::getExtendedError() << std::endl;
1128 if (m_type == openni::SENSOR_COLOR)
1130 m_type = openni::SENSOR_IR;
1131 m_strName =
"openni::SENSOR_IR";
1133 printf(
"DBG: changing type to SENSOR_IR (%d)\n", (
int)m_type);
1134 rc = m_stream.create(m_device, m_type);
1139 if (m_verbose) printf(
"returned OK from stream.create()\n");
1140 openni::VideoMode options = m_stream.getVideoMode();
1141 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl;
1142 m_log <<
" " << m_strName << std::endl;
1144 "Initial resolution (%d, %d) FPS %d Format %d",
1145 options.getResolutionX(), options.getResolutionY(),
1146 options.getFps(), options.getPixelFormat())
1148 if (m_verbose) printf(
"DBG: calling setONI2StreamMode()\n");
1149 if (setONI2StreamMode(m_stream,
w, h, fps, m_format) ==
false)
1151 m_log <<
" Can't find desired mode in the " << getName() << std::endl;
1155 if (m_verbose) printf(
"DBG: returned OK from setONI2StreamMode()\n");
1156 if (m_verbose) printf(
"DBG: calling stream.getVideoMode()\n");
1157 options = m_stream.getVideoMode();
1159 "-> (%d, %d) FPS %d Format %d",
1160 options.getResolutionX(), options.getResolutionY(),
1161 options.getFps(), options.getPixelFormat())
1165 " [COpenNI2Generic::CDevice::CStream::open] returning TRUE\n");
1171 if (isValid() ==
false)
1173 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1174 <<
" " << getName() <<
" is not opened." << std::endl;
1177 if (m_stream.start() != openni::STATUS_OK)
1179 m_log <<
"[" << __FUNCTION__ <<
"]" << std::endl
1180 <<
" Couldn't start " << getName()
1181 <<
" stream:" << openni::OpenNI::getExtendedError() << std::endl;
1188 COpenNI2Generic::CDevice::CStream::Ptr
1189 COpenNI2Generic::CDevice::CStream::create(
1191 openni::PixelFormat
format, std::ostream& log,
bool verbose)
1193 return Ptr(
new CStream(device,
type,
format, log, verbose));
1196 bool COpenNI2Generic::CDevice::CStream::getFrame(
1197 openni::VideoFrameRef& frame,
uint64_t& timestamp,
bool& there_is_obs,
1198 bool& hardware_error)
1200 there_is_obs =
false;
1201 hardware_error =
false;
1202 if (isValid() ==
false)
1207 if (rc != openni::STATUS_OK)
1209 hardware_error =
true;
1211 mrpt::format(
"Failed to grab frame from %s", getName().c_str());
1214 there_is_obs =
true;
1219 #endif // MRPT_HAS_OPENNI2 uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
void setVerbose(bool verbose)
int getNumDevices() const
The number of available devices at initialization.
void getNextFrameRGB(mrpt::utils::CImage &rgb_img, uint64_t ×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().
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
A class for storing images as grayscale or RGB bitmaps.
mrpt::system::TTimeStamp getCurrentTime()
Returns the current (UTC) system time.
#define THROW_EXCEPTION(msg)
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
const Scalar * const_iterator
std::shared_ptr< CDevice > Ptr
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.
mrpt::math::CMatrix rangeImage
If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters) ...
bool getDepthSensorParam(mrpt::utils::TCamera ¶m, unsigned sensor_id=0) const
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)...
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
bool isOpen(const unsigned sensor_id) const
Whether there is a working connection to the sensor.
This namespace contains representation of robot actions and observations.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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...
bool hasPoints3D
true means the field points3D contains valid data.
GLsizei const GLchar ** string
void getNextFrameD(mrpt::math::CMatrix &depth_img, uint64_t ×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().
static std::vector< std::shared_ptr< CDevice > > vDevices
unsigned int openDevicesBySerialNum(const std::set< unsigned > &vSerialRequired)
Open a set of RGBD devices specified by their serial number.
unsigned __int64 uint64_t
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
bool getColorSensorParam(mrpt::utils::TCamera ¶m, unsigned sensor_id=0) const
bool hasIntensityImage
true means the field intensityImage contains valid data
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.
mrpt::utils::CImage intensityImage
If hasIntensityImage=true, a color or gray-level intensity image of the same size than "rangeImage"...
This class is a "CSerializable" wrapper for "CMatrixFloat".
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
Structure to hold the parameters of a pinhole camera model.
bool hasConfidenceImage
true means the field confidenceImage contains valid data