-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewer_3d.h
37 lines (30 loc) · 1.02 KB
/
viewer_3d.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "opencv2/viz.hpp"
/// \brief Visualize 3D data using OpenCV viz module
class Viewer3D
{
public:
Viewer3D();
/// \brief Display a camera frustum in the viewer
/// \param camera_id A unique name for the camera frame
/// \param K The intrinsics of the camera
/// \param img an image to display inside the frustum
/// \param pose The pose of the camera frame
void addCameraFrustum(
const std::string& camera_id,
const cv::Matx33d& K,
const cv::Mat& img,
const cv::Affine3d& pose = cv::Affine3d::Identity()
);
/// \brief Display a point cloud in the viewer
/// \param world_points The point cloud
/// \param colors The color for each point. Must be the same number of values as points in world_points.
void addPointCloud(const std::vector<cv::Vec3d>& world_points, const std::vector<uint8_t>& colors);
/// \brief Update the viewer once.
void spinOnce();
/// \brief Update the viewer continuously.
void spin();
private:
double scale_;
cv::viz::Viz3d viz_win_;
};