Reputation: 61
I have a vector of Point3d that varies in size. X and Y coordinates are always decided by image analysis, whereas Z is always between 0 and 10. Is there any way to show these points in a 3D space while only using OpenCV? I'm very new to graphical libraries and hope I do not have to get my head around another new library.
Upvotes: 4
Views: 5874
Reputation: 657
You can use OpenCV Viz to visualize the 3d Points.
In order to visualize using viz, you need to build VTK first and then build OpenCV from source, WITH_VTK enabled.
Then you can visualize the 3D points as follows.
viz::Viz3d window; //creating a Viz window
//Displaying the Coordinate Origin (0,0,0)
window.showWidget("coordinate", viz::WCoordinateSystem(100));
//Displaying the 3D points in green
window.showWidget("points", viz::WCloud(pts3d, viz::Color::green()));
window.spin();
the input pts3D can be a vector<Point3d>, vector<Point3f>, vector<Point3i>, a Mat with 3 channels, Mat3f, Mat3d, Mat3i
Upvotes: 4