OpenCV 5.0.0-pre
Open Source Computer Vision
|
Original author | Dmitrii Klepikov |
Compatibility | OpenCV >= 5.0 |
In this tutorial you will:
For visualisations you need to compile OpenCV library with OpenGL support. For this you should set WITH_OPENGL flag ON in CMake while building OpenCV from source.
Loading and saving of point cloud can be done using cv::loadPointCloud
and cv::savePointCloud
accordingly.
Currently supported formats are:
Function cv::loadPointCloud
returns vector of points of float (cv::Point3f
) and vector of their normals(if specified in source file). To visualize it you can use functions from viz3d module and it is needed to reinterpret data into another format
In presented code sample we add a colour attribute to every point Result will be:
For additional info grid can be added
Other possible way to draw 3d objects can be a mesh. For that we use special functions to load mesh data and display it. Here for now only .OBJ files are supported and they should be triangulated before processing (triangulation - process of breaking faces into triangles).