geolib2
visualization.cpp
Go to the documentation of this file.
1 #include "geolib/visualization.h"
2 
3 #include <geolib/Shape.h>
5 
6 #include <opencv2/highgui/highgui.hpp>
7 
8 namespace geo {
9 
10 void visualization::showKinect(ShapeConstPtr shape, double canvas_width, double canvas_height)
11 {
12  DepthCamera cam(canvas_width, canvas_height,
13  554.2559327880068 * canvas_width / 640, 554.2559327880068 * canvas_height / 480,
14  320.5 * canvas_width / 640, 240.5 * canvas_height / 480,
15  0, 0);
16 
17  double r = shape->getMaxRadius();
18  double dist = r / 2;
19 
20  for(double angle = 0; angle < 6.283; angle += 0.05) {
21  cv::Mat image = cv::Mat(image.rows, image.cols, CV_32FC1, 0.0);
22 
23  Pose3D pose(0, 0, dist, -1.57, angle, 0);
24  cam.rasterize(*shape, pose, image);
25 
26  cv::imshow("visualization", image / 10);
27  if (cv::waitKey(30) != -1) {
28  return;
29  }
30  }
31 }
32 
33 }
34 
Shape.h
std::shared_ptr
geo
Definition: Box.h:6
geo::DepthCamera::rasterize
RasterizeResult rasterize(const Shape &shape, const Pose3D &pose, cv::Mat &image, PointerMap &pointer_map=EMPTY_POINTER_MAP, void *pointer=0, TriangleMap &triangle_map=EMPTY_TRIANGLE_MAP) const
rasterize: render a 3D shape onto a 2D image
Definition: DepthCamera.cpp:114
geo::Transform3T
Definition: math_types.h:19
DepthCamera.h
geo::visualization::showKinect
static void showKinect(ShapeConstPtr shape, double canvas_width, double canvas_height)
Definition: visualization.cpp:10
geo::DepthCamera
Definition: DepthCamera.h:159
visualization.h