36 #include <visp3/core/vpConfig.h>
38 #if defined(VISP_HAVE_OCCIPITAL_STRUCTURE) && (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) && defined(VISP_HAVE_THREADS)
46 #include <ST/Utilities.h>
48 #include <visp3/core/vpImageConvert.h>
49 #include <visp3/core/vpMeterPixelConversion.h>
50 #include <visp3/core/vpPoint.h>
51 #include <visp3/sensor/vpOccipitalStructure.h>
53 #define MANUAL_POINTCLOUD 1
75 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
85 *ts =
m_delegate.m_visibleFrame.arrivalTimestamp();
99 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
104 if (
m_delegate.m_cameraType == ST::StructureCoreCameraType::Color)
106 reinterpret_cast<unsigned char *
>(rgb.
bitmap),
113 reinterpret_cast<unsigned char *
>(rgb.
bitmap),
117 reinterpret_cast<unsigned char *
>(rgb.
bitmap),
122 *ts =
m_delegate.m_visibleFrame.arrivalTimestamp();
138 vpColVector *gyroscope_data,
bool undistorted,
double *ts)
140 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
143 if (rgb !=
nullptr &&
m_delegate.m_visibleFrame.isValid()) {
145 if (
m_delegate.m_cameraType == ST::StructureCoreCameraType::Color)
147 reinterpret_cast<unsigned char *
>(rgb->
bitmap),
154 reinterpret_cast<unsigned char *
>(rgb->
bitmap),
158 reinterpret_cast<unsigned char *
>(rgb->
bitmap),
163 *ts =
m_delegate.m_visibleFrame.arrivalTimestamp();
167 memcpy((
unsigned char *)
depth->bitmap,
m_delegate.m_depthFrame.convertDepthToRgba(),
170 if (acceleration_data !=
nullptr) {
171 ST::Acceleration accel =
m_delegate.m_accelerometerEvent.acceleration();
172 acceleration_data[0] = accel.x;
173 acceleration_data[1] = accel.y;
174 acceleration_data[2] = accel.z;
177 if (gyroscope_data !=
nullptr) {
178 ST::RotationRate gyro_data =
m_delegate.m_gyroscopeEvent.rotationRate();
179 gyroscope_data[0] = gyro_data.x;
180 gyroscope_data[1] = gyro_data.y;
181 gyroscope_data[2] = gyro_data.z;
185 *ts =
m_delegate.m_visibleFrame.arrivalTimestamp();
200 vpColVector *gyroscope_data,
bool undistorted,
double *ts)
202 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
205 if (gray !=
nullptr &&
m_delegate.m_visibleFrame.isValid()) {
212 *ts =
m_delegate.m_visibleFrame.arrivalTimestamp();
216 memcpy((
unsigned char *)
depth->bitmap,
m_delegate.m_depthFrame.convertDepthToRgba(),
219 if (acceleration_data !=
nullptr) {
220 ST::Acceleration accel =
m_delegate.m_accelerometerEvent.acceleration();
221 acceleration_data[0] = accel.x;
222 acceleration_data[1] = accel.y;
223 acceleration_data[2] = accel.z;
226 if (gyroscope_data !=
nullptr) {
227 ST::RotationRate gyro_data =
m_delegate.m_gyroscopeEvent.rotationRate();
228 gyroscope_data[0] = gyro_data.x;
229 gyroscope_data[1] = gyro_data.y;
230 gyroscope_data[2] = gyro_data.z;
234 *ts =
m_delegate.m_visibleFrame.arrivalTimestamp();
251 std::vector<vpColVector> *
const data_pointCloud,
unsigned char *
const data_infrared,
255 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
258 if (
m_delegate.m_depthFrame.isValid() && data_depth !=
nullptr)
259 memcpy(data_depth,
m_delegate.m_depthFrame.depthInMillimeters(),
262 if (
m_delegate.m_visibleFrame.isValid() && data_image !=
nullptr) {
263 if (
m_delegate.m_cameraType == ST::StructureCoreCameraType::Color)
265 reinterpret_cast<unsigned char *
>(data_image),
272 reinterpret_cast<unsigned char *
>(data_image),
276 reinterpret_cast<unsigned char *
>(data_image),
281 if (
m_delegate.m_infraredFrame.isValid() && data_infrared !=
nullptr)
282 memcpy(data_infrared,
m_delegate.m_infraredFrame.data(),
285 if (data_pointCloud !=
nullptr)
288 if (acceleration_data !=
nullptr) {
289 ST::Acceleration accel =
m_delegate.m_accelerometerEvent.acceleration();
290 acceleration_data[0] = accel.x;
291 acceleration_data[1] = accel.y;
292 acceleration_data[2] = accel.z;
295 if (gyroscope_data !=
nullptr) {
296 ST::RotationRate gyro_data =
m_delegate.m_gyroscopeEvent.rotationRate();
297 gyroscope_data[0] = gyro_data.x;
298 gyroscope_data[1] = gyro_data.y;
299 gyroscope_data[2] = gyro_data.z;
303 *ts =
m_delegate.m_visibleFrame.arrivalTimestamp();
308 #if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON)
322 std::vector<vpColVector> *
const data_pointCloud,
323 pcl::PointCloud<pcl::PointXYZ>::Ptr &pointcloud,
unsigned char *
const data_infrared,
327 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
331 if (
m_delegate.m_cameraType == ST::StructureCoreCameraType::Color)
333 reinterpret_cast<unsigned char *
>(data_image),
340 reinterpret_cast<unsigned char *
>(data_image),
344 reinterpret_cast<unsigned char *
>(data_image),
349 if (
m_delegate.m_depthFrame.isValid() && data_depth !=
nullptr)
350 memcpy(data_depth,
m_delegate.m_depthFrame.depthInMillimeters(),
353 if (
m_delegate.m_infraredFrame.isValid() && data_infrared !=
nullptr)
354 memcpy(data_infrared,
m_delegate.m_infraredFrame.data(),
357 if (data_pointCloud !=
nullptr)
360 if (
m_delegate.m_depthFrame.isValid() && pointcloud !=
nullptr)
363 if (acceleration_data !=
nullptr) {
364 ST::Acceleration accel =
m_delegate.m_accelerometerEvent.acceleration();
365 acceleration_data[0] = accel.x;
366 acceleration_data[1] = accel.y;
367 acceleration_data[2] = accel.z;
370 if (gyroscope_data !=
nullptr) {
371 ST::RotationRate gyro_data =
m_delegate.m_gyroscopeEvent.rotationRate();
372 gyroscope_data[0] = gyro_data.x;
373 gyroscope_data[1] = gyro_data.y;
374 gyroscope_data[2] = gyro_data.z;
378 *ts =
m_delegate.m_visibleFrame.arrivalTimestamp();
396 std::vector<vpColVector> *
const data_pointCloud,
397 pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pointcloud,
398 unsigned char *
const data_infrared,
vpColVector *acceleration_data,
399 vpColVector *gyroscope_data,
bool undistorted,
double *ts)
401 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
404 if (
m_delegate.m_depthFrame.isValid() && data_depth !=
nullptr)
405 memcpy(data_depth,
m_delegate.m_depthFrame.depthInMillimeters(),
408 if (
m_delegate.m_visibleFrame.isValid() && data_image !=
nullptr) {
409 if (
m_delegate.m_cameraType == ST::StructureCoreCameraType::Color)
411 reinterpret_cast<unsigned char *
>(data_image),
418 reinterpret_cast<unsigned char *
>(data_image),
422 reinterpret_cast<unsigned char *
>(data_image),
427 if (
m_delegate.m_infraredFrame.isValid() && data_infrared !=
nullptr)
428 memcpy(data_infrared,
m_delegate.m_infraredFrame.data(),
431 if (
m_delegate.m_depthFrame.isValid() && data_pointCloud !=
nullptr)
434 if (
m_delegate.m_depthFrame.isValid() &&
m_delegate.m_visibleFrame.isValid() && pointcloud !=
nullptr)
437 if (acceleration_data !=
nullptr) {
438 ST::Acceleration accel =
m_delegate.m_accelerometerEvent.acceleration();
439 acceleration_data[0] = accel.x;
440 acceleration_data[1] = accel.y;
441 acceleration_data[2] = accel.z;
444 if (gyroscope_data !=
nullptr) {
445 ST::RotationRate gyro_data =
m_delegate.m_gyroscopeEvent.rotationRate();
446 gyroscope_data[0] = gyro_data.x;
447 gyroscope_data[1] = gyro_data.y;
448 gyroscope_data[2] = gyro_data.z;
452 *ts =
m_delegate.m_visibleFrame.arrivalTimestamp();
482 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
485 if (imu_vel !=
nullptr) {
486 imu_vel->
resize(3,
false);
487 ST::RotationRate imu_rotationRate =
m_delegate.m_gyroscopeEvent.rotationRate();
488 (*imu_vel)[0] = imu_rotationRate.x;
489 (*imu_vel)[1] = imu_rotationRate.y;
490 (*imu_vel)[2] = imu_rotationRate.z;
494 *ts =
m_delegate.m_gyroscopeEvent.arrivalTimestamp();
522 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
525 if (imu_acc !=
nullptr) {
526 imu_acc->
resize(3,
false);
527 ST::Acceleration imu_acceleration =
m_delegate.m_accelerometerEvent.acceleration();
528 (*imu_acc)[0] = imu_acceleration.x;
529 (*imu_acc)[1] = imu_acceleration.y;
530 (*imu_acc)[2] = imu_acceleration.z;
534 *ts =
m_delegate.m_accelerometerEvent.arrivalTimestamp();
564 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
566 double imu_vel_timestamp, imu_acc_timestamp;
568 if (imu_vel !=
nullptr) {
569 imu_vel->
resize(3,
false);
570 ST::RotationRate imu_rotationRate =
m_delegate.m_gyroscopeEvent.rotationRate();
571 (*imu_vel)[0] = imu_rotationRate.x;
572 (*imu_vel)[1] = imu_rotationRate.y;
573 (*imu_vel)[2] = imu_rotationRate.z;
575 m_delegate.m_gyroscopeEvent.arrivalTimestamp();
578 if (imu_acc !=
nullptr) {
579 imu_acc->
resize(3,
false);
580 ST::Acceleration imu_acceleration =
m_delegate.m_accelerometerEvent.acceleration();
581 (*imu_acc)[0] = imu_acceleration.x;
582 (*imu_acc)[1] = imu_acceleration.y;
583 (*imu_acc)[2] = imu_acceleration.z;
584 imu_acc_timestamp =
m_delegate.m_accelerometerEvent.arrivalTimestamp();
588 *ts = std::max<double>(imu_vel_timestamp, imu_acc_timestamp);
606 std::cout <<
"Failed to initialize capture session!" << std::endl;
612 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
614 m_delegate.cv_sampleLock.wait_for(u, std::chrono::seconds(20));
617 if (var == std::cv_status::timeout) {
651 switch (stream_type) {
652 case vpOccipitalStructureStream::visible:
657 case vpOccipitalStructureStream::depth:
662 case vpOccipitalStructureStream::infrared:
680 switch (stream_type) {
681 case vpOccipitalStructureStream::visible:
686 case vpOccipitalStructureStream::depth:
691 case vpOccipitalStructureStream::infrared:
710 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
730 std::unique_lock<std::mutex> u(
m_delegate.m_sampleLock);
734 ST::Vector3f point_3D =
m_delegate.m_depthFrame.unprojectPoint(row, col);
735 return vpPoint(point_3D.x, point_3D.y, point_3D.z);
757 ST::Matrix4 v_M_d =
m_delegate.m_depthFrame.visibleCameraPoseInDepthCoordinateFrame();
759 result[0][0] = v_M_d.m00;
760 result[0][1] = v_M_d.m10;
761 result[0][2] = v_M_d.m20;
762 result[0][3] = v_M_d.m30;
763 result[1][0] = v_M_d.m01;
764 result[1][1] = v_M_d.m11;
765 result[1][2] = v_M_d.m21;
766 result[1][3] = v_M_d.m31;
767 result[2][0] = v_M_d.m02;
768 result[2][1] = v_M_d.m12;
769 result[2][2] = v_M_d.m22;
770 result[2][3] = v_M_d.m32;
774 ST::Matrix4 imu_M_d =
m_captureSession.getImuFromDepthExtrinsics().inversed();
776 result[0][0] = imu_M_d.m00;
777 result[0][1] = imu_M_d.m10;
778 result[0][2] = imu_M_d.m20;
779 result[0][3] = imu_M_d.m30;
780 result[1][0] = imu_M_d.m01;
781 result[1][1] = imu_M_d.m11;
782 result[1][2] = imu_M_d.m21;
783 result[1][3] = imu_M_d.m31;
784 result[2][0] = imu_M_d.m02;
785 result[2][1] = imu_M_d.m12;
786 result[2][2] = imu_M_d.m22;
787 result[2][3] = imu_M_d.m32;
793 ST::Matrix4 d_M_v =
m_delegate.m_depthFrame.visibleCameraPoseInDepthCoordinateFrame().inversed();
795 result[0][0] = d_M_v.m00;
796 result[0][1] = d_M_v.m10;
797 result[0][2] = d_M_v.m20;
798 result[0][3] = d_M_v.m30;
799 result[1][0] = d_M_v.m01;
800 result[1][1] = d_M_v.m11;
801 result[1][2] = d_M_v.m21;
802 result[1][3] = d_M_v.m31;
803 result[2][0] = d_M_v.m02;
804 result[2][1] = d_M_v.m12;
805 result[2][2] = d_M_v.m22;
806 result[2][3] = d_M_v.m32;
810 ST::Matrix4 imu_M_v =
m_captureSession.getImuFromVisibleExtrinsics().inversed();
812 result[0][0] = imu_M_v.m00;
813 result[0][1] = imu_M_v.m10;
814 result[0][2] = imu_M_v.m20;
815 result[0][3] = imu_M_v.m30;
816 result[1][0] = imu_M_v.m01;
817 result[1][1] = imu_M_v.m11;
818 result[1][2] = imu_M_v.m21;
819 result[1][3] = imu_M_v.m31;
820 result[2][0] = imu_M_v.m02;
821 result[2][1] = imu_M_v.m12;
822 result[2][2] = imu_M_v.m22;
823 result[2][3] = imu_M_v.m32;
834 result[0][0] = d_M_imu.m00;
835 result[0][1] = d_M_imu.m10;
836 result[0][2] = d_M_imu.m20;
837 result[0][3] = d_M_imu.m30;
838 result[1][0] = d_M_imu.m01;
839 result[1][1] = d_M_imu.m11;
840 result[1][2] = d_M_imu.m21;
841 result[1][3] = d_M_imu.m31;
842 result[2][0] = d_M_imu.m02;
843 result[2][1] = d_M_imu.m12;
844 result[2][2] = d_M_imu.m22;
845 result[2][3] = d_M_imu.m32;
851 result[0][0] = v_M_imu.m00;
852 result[0][1] = v_M_imu.m10;
853 result[0][2] = v_M_imu.m20;
854 result[0][3] = v_M_imu.m30;
855 result[1][0] = v_M_imu.m01;
856 result[1][1] = v_M_imu.m11;
857 result[1][2] = v_M_imu.m21;
858 result[1][3] = v_M_imu.m31;
859 result[2][0] = v_M_imu.m02;
860 result[2][1] = v_M_imu.m12;
861 result[2][2] = v_M_imu.m22;
862 result[2][3] = v_M_imu.m32;
879 ST::Intrinsics result;
881 switch (stream_type) {
883 result =
m_delegate.m_visibleFrame.intrinsics();
887 result =
m_delegate.m_depthFrame.intrinsics();
891 result =
m_delegate.m_infraredFrame.intrinsics();
909 m_delegate.m_depthFrame.saveImageAsPointCloudMesh(filename.c_str());
920 ST::Intrinsics cam_intrinsics;
921 switch (stream_type) {
922 case vpOccipitalStructureStream::visible:
923 cam_intrinsics =
m_delegate.m_visibleFrame.intrinsics();
926 cam_intrinsics.cy, cam_intrinsics.k1, -cam_intrinsics.k1);
930 vpCameraParameters(cam_intrinsics.fx, cam_intrinsics.fy, cam_intrinsics.cx, cam_intrinsics.cy);
935 case vpOccipitalStructureStream::depth:
936 cam_intrinsics =
m_delegate.m_depthFrame.intrinsics();
938 vpCameraParameters(cam_intrinsics.fx, cam_intrinsics.fy, cam_intrinsics.cx, cam_intrinsics.cy);
952 ST::DepthFrame last_df =
m_delegate.m_depthFrame;
953 const int width = last_df.width();
954 const int height = last_df.height();
955 pointcloud.resize((
size_t)(width * height));
957 const float *p_depth_frame =
reinterpret_cast<const float *
>(last_df.depthInMillimeters());
961 #pragma omp parallel for schedule(dynamic)
962 for (
int i = 0; i < height; i++) {
963 auto depth_pixel_index = i * width;
965 for (
int j = 0; j < width; j++, depth_pixel_index++) {
966 if (std::isnan(p_depth_frame[depth_pixel_index])) {
967 pointcloud[(size_t)depth_pixel_index].resize(4,
false);
971 pointcloud[(size_t)depth_pixel_index][3] = 1.0;
976 auto pixels_distance = p_depth_frame[depth_pixel_index];
978 ST::Vector3f point_3D = last_df.unprojectPoint(i, j);
980 if (pixels_distance >
m_maxZ)
983 pointcloud[(size_t)depth_pixel_index].resize(4,
false);
984 pointcloud[(size_t)depth_pixel_index][0] = point_3D.x * 0.001;
985 pointcloud[(
size_t)depth_pixel_index][1] = point_3D.y * 0.001;
986 pointcloud[(size_t)depth_pixel_index][2] = point_3D.z * 0.001;
987 pointcloud[(
size_t)depth_pixel_index][3] = 1.0;
992 #if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON)
995 ST::DepthFrame last_df =
m_delegate.m_depthFrame;
996 const int width = last_df.width();
997 const int height = last_df.height();
998 pointcloud->width = (uint32_t)width;
999 pointcloud->height = (uint32_t)height;
1000 pointcloud->resize((
size_t)(width * height));
1002 #if MANUAL_POINTCLOUD
1003 const float *p_depth_frame =
reinterpret_cast<const float *
>(last_df.depthInMillimeters());
1007 #pragma omp parallel for schedule(dynamic)
1008 for (
int i = 0; i < height; i++) {
1009 auto depth_pixel_index = i * width;
1011 for (
int j = 0; j < width; j++, depth_pixel_index++) {
1012 if (p_depth_frame[depth_pixel_index] == 0) {
1020 auto pixels_distance = p_depth_frame[depth_pixel_index];
1023 ST::Vector3f point_3D = last_df.unprojectPoint(i, j);
1025 if (pixels_distance >
m_maxZ)
1028 pointcloud->points[(size_t)(depth_pixel_index)].x = point_3D.x * 0.001;
1029 pointcloud->points[(size_t)(depth_pixel_index)].y = point_3D.y * 0.001;
1030 pointcloud->points[(size_t)(depth_pixel_index)].z = point_3D.z * 0.001;
1053 ST::DepthFrame last_df =
m_delegate.m_depthFrame;
1054 ST::ColorFrame last_cf =
m_delegate.m_visibleFrame;
1056 const int depth_width = last_df.width();
1057 const int depth_height = last_df.height();
1058 pointcloud->width =
static_cast<uint32_t
>(depth_width);
1059 pointcloud->height =
static_cast<uint32_t
>(depth_height);
1060 pointcloud->resize(
static_cast<uint32_t
>(depth_width * depth_height));
1062 const int color_width = last_cf.width();
1063 const int color_height = last_cf.height();
1065 const float *p_depth_frame =
reinterpret_cast<const float *
>(last_df.depthInMillimeters());
1066 const ST::Matrix4 depth2ColorExtrinsics = last_df.visibleCameraPoseInDepthCoordinateFrame();
1068 const bool swap_rb =
false;
1069 unsigned int nb_color_pixel = 3;
1070 const uint8_t *p_color_frame =
static_cast<const uint8_t *
>(last_cf.rgbData());
1072 const bool registered_streams = last_df.isRegisteredTo(last_cf);
1076 #pragma omp parallel for schedule(dynamic)
1077 for (
int i = 0; i < depth_height; i++) {
1078 auto depth_pixel_index = i * depth_width;
1080 for (
int j = 0; j < depth_width; j++, depth_pixel_index++) {
1081 if (std::isnan(p_depth_frame[depth_pixel_index])) {
1087 #if PCL_VERSION_COMPARE(<, 1, 1, 0)
1088 unsigned int r = 0, g = 0, b = 0;
1089 uint32_t rgb = (
static_cast<uint32_t
>(r) << 16 |
static_cast<uint32_t
>(g) << 8 |
static_cast<uint32_t
>(b));
1091 pointcloud->points[(size_t)depth_pixel_index].rgb = *
reinterpret_cast<float *
>(&rgb);
1093 pointcloud->points[(size_t)depth_pixel_index].r = (uint8_t)0;
1094 pointcloud->points[(size_t)depth_pixel_index].g = (uint8_t)0;
1095 pointcloud->points[(size_t)depth_pixel_index].b = (uint8_t)0;
1101 auto pixels_distance = p_depth_frame[depth_pixel_index];
1103 ST::Vector3f depth_point_3D = last_df.unprojectPoint(i, j);
1105 if (pixels_distance >
m_maxZ)
1108 pointcloud->points[(size_t)depth_pixel_index].x = depth_point_3D.x * 0.001;
1109 pointcloud->points[(
size_t)depth_pixel_index].y = depth_point_3D.y * 0.001;
1110 pointcloud->points[(size_t)depth_pixel_index].z = depth_point_3D.z * 0.001;
1112 if (!registered_streams) {
1114 ST::Vector3f color_point_3D = depth2ColorExtrinsics * depth_point_3D;
1116 ST::Vector2f color_pixel;
1117 if (color_point_3D.z != 0) {
1118 double x, y, pixel_x, pixel_y;
1119 x =
static_cast<double>(color_point_3D.y / color_point_3D.z);
1120 y =
static_cast<double>(color_point_3D.x / color_point_3D.z);
1122 color_pixel.x = pixel_x;
1123 color_pixel.y = pixel_y;
1126 if (color_pixel.y < 0 || color_pixel.y >= color_height || color_pixel.x < 0 || color_pixel.x >= color_width) {
1129 #if PCL_VERSION_COMPARE(<, 1, 1, 0)
1130 unsigned int r = 0, g = 0, b = 0;
1131 uint32_t rgb = (
static_cast<uint32_t
>(r) << 16 |
static_cast<uint32_t
>(g) << 8 |
static_cast<uint32_t
>(b));
1133 pointcloud->points[(size_t)depth_pixel_index].rgb = *
reinterpret_cast<float *
>(&rgb);
1135 pointcloud->points[(size_t)depth_pixel_index].r = (uint8_t)0;
1136 pointcloud->points[(size_t)depth_pixel_index].g = (uint8_t)0;
1137 pointcloud->points[(size_t)depth_pixel_index].b = (uint8_t)0;
1141 unsigned int i_ = (
unsigned int)color_pixel.x;
1142 unsigned int j_ = (
unsigned int)color_pixel.y;
1144 #if PCL_VERSION_COMPARE(<, 1, 1, 0)
1148 (
static_cast<uint32_t
>(p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel]) |
1149 static_cast<uint32_t
>(p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel + 1]) << 8 |
1150 static_cast<uint32_t
>(p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel + 2])
1155 (
static_cast<uint32_t
>(p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel]) << 16 |
1156 static_cast<uint32_t
>(p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel + 1]) << 8 |
1157 static_cast<uint32_t
>(p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel + 2]));
1160 pointcloud->points[(size_t)(i * depth_width + j)].rgb = *
reinterpret_cast<float *
>(&rgb);
1163 pointcloud->points[(size_t)depth_pixel_index].b =
1164 p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel];
1165 pointcloud->points[(size_t)depth_pixel_index].g =
1166 p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel + 1];
1167 pointcloud->points[(size_t)depth_pixel_index].r =
1168 p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel + 2];
1171 pointcloud->points[(size_t)depth_pixel_index].r =
1172 p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel];
1173 pointcloud->points[(size_t)depth_pixel_index].g =
1174 p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel + 1];
1175 pointcloud->points[(size_t)depth_pixel_index].b =
1176 p_color_frame[(i_ * (
unsigned int)color_width + j_) * nb_color_pixel + 2];
1182 #if PCL_VERSION_COMPARE(<, 1, 1, 0)
1185 rgb = (
static_cast<uint32_t
>(p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel]) |
1186 static_cast<uint32_t
>(p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel + 1]) << 8 |
1187 static_cast<uint32_t
>(p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel + 2]) << 16);
1190 rgb = (
static_cast<uint32_t
>(p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel]) << 16 |
1191 static_cast<uint32_t
>(p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel + 1]) << 8 |
1192 static_cast<uint32_t
>(p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel + 2]));
1195 pointcloud->points[(size_t)(i * depth_width + j)].rgb = *
reinterpret_cast<float *
>(&rgb);
1198 pointcloud->points[(size_t)depth_pixel_index].b =
1199 p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel];
1200 pointcloud->points[(size_t)depth_pixel_index].g =
1201 p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel + 1];
1202 pointcloud->points[(size_t)depth_pixel_index].r =
1203 p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel + 2];
1206 pointcloud->points[(size_t)depth_pixel_index].r =
1207 p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel];
1208 pointcloud->points[(size_t)depth_pixel_index].g =
1209 p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel + 1];
1210 pointcloud->points[(size_t)depth_pixel_index].b =
1211 p_color_frame[(i * (
unsigned int)color_width + j) * nb_color_pixel + 2];
Generic class defining intrinsic camera parameters.
vpCameraParametersProjType
@ perspectiveProjWithDistortion
Perspective projection with distortion model.
@ perspectiveProjWithoutDistortion
Perspective projection without distortion model.
Implementation of column vector and the associated operations.
void resize(unsigned int i, bool flagNullify=true)
Implementation of an homogeneous matrix and operations on such kind of matrices.
static void GreyToRGBa(unsigned char *grey, unsigned char *rgba, unsigned int width, unsigned int height)
static void RGBToRGBa(unsigned char *rgb, unsigned char *rgba, unsigned int size)
Type * bitmap
points toward the bitmap
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
vpPoint unprojectPoint(int row, int col)
void getIMUData(vpColVector *imu_vel, vpColVector *imu_acc, double *ts=nullptr)
unsigned int getHeight(vpOccipitalStructureStream stream_type)
vpCameraParameters getCameraParameters(const vpOccipitalStructureStream stream_type, vpCameraParameters::vpCameraParametersProjType type=vpCameraParameters::perspectiveProjWithoutDistortion)
void acquire(vpImage< unsigned char > &gray, bool undistorted=false, double *ts=nullptr)
vpCameraParameters m_visible_camera_parameters
vpCameraParameters m_depth_camera_parameters
void saveDepthImageAsPointCloudMesh(std::string &filename)
float getDepth(int x, int y)
ST::Intrinsics getIntrinsics(const vpOccipitalStructureStream stream_type) const
void getColoredPointcloud(pcl::PointCloud< pcl::PointXYZRGB >::Ptr &pointcloud)
ST::CaptureSession m_captureSession
float m_invalidDepthValue
void getPointcloud(std::vector< vpColVector > &pointcloud)
unsigned int getWidth(vpOccipitalStructureStream stream_type)
ST::CaptureSessionSettings m_captureSessionSettings
SessionDelegate m_delegate
vpOccipitalStructureStream
@ infrared
Infrared stream.
vpHomogeneousMatrix getTransform(const vpOccipitalStructureStream from, const vpOccipitalStructureStream to)
void getIMUAcceleration(vpColVector *imu_acc, double *ts)
void getIMUVelocity(vpColVector *imu_vel, double *ts)
bool open(const ST::CaptureSessionSettings &settings)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...