#include <iostream>
static void help()
{
cout
<< "--------------------------------------------------------------------------" << endl
<< "此程序演示了如何可视化一个立方体,该立方体围绕(1,1,1)旋转并移动 "
<< "使用 Rodrigues 向量。" << endl
<< "用法:" << endl
<< "./widget_pose" << endl
<< endl;
}
{
help();
axis.setRenderingProperty(viz::LINE_WIDTH, 4.0);
myWindow.showWidget("直线小部件", axis);
cube_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
myWindow.showWidget("立方体小部件", cube_widget);
float translation_phase = 0.0, translation = 0.0;
rot_vec.
at<
float>(0, 0) += (
float)
CV_PI * 0.01f;
rot_vec.
at<
float>(0, 1) += (
float)
CV_PI * 0.01f;
rot_vec.
at<
float>(0, 2) += (
float)
CV_PI * 0.01f;
translation_phase += (float)
CV_PI * 0.01f;
translation = sin(translation_phase);
Rodrigues(rot_vec, rot_mat);
cout << "rot_mat = " << rot_mat << endl;
Affine3f pose(rot_mat,
Vec3f(translation, translation, translation));
cout << "pose = " << pose.matrix << endl;
cout << "pose = " << pose2.matrix << endl;
while(!myWindow.wasStopped())
{
rot_vec.
at<
float>(0,0) += (
float)
CV_PI * 0.01f;
rot_vec.
at<
float>(0,1) += (
float)
CV_PI * 0.01f;
rot_vec.
at<
float>(0,2) += (
float)
CV_PI * 0.01f;
translation_phase += (float)
CV_PI * 0.01f;
translation = sin(translation_phase);
Rodrigues(rot_vec, rot_mat1);
Affine3f pose1(rot_mat1,
Vec3f(translation, translation, translation));
myWindow.setWidgetPose("立方体小部件", pose1);
myWindow.spinOnce(1, true);
}
return 0;
}
_Tp & at(int i0=0)
返回指定数组元素的引用。
由其坐标 x、y 和 z 指定的 3D 点的模板类。
定义 types.hpp:255
Viz3d 类表示一个 3D 可视化窗口。此类是隐式共享的。
定义 viz3d.hpp:68
此 3D 小部件定义一个立方体。
定义 widgets.hpp:373
#define CV_32F
Definition interface.h:78
#define CV_PI
定义 cvdef.h:380
int main(int argc, char *argv[])
定义 highgui_qt.cpp:3