4

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.

  • You're going to have to define in more detail how exactly you want to visualize this. Birds-eye orthographic projection can be as simple as ignoring the Z coordinate and plotting the points (e.g. making a dot by changing the color of appropriate pixel). | There's also the Viz module in OpenCV, but it's quite likely you might have to build your own copy of OpenCV to enable it. – Dan Mašek Aug 23 '18 at 16:44
  • Look at the following answer: [here](https://stackoverflow.com/a/30390224/5981293) – krjw Aug 23 '18 at 16:49
  • So far I have been working with 2D images, I want to be able to take the individual points from before and then draw them on screen. I then want to be able to rotate that image if possible to show more of the points. My main problem is understanding how to draw the Z dimension or how to include a camera that would allow rotation. – MichaelWatling Aug 23 '18 at 16:54
  • don't know myself but I found this: [here](https://stackoverflow.com/a/14944625/5981293) – krjw Aug 23 '18 at 16:57
  • Is this useless?: [OpenCV Viz](https://docs.opencv.org/3.1.0/d7/df9/tutorial_table_of_content_viz.html) – taront Aug 24 '18 at 01:07

1 Answers1

4

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

Gopiraj
  • 647
  • 7
  • 19