Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/viz/test/test_tutorial2.cpp
16354 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html.
4
#include "test_precomp.hpp"
5
6
namespace opencv_test { namespace {
7
8
static void tutorial2()
9
{
10
/// Create a window
11
viz::Viz3d myWindow("Coordinate Frame");
12
13
/// Add coordinate axes
14
myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());
15
16
/// Add line to represent (1,1,1) axis
17
viz::WLine axis(Point3f(-1.0, -1.0, -1.0), Point3d(1.0, 1.0, 1.0));
18
axis.setRenderingProperty(viz::LINE_WIDTH, 4.0);
19
myWindow.showWidget("Line Widget", axis);
20
21
/// Construct a cube widget
22
viz::WCube cube_widget(Point3d(0.5, 0.5, 0.0), Point3d(0.0, 0.0, -0.5), true, viz::Color::blue());
23
cube_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
24
25
/// Display widget (update if already displayed)
26
myWindow.showWidget("Cube Widget", cube_widget);
27
28
/// Rodrigues vector
29
Vec3d rot_vec = Vec3d::all(0);
30
double translation_phase = 0.0, translation = 0.0;
31
while(!myWindow.wasStopped())
32
{
33
/* Rotation using rodrigues */
34
/// Rotate around (1,1,1)
35
rot_vec[0] += CV_PI * 0.01;
36
rot_vec[1] += CV_PI * 0.01;
37
rot_vec[2] += CV_PI * 0.01;
38
39
/// Shift on (1,1,1)
40
translation_phase += CV_PI * 0.01;
41
translation = sin(translation_phase);
42
43
/// Construct pose
44
Affine3d pose(rot_vec, Vec3d(translation, translation, translation));
45
46
myWindow.setWidgetPose("Cube Widget", pose);
47
48
myWindow.spinOnce(1, true);
49
}
50
}
51
52
53
TEST(Viz, DISABLED_tutorial2_pose_of_widget)
54
{
55
tutorial2();
56
}
57
58
}} // namespace
59
60