This example shows how to retrieve images from a Occipital Structure Core sensor with libStructure.
#include <iostream>
#include <visp3/core/vpConfig.h>
#if defined(VISP_HAVE_OCCIPITAL_STRUCTURE) && ( VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11 ) \
&& (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
#include <visp3/core/vpImageConvert.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/sensor/vpOccipitalStructure.h>
int main()
{
#ifdef ENABLE_VISP_NAMESPACE
#endif
try {
double t;
unsigned int display_scale = 1;
ST::CaptureSessionSettings settings;
settings.source = ST::CaptureSessionSourceId::StructureCore;
settings.structureCore.visibleEnabled = true;
settings.applyExpensiveCorrection = true;
#if defined(VISP_HAVE_X11)
vpDisplayX display_visible;
vpDisplayX display_depth;
#elif defined(VISP_HAVE_GDI)
#endif
#if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)
I_visible =
display_visible.setDownScalingFactor(display_scale);
display_visible.init(I_visible, 10, 10, "Visible image");
I_depth_raw =
display_depth.setDownScalingFactor(display_scale);
display_depth.init(I_depth,
static_cast<int>(I_visible.
getWidth() / display_scale) + 20, 10,
"Depth image");
#endif
while (true) {
break;
}
}
std::cerr <<
"Structure SDK error " << e.
what() << std::endl;
}
catch (const std::exception &e) {
std::cerr << e.
what() << std::endl;
}
return EXIT_SUCCESS;
}
#else
int main()
{
#if !defined(VISP_HAVE_OCCIPITAL_STRUCTURE)
std::cout << "You do not have Occipital Structure SDK functionality enabled..." << std::endl;
std::cout << "Tip:" << std::endl;
std::cout << "- Install libStructure, configure again ViSP using cmake and build again this example" << std::endl;
return EXIT_SUCCESS;
#elif ( VISP_CXX_STANDARD < VISP_CXX_STANDARD_11 )
std::cout << "You do not build ViSP with c++11 or higher compiler flag" << std::endl;
std::cout << "Tip:" << std::endl;
std::cout << "- Configure ViSP again using cmake -DUSE_CXX_STANDARD=11, and build again this example" << std::endl;
#elif !(defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
std::cout << "You don't have X11 or GDI display capabilities" << std::endl;
#endif
return EXIT_SUCCESS;
}
#endif
Display for windows using GDI (available on any windows 32 platform).
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)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
error that can be emitted by ViSP classes.
const char * what() const
static void createDepthHistogram(const vpImage< uint16_t > &src_depth, vpImage< vpRGBa > &dest_rgba)
unsigned int getWidth() const
Type * bitmap
points toward the bitmap
unsigned int getHeight(vpOccipitalStructureStream stream_type)
void acquire(vpImage< unsigned char > &gray, bool undistorted=false, double *ts=nullptr)
unsigned int getWidth(vpOccipitalStructureStream stream_type)
bool open(const ST::CaptureSessionSettings &settings)
VISP_EXPORT double measureTimeMs()