3D Visualizer#
Topics#
Detailed Description#
This section describes 3D visualization window as well as classes and methods that are used to interact with it.
3D visualization window (see Viz3d) is used to display widgets (see Widget), and it provides several methods to interact with scene and widgets.
Classes#
Name |
Description |
|---|---|
|
This class wraps intrinsic parameters of a camera. View details |
|
This class represents color in BGR order. View details |
|
This class represents a keyboard event. View details |
|
This class wraps mesh attributes, and it can load a mesh from a ply file. : View details |
|
This class represents a mouse event. View details |
|
The Viz3d class represents a 3D visualizer window. This class is implicitly shared. View details |
Function Documentation#
computeNormals()#
void cv::viz::computeNormals(
const Mesh & mesh,
OutputArray normals )
#include <opencv2/viz/vizcore.hpp>
Python:
cv.viz.computeNormals(mesh[, normals]) -> normals
Computing normals for mesh
Parameters
mesh— Input mesh.normals— Normals at very point in the mesh of type CV_64FC3.
getWindowByName()#
Viz3d cv::viz::getWindowByName(const String & window_name)
#include <opencv2/viz/vizcore.hpp>
Retrieves a window by its name.
This function returns a Viz3d object with the given name.
Note
If the window with that name already exists, that window is returned. Otherwise, new window is created with the given name, and it is returned.
Parameters
window_name— Name of the window that is to be retrieved.
imshow()#
Viz3d cv::viz::imshow(
const String & window_name,
InputArray image,
const Size & window_size = Size(-1, -1) )
#include <opencv2/viz/vizcore.hpp>
Displays image in specified window.
isNan()#
template<typename _Tp>
bool cv::viz::isNan(const Point3_< _Tp > & p)
#include <opencv2/viz/vizcore.hpp>
Checks float/double value for nan.
Parameters
p— return true if any of the elements of the point is nan.
Here is the call graph for this function:
isNan()#
template<typename _Tp, int cn>
bool cv::viz::isNan(const Vec< _Tp, cn > & v)
#include <opencv2/viz/vizcore.hpp>
Checks float/double value for nan.
Parameters
v— return true if any of the elements of the vector is nan.
Here is the call graph for this function:
isNan()#
bool cv::viz::isNan(double x)
#include <opencv2/viz/vizcore.hpp>
Checks float/double value for nan.
Parameters
x— return true if nan.
isNan()#
bool cv::viz::isNan(float x)
#include <opencv2/viz/vizcore.hpp>
Checks float/double value for nan.
Parameters
x— return true if nan.
makeCameraPose()#
Affine3d cv::viz::makeCameraPose(
const Vec3d & position,
const Vec3d & focal_point,
const Vec3d & y_dir )
#include <opencv2/viz/vizcore.hpp>
Constructs camera pose from position, focal_point and up_vector (see gluLookAt() for more information).
This function returns pose of the camera in global coordinate frame.
Parameters
position— Position of the camera in global coordinate frame.focal_point— Focal point of the camera in global coordinate frame.y_dir— Up vector of the camera in global coordinate frame.
makeTransformToGlobal()#
Affine3d cv::viz::makeTransformToGlobal(
const Vec3d & axis_x,
const Vec3d & axis_y,
const Vec3d & axis_z,
const Vec3d & origin = Vec3d::all(0) )
#include <opencv2/viz/vizcore.hpp>
Takes coordinate frame data and builds transform to global coordinate frame.
Parameters
axis_x— X axis vector in global coordinate frame.axis_y— Y axis vector in global coordinate frame.axis_z— Z axis vector in global coordinate frame.origin— Origin of the coordinate frame in global coordinate frame.
Returns
An affine transform that describes transformation between global coordinate frame and a given coordinate frame. The returned transforms can transform a point in the given coordinate frame to the global coordinate frame.
readCloud()#
Mat cv::viz::readCloud(
const String & file,
OutputArray colors = noArray(),
OutputArray normals = noArray() )
#include <opencv2/viz/vizcore.hpp>
Python:
cv.viz.readCloud(file[, colors[, normals]]) -> retval, colors, normals
Parameters
file— Filename with extension. Supported formats: PLY, XYZ, OBJ and STL.colors— Used by PLY and STL formats only.normals— Used by PLY, OBJ and STL formats only.
Returns
A mat containing the point coordinates with depth CV_32F or CV_64F and number of channels 3 or 4 with only 1 row.
readMesh()#
Mesh cv::viz::readMesh(const String & file)
#include <opencv2/viz/vizcore.hpp>
Python:
cv.viz.readMesh(file) -> retval
Reads mesh. Only ply format is supported now and no texture load support.
readPose()#
bool cv::viz::readPose(
const String & file,
Affine3d & pose,
const String & tag = “pose” )
#include <opencv2/viz/vizcore.hpp>
Read/write poses and trajectories.
Parameters
file— Filename of type supported by cv::FileStorage.pose— Output matrix.tag— Name of the pose in the file.
readTrajectory()#
void cv::viz::readTrajectory(
OutputArray traj,
const String & files_format = “pose%05d.xml”,
int start = 0,
int end = INT_MAX,
const String & tag = “pose” )
#include <opencv2/viz/vizcore.hpp>
takes vector<Affine3
Parameters
traj— Output array containing a lists of poses. It can bestd::vector<cv::Affine3f>, std::vector<cv::Affine3d>
files_format— Format specifier string for constructing filenames. The only placeholder in the string should supportint.start— The initial counter for files_format. It must be greater than or equal to 0.end— The final counter for files_format.tag— Name of the matrix in the file.
unregisterAllWindows()#
void cv::viz::unregisterAllWindows()
#include <opencv2/viz/vizcore.hpp>
Unregisters all Viz windows from internal database. After it ‘getWindowByName()’ will create new windows instead of getting existing from the database.
writeCloud()#
void cv::viz::writeCloud(
const String & file,
InputArray cloud,
InputArray colors = noArray(),
InputArray normals = noArray(),
bool binary = false )
#include <opencv2/viz/vizcore.hpp>
Python:
cv.viz.writeCloud(file, cloud[, colors[, normals[, binary]]])
Read/write clouds. Supported formats: ply, xyz, obj and stl (readonly)
Parameters
file— Filename with extension. Supported formats: PLY, XYZ and OBJ.cloud— Supported depths: CV_32F and CV_64F. Supported channels: 3 and 4.colors— Used by PLY format only. Supported depth: CV_8U. Supported channels: 1, 3 and 4.normals— Used by PLY and OBJ format only. Supported depths: CV_32F and CV_64F. Supported channels: 3 and 4.binary— Used only for PLY format.
writePose()#
void cv::viz::writePose(
const String & file,
const Affine3d & pose,
const String & tag = “pose” )
#include <opencv2/viz/vizcore.hpp>
Parameters
file— Filename.pose— Input matrix.tag— Name of the pose to be saved into the given file.
writeTrajectory()#
void cv::viz::writeTrajectory(
InputArray traj,
const String & files_format = “pose%05d.xml”,
int start = 0,
const String & tag = “pose” )
#include <opencv2/viz/vizcore.hpp>
takes vector<Affine3
Parameters
traj— Trajectory containing a list of poses. It can bestd::vector<cv::Mat>, each cv::Mat is of type CV_32F16 or CV_64FC16
std::vector<cv::Affine3f>, std::vector<cv::Affine3d>
cv::Mat of type CV_32FC16 OR CV_64F16
files_format— Format specifier string for constructing filenames. The only placeholder in the string should supportint.start— The initial counter for files_format.tag— Name of the matrix in the file.