OpenCV  4.1.0
Open Source Computer Vision
Modules | Classes | Functions | Variables
3D Visualizer

Modules

 Widget
 

Classes

class  cv::viz::Camera
 This class wraps intrinsic parameters of a camera. More...
 
class  cv::viz::Color
 This class represents color in BGR order. More...
 
class  cv::viz::KeyboardEvent
 This class represents a keyboard event. More...
 
class  cv::viz::Mesh
 This class wraps mesh attributes, and it can load a mesh from a ply file. : More...
 
class  cv::viz::MouseEvent
 This class represents a mouse event. More...
 
class  cv::viz::Viz3d
 The Viz3d class represents a 3D visualizer window. This class is implicitly shared. More...
 

Functions

void cv::viz::computeNormals (const Mesh &mesh, OutputArray normals)
 
Viz3d cv::viz::getWindowByName (const String &window_name)
 Retrieves a window by its name.
 
Viz3d cv::viz::imshow (const String &window_name, InputArray image, const Size &window_size=Size(-1,-1))
 Displays image in specified window.
 
bool cv::viz::isNan (float x)
 Checks float/double value for nan.
 
bool cv::viz::isNan (double x)
 Checks float/double value for nan.
 
template<typename _Tp , int cn>
bool cv::viz::isNan (const Vec< _Tp, cn > &v)
 Checks float/double value for nan.
 
template<typename _Tp >
bool cv::viz::isNan (const Point3_< _Tp > &p)
 Checks float/double value for nan.
 
Affine3d cv::viz::makeCameraPose (const Vec3d &position, const Vec3d &focal_point, const Vec3d &y_dir)
 Constructs camera pose from position, focal_point and up_vector (see gluLookAt() for more information).
 
Affine3d cv::viz::makeTransformToGlobal (const Vec3d &axis_x, const Vec3d &axis_y, const Vec3d &axis_z, const Vec3d &origin=Vec3d::all(0))
 Takes coordinate frame data and builds transform to global coordinate frame.
 
Mat cv::viz::readCloud (const String &file, OutputArray colors=noArray(), OutputArray normals=noArray())
 
*Reads mesh Only ply format is
supported now and no texture
load support *Mesh 
cv::viz::readMesh (const String &file)
 
*Read write poses and
trajectories *bool 
cv::viz::readPose (const String &file, Affine3d &pose, const String &tag="pose")
 
void cv::viz::readTrajectory (OutputArray traj, const String &files_format="pose%05d.xml", int start=0, int end=INT_MAX, const String &tag="pose")
 
*Read write clouds Supported
obj and 
cv::viz::stl (readonly)*/void writeCloud(const String &file
 
void cv::viz::unregisterAllWindows ()
 Unregisters all Viz windows from internal database. After it 'getWindowByName()' will create new windows instead of getting existing from the database.
 
void cv::viz::writePose (const String &file, const Affine3d &pose, const String &tag="pose")
 
void cv::viz::writeTrajectory (InputArray traj, const String &files_format="pose%05d.xml", int start=0, const String &tag="pose")
 

Variables

*Read write clouds Supported
obj and InputArray InputArray
InputArray bool 
cv::viz::binary = false)
 
*Read write clouds Supported
obj and InputArray 
cv::viz::cloud
 
*Read write clouds Supported
obj and InputArray InputArray 
cv::viz::colors = noArray()
 
*Read write clouds Supported cv::viz::formats
 
*Read write clouds Supported
obj and InputArray InputArray
InputArray 
cv::viz::normals = noArray()
 
*Read write clouds Supported cv::viz::xyz
 

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.

Function Documentation

void cv::viz::computeNormals ( const Mesh &  mesh,
OutputArray  normals 
)

Computing normals for mesh

Parameters
meshInput mesh.
normalsNormals at very point in the mesh of type CV_64FC3.
Viz3d cv::viz::getWindowByName ( const String &  window_name)

Retrieves a window by its name.

Parameters
window_nameName of the window that is to be retrieved.

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.
Window names are automatically prefixed by "Viz - " if it is not done by the user.
viz::Viz3d window = viz::getWindowByName("myWindow");
viz::Viz3d window_2 = viz::getWindowByName("Viz - myWindow");
Viz3d cv::viz::imshow ( const String &  window_name,
InputArray  image,
const Size &  window_size = Size(-1,-1) 
)

Displays image in specified window.

bool cv::viz::isNan ( float  x)
inline

Checks float/double value for nan.

Parameters
xreturn true if nan.
bool cv::viz::isNan ( double  x)
inline

Checks float/double value for nan.

Parameters
xreturn true if nan.
template<typename _Tp , int cn>
bool cv::viz::isNan ( const Vec< _Tp, cn > &  v)
inline

Checks float/double value for nan.

Parameters
vreturn true if any of the elements of the vector is nan.
template<typename _Tp >
bool cv::viz::isNan ( const Point3_< _Tp > &  p)
inline

Checks float/double value for nan.

Parameters
preturn true if any of the elements of the point is nan.
Affine3d cv::viz::makeCameraPose ( const Vec3d &  position,
const Vec3d &  focal_point,
const Vec3d &  y_dir 
)

Constructs camera pose from position, focal_point and up_vector (see gluLookAt() for more information).

Parameters
positionPosition of the camera in global coordinate frame.
focal_pointFocal point of the camera in global coordinate frame.
y_dirUp vector of the camera in global coordinate frame.

This function returns pose of the camera in global coordinate frame.

Affine3d cv::viz::makeTransformToGlobal ( const Vec3d &  axis_x,
const Vec3d &  axis_y,
const Vec3d &  axis_z,
const Vec3d &  origin = Vec3d::all(0) 
)

Takes coordinate frame data and builds transform to global coordinate frame.

Parameters
axis_xX axis vector in global coordinate frame.
axis_yY axis vector in global coordinate frame.
axis_zZ axis vector in global coordinate frame.
originOrigin 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.
Mat cv::viz::readCloud ( const String &  file,
OutputArray  colors = noArray(),
OutputArray  normals = noArray() 
)
Parameters
fileFilename with extension. Supported formats: PLY, XYZ, OBJ and STL.
colorsUsed by PLY and STL formats only.
normalsUsed 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.
* Reads mesh Only ply format is supported now and no texture load support* Mesh cv::viz::readMesh ( const String &  file)
* Read write poses and trajectories* bool cv::viz::readPose ( const String &  file,
Affine3d &  pose,
const String &  tag = "pose" 
)
Parameters
fileFilename of type supported by cv::FileStorage.
poseOutput matrix.
tagName of the pose in the file.
void cv::viz::readTrajectory ( OutputArray  traj,
const String &  files_format = "pose%05d.xml",
int  start = 0,
int  end = INT_MAX,
const String &  tag = "pose" 
)

takes vector<Affine3<T>> with T = float/dobule and loads poses from sequence of files

Parameters
trajOutput array containing a lists of poses. It can be
  • std::vector<cv::Affine3f>, std::vector<cv::Affine3d>
  • cv::Mat
files_formatFormat specifier string for constructing filenames. The only placeholder in the string should support int.
startThe initial counter for files_format. It must be greater than or equal to 0.
endThe final counter for files_format.
tagName of the matrix in the file.
* Read write clouds Supported obj and cv::viz::stl ( readonly  ) const
Parameters
fileFilename with extension. Supported formats: PLY, XYZ and OBJ.
cloudSupported depths: CV_32F and CV_64F. Supported channels: 3 and 4.
colorsUsed by PLY format only. Supported depth: CV_8U. Supported channels: 1, 3 and 4.
normalsUsed by PLY and OBJ format only. Supported depths: CV_32F and CV_64F. Supported channels: 3 and 4.
binaryUsed only for PLY format.
void cv::viz::unregisterAllWindows ( )

Unregisters all Viz windows from internal database. After it 'getWindowByName()' will create new windows instead of getting existing from the database.

void cv::viz::writePose ( const String &  file,
const Affine3d &  pose,
const String &  tag = "pose" 
)
Parameters
fileFilename.
poseInput matrix.
tagName of the pose to be saved into the given file.
void cv::viz::writeTrajectory ( InputArray  traj,
const String &  files_format = "pose%05d.xml",
int  start = 0,
const String &  tag = "pose" 
)

takes vector<Affine3<T>> with T = float/dobule and writes to a sequence of files with given filename format

Parameters
trajTrajectory containing a list of poses. It can be
  • std::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_formatFormat specifier string for constructing filenames. The only placeholder in the string should support int.
startThe initial counter for files_format.
tagName of the matrix in the file.

Variable Documentation

* Read write clouds Supported obj and InputArray InputArray InputArray bool cv::viz::binary = false)
* Read write clouds Supported obj and InputArray cv::viz::cloud
* Read write clouds Supported obj and InputArray InputArray cv::viz::colors = noArray()
* Read write clouds Supported cv::viz::formats
* Read write clouds Supported obj and InputArray InputArray InputArray cv::viz::normals = noArray()
* Read write clouds Supported cv::viz::xyz