39 #ifndef _vpOccipitalStructure_h_
40 #define _vpOccipitalStructure_h_
42 #include <visp3/core/vpConfig.h>
44 #if defined(VISP_HAVE_OCCIPITAL_STRUCTURE)
45 #include <condition_variable>
48 #include <ST/CaptureSession.h>
51 #include <pcl/common/common_headers.h>
54 #include <visp3/core/vpCameraParameters.h>
55 #include <visp3/core/vpImage.h>
201 #ifndef DOXYGEN_SHOULD_SKIP_THIS
202 struct SessionDelegate : ST::CaptureSessionDelegate
204 std::mutex m_sampleLock;
205 std::condition_variable cv_sampleLock;
207 ST::ColorFrame m_visibleFrame;
208 ST::DepthFrame m_depthFrame;
209 ST::InfraredFrame m_infraredFrame;
210 ST::AccelerometerEvent m_accelerometerEvent;
211 ST::GyroscopeEvent m_gyroscopeEvent;
212 ST::StructureCoreCameraType m_cameraType;
213 ST::CaptureSessionUSBVersion m_USBVersion;
214 std::string m_serialNumber;
216 ~SessionDelegate() { }
218 void captureSessionEventDidOccur(ST::CaptureSession *session, ST::CaptureSessionEventId event)
override
221 case ST::CaptureSessionEventId::Booting:
223 case ST::CaptureSessionEventId::Connected:
224 printf(
"Starting streams...\n");
225 session->startStreaming();
231 m_USBVersion = session->USBVersion();
232 m_serialNumber = session->sensorInfo().serialNumber;
233 m_cameraType = session->getCameraType();
235 case ST::CaptureSessionEventId::Disconnected:
237 case ST::CaptureSessionEventId::Error:
241 printf(
"Capture session event unhandled\n");
245 void captureSessionDidOutputSample(ST::CaptureSession *,
const ST::CaptureSessionSample &sample)
override
248 std::lock_guard<std::mutex> u(m_sampleLock);
251 if (sample.visibleFrame.isValid())
252 m_visibleFrame = sample.visibleFrame;
254 if (sample.depthFrame.isValid())
255 m_depthFrame = sample.depthFrame;
257 if (sample.infraredFrame.isValid())
258 m_infraredFrame = sample.infraredFrame;
260 if (sample.type == ST::CaptureSessionSample::Type::AccelerometerEvent)
261 m_accelerometerEvent = sample.accelerometerEvent;
263 if (sample.type == ST::CaptureSessionSample::Type::GyroscopeEvent)
264 m_gyroscopeEvent = sample.gyroscopeEvent;
268 cv_sampleLock.notify_one();
282 } vpOccipitalStructureStream;
288 void acquire(
vpImage<vpRGBa> &rgb,
bool undistorted =
false,
double *ts =
nullptr);
291 vpColVector *gyroscope_data =
nullptr,
bool undistorted =
false,
double *ts =
nullptr);
293 vpColVector *gyroscope_data =
nullptr,
bool undistorted =
false,
double *ts =
nullptr);
295 void acquire(
unsigned char *
const data_image,
unsigned char *
const data_depth,
296 std::vector<vpColVector> *
const data_pointCloud =
nullptr,
unsigned char *
const data_infrared =
nullptr,
298 double *ts =
nullptr);
301 void acquire(
unsigned char *
const data_image,
unsigned char *
const data_depth,
302 std::vector<vpColVector> *
const data_pointCloud, pcl::PointCloud<pcl::PointXYZ>::Ptr &pointcloud,
303 unsigned char *
const data_infrared =
nullptr,
vpColVector *acceleration_data =
nullptr,
304 vpColVector *gyroscope_data =
nullptr,
bool undistorted =
true,
double *ts =
nullptr);
305 void acquire(
unsigned char *
const data_image,
unsigned char *
const data_depth,
306 std::vector<vpColVector> *
const data_pointCloud, pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pointcloud,
307 unsigned char *
const data_infrared =
nullptr,
vpColVector *acceleration_data =
nullptr,
308 vpColVector *gyroscope_data =
nullptr,
bool undistorted =
true,
double *ts =
nullptr);
311 void getIMUVelocity(
vpColVector *imu_vel,
double *ts);
312 void getIMUAcceleration(
vpColVector *imu_acc,
double *ts);
315 bool open(
const ST::CaptureSessionSettings &settings);
321 ST::StructureCoreCameraType
getCameraType()
const {
return m_delegate.m_cameraType; }
323 ST::CaptureSessionUSBVersion
getUSBVersion()
const {
return m_delegate.m_USBVersion; }
328 unsigned int getWidth(vpOccipitalStructureStream stream_type);
329 unsigned int getHeight(vpOccipitalStructureStream stream_type);
332 float getDepth(
int x,
int y);
334 vpPoint unprojectPoint(
int row,
int col);
336 vpHomogeneousMatrix getTransform(
const vpOccipitalStructureStream from,
const vpOccipitalStructureStream to);
338 ST::Intrinsics getIntrinsics(
const vpOccipitalStructureStream stream_type)
const;
341 const vpOccipitalStructureStream stream_type,
344 void saveDepthImageAsPointCloudMesh(std::string &filename);
356 void getPointcloud(std::vector<vpColVector> &pointcloud);
358 void getPointcloud(pcl::PointCloud<pcl::PointXYZ>::Ptr &pointcloud);
359 void getColoredPointcloud(pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pointcloud);
Generic class defining intrinsic camera parameters.
vpCameraParametersProjType
@ perspectiveProjWithoutDistortion
Perspective projection without distortion model.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
Implementation of an homogeneous matrix and operations on such kind of matrices.
ST::CaptureSessionUSBVersion getUSBVersion() const
ST::StructureCoreCameraType getCameraType() const
vpCameraParameters m_depth_camera_parameters
ST::CaptureSession & getCaptureSession()
ST::CaptureSession m_captureSession
float m_invalidDepthValue
std::string getSerialNumber() const
ST::CaptureSessionSettings m_captureSessionSettings
SessionDelegate m_delegate
@ infrared
Infrared stream.
ST::CaptureSessionSettings & getCaptureSessionSettings()
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
VISP_EXPORT int wait(double t0, double t)