How to visualize coordinate systems in 3D using opencv

2.2k views Asked by At

I have multiple cameras in a 3d environment and the positions and orientations of the cameras are known or defined. How to visualize their coordinate systems (unit vectors -x, -y, -z) using only OpenCV library? Is there anything already available?

1

There are 1 answers

0
Gopiraj On

You can use OpenCV viz.

In order to use viz, you need to have VTK on your PC. Install VTK, Then build OpenCV with VTK enabled.

You can visualize the point clouds from multiple camera using the viz widgets.

//This will be your reference camera
viz::Viz3d myWindow("Coordinate Frame");
myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());

The point cloud can be stored in a vector or in the form of a mat having 3 channels (or 4 channels). You can display multiple point clouds

//Store your point clouds here
vector<cv::Point3d> pts3d1, pts3d2;
viz::WCloud cloud_widget1(pts3d1, viz::Color::green());
viz::WCloud cloud_widget2(pts3d2, viz::Color::red());

myWindow.showWidget("cloud 1", cloud_widget1);
myWindow.showWidget("cloud 2", cloud_widget2);

myWindow.spin();