This class provides a wrapper over the Occipital Structure SDK library https://structure.io/developers. It allows to capture data from the Occipital Structure Core camera.
- Note
- Supported devices for Occipital Structure SDK 0.9:
- Occipital Structure Core.
The usage of vpOccipitalStructure class is enabled when libStructure 3rd party is successfully installed. The following tutorials explain how to proceed:
Moreover, if Point Cloud Library (PCL) 3rd party is installed, we also propose interfaces to retrieve point cloud as pcl::PointCloud<pcl::PointXYZ> or pcl::PointCloud<pcl::PointXYZRGB> data structures.
- Warning
- Notice that the usage of this class requires compiler and library support for the ISO C++ 2011 standard. This support is enabled by default in ViSP when supported by the compiler. Hereafter we give an example of a CMakeLists.txt file that allows to build sample-structure-core.cpp that uses vpOccipitalStructure class.
cmake_minimum_required(VERSION 3.5)
project(sample)
find_package(VISP REQUIRED)
include_directories(${VISP_INCLUDE_DIRS})
add_executable(sample-structure-core sample-structure-core.cpp)
target_link_libraries(sample-structure-core ${VISP_LIBRARIES})
To acquire images from the Structure Core color camera and convert them into grey level images, a good starting is to use the following code that corresponds to the content of `sample-structure-core.cpp:
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/sensor/vpOccipitalStructure.h>
int main()
{
ST::CaptureSessionSettings settings;
settings.source = ST::CaptureSessionSourceId::StructureCore;
settings.structureCore.visibleEnabled = true;
sc.open(settings);
vpImage<unsigned char> I(sc.getHeight(vpOccipitalStructure::visible), sc.getWidth(vpOccipitalStructure::visible));
#ifdef VISP_HAVE_X11
#elif defined(VISP_HAVE_GDI)
#endif
while (true) {
sc.acquire(I);
break;
}
return 0;
}
Display for windows using GDI (available on any windows 32 platform).
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
Definition of the vpImage class member functions.
If you want to acquire color images, in the previous sample replace:
vpImage<unsigned char> I(sc.getHeight(vpOccipitalStructure::visible), sc.getWidth(vpOccipitalStructure::visible));
by
vpImage<vpRGBa> I(sc.getHeight(vpOccipitalStructure::visible), sc.getWidth(vpOccipitalStructure::visible));
If you are interested in the point cloud and if ViSP is build with PCL support, you can start from the following example where we use PCL library to visualize the point cloud
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <visp3/sensor/vpOccipitalStructure.h>
int main()
{
ST::CaptureSessionSettings settings;
settings.source = ST::CaptureSessionSourceId::StructureCore;
settings.structureCore.visibleEnabled = true;
settings.applyExpensiveCorrection = true;
sc.open(settings);
sc.getCameraParameters(vpOccipitalStructure::visible);
sc.getCameraParameters(vpOccipitalStructure::depth);
pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointcloud(new pcl::PointCloud<pcl::PointXYZRGB>);
sc.acquire(NULL, NULL, NULL, pointcloud);
pcl::visualization::PCLVisualizer::Ptr viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(pointcloud);
viewer->setBackgroundColor(0, 0, 0);
viewer->initCameraParameters();
viewer->setCameraPosition(0, 0, -0.5, 0, -1, 0);
while (true) {
sc.acquire(NULL, NULL, NULL, pointcloud);
static bool update = false;
if (!update) {
viewer->addPointCloud<pcl::PointXYZRGB> (pointcloud, rgb, "sample cloud");
viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");
update = true;
} else {
viewer->updatePointCloud<pcl::PointXYZRGB> (pointcloud, rgb, "sample cloud");
}
viewer->spinOnce(30);
}
return 0;
}
References to ST::CaptureSession and ST::CaptureSessionSettings can be retrieved with (sc.open() must be called before):
ST::CaptureSession &getCaptureSession();
ST::CaptureSessionSettings &getCaptureSessionSettings();
*/
DOXYGEN_SHOULD_SKIP_THIS
class VISP_EXPORT vpOccipitalStructure { public: typedef enum { visible, //!< Visible stream depth, //!< Depth stream infrared, //!< Infrared stream imu //!< IMU stream } vpOccipitalStructureStream;
vpOccipitalStructure(); ~vpOccipitalStructure();
void acquire(vpImage<unsigned char> &gray, bool undistorted = false, double *ts = NULL); void acquire(vpImage<vpRGBa> &rgb, bool undistorted = false, double *ts = NULL);
void acquire(vpImage<vpRGBa> *rgb, vpImage<vpRGBa> *depth, vpColVector *acceleration_data = NULL, vpColVector *gyroscope_data = NULL, bool undistorted = false, double *ts = NULL); void acquire(vpImage<unsigned char> *gray, vpImage<vpRGBa> *depth, vpColVector *acceleration_data = NULL, vpColVector *gyroscope_data = NULL, bool undistorted = false, double *ts = NULL);
void acquire(unsigned char *const data_image, unsigned char *const data_depth, std::vector<vpColVector> *const data_pointCloud = NULL, unsigned char *const data_infrared = NULL, vpColVector *acceleration_data = NULL, vpColVector *gyroscope_data = NULL, bool undistorted = true, double *ts = NULL);
void acquire(unsigned char *const data_image, unsigned char *const data_depth, std::vector<vpColVector> *const data_pointCloud, pcl::PointCloud<pcl::PointXYZ>::Ptr &pointcloud, unsigned char *const data_infrared = NULL, vpColVector *acceleration_data = NULL, vpColVector *gyroscope_data = NULL, bool undistorted = true, double *ts = NULL); void acquire(unsigned char *const data_image, unsigned char *const data_depth, std::vector<vpColVector> *const data_pointCloud, pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pointcloud, unsigned char *const data_infrared = NULL, vpColVector *acceleration_data = NULL, vpColVector *gyroscope_data = NULL, bool undistorted = true, double *ts = NULL);
void getIMUVelocity(vpColVector *imu_vel, double *ts); void getIMUAcceleration(vpColVector *imu_acc, double *ts); void getIMUData(vpColVector *imu_vel, vpColVector *imu_acc, double *ts = NULL);
bool open(const ST::CaptureSessionSettings &settings); void close();
/*! Get camera type: Color or Monochrome.
- Examples
- testOccipitalStructure_Core_images.cpp, testOccipitalStructure_Core_imu.cpp, testOccipitalStructure_Core_pcl.cpp, tutorial-apriltag-detector-live-rgbd-structure-core.cpp, tutorial-grabber-rgbd-D435-structurecore.cpp, tutorial-grabber-structure-core.cpp, and tutorial-mb-generic-tracker-rgbd-structure-core.cpp.