This source file includes following definitions.
- tutorial3
- TEST
- TEST
#include "test_precomp.hpp"
using namespace cv;
using namespace std;
void tutorial3(bool camera_pov)
{
viz::Viz3d myWindow("Coordinate Frame");
myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());
Point3d cam_origin(3.0, 3.0, 3.0), cam_focal_point(3.0, 3.0, 2.0), cam_y_dir(-1.0, 0.0, 0.0);
Affine3d camera_pose = viz::makeCameraPose(cam_origin, cam_focal_point, cam_y_dir);
Affine3d transform = viz::makeTransformToGlobal(Vec3d(0.0, -1.0, 0.0), Vec3d(-1.0, 0.0, 0.0), Vec3d(0.0, 0.0, -1.0), cam_origin);
Mat dragon_cloud = viz::readCloud(get_dragon_ply_file_path());
viz::WCloud cloud_widget(dragon_cloud, viz::Color::green());
Affine3d cloud_pose = Affine3d().rotate(Vec3d(0.0, CV_PI/2, 0.0)).rotate(Vec3d(0.0, 0.0, CV_PI)).translate(Vec3d(0.0, 0.0, 3.0));
Affine3d cloud_pose_global = transform * cloud_pose;
myWindow.showWidget("CPW_FRUSTUM", viz::WCameraPosition(Vec2f(0.889484f, 0.523599f)), camera_pose);
if (!camera_pov)
myWindow.showWidget("CPW", viz::WCameraPosition(0.5), camera_pose);
myWindow.showWidget("bunny", cloud_widget, cloud_pose_global);
if (camera_pov)
myWindow.setViewerPose(camera_pose);
myWindow.spin();
}
TEST(Viz, tutorial3_global_view)
{
tutorial3(false);
}
TEST(Viz, tutorial3_camera_view)
{
tutorial3(true);
}