OpenCV
4.9.0
Open Source Computer Vision
|
The Viz3d class represents a 3D visualizer window. This class is implicitly shared. More...
#include <opencv2/viz/viz3d.hpp>
Public Types | |
typedef cv::viz::Color | Color |
typedef void(* | KeyboardCallback) (const KeyboardEvent &, void *) |
typedef void(* | MouseCallback) (const MouseEvent &, void *) |
Public Member Functions | |
Viz3d (const String &window_name=String()) | |
The constructors. More... | |
Viz3d (const Viz3d &) | |
~Viz3d () | |
void | addLight (const Vec3d &position, const Vec3d &focalPoint=Vec3d(0, 0, 0), const Color &color=Color::white(), const Color &diffuseColor=Color::white(), const Color &ambientColor=Color::black(), const Color &specularColor=Color::white()) |
Add a light in the scene. More... | |
void | close () |
void | converTo3DRay (const Point3d &window_coord, Point3d &origin, Vec3d &direction) |
Transforms a point in window coordinate system to a 3D ray in world coordinate system. More... | |
void | convertToWindowCoordinates (const Point3d &pt, Point3d &window_coord) |
Transforms a point in world coordinate system to window coordinate system. More... | |
Camera | getCamera () const |
Returns a camera object that contains intrinsic parameters of the current viewer. More... | |
double | getRenderingProperty (const String &id, int property) |
Returns rendering property of a widget. More... | |
cv::Mat | getScreenshot () const |
Returns the Mat screenshot of the current scene. More... | |
Affine3d | getViewerPose () const |
Returns the current pose of the viewer. More... | |
Widget | getWidget (const String &id) const |
Retrieves a widget from the window. More... | |
Affine3d | getWidgetPose (const String &id) const |
Returns the current pose of a widget in the window. More... | |
String | getWindowName () const |
Returns the name of the window which has been set in the constructor. Viz - is prepended to the name if necessary. More... | |
Size | getWindowSize () const |
Returns the current size of the window. More... | |
Viz3d & | operator= (const Viz3d &) |
void | registerKeyboardCallback (KeyboardCallback callback, void *cookie=0) |
Sets keyboard handler. More... | |
void | registerMouseCallback (MouseCallback callback, void *cookie=0) |
Sets mouse handler. More... | |
void | removeAllLights () |
Remove all lights from the current scene. More... | |
void | removeAllWidgets () |
Removes all widgets from the window. More... | |
void | removeWidget (const String &id) |
Removes a widget from the window. More... | |
void | resetCamera () |
Resets camera. More... | |
void | resetCameraViewpoint (const String &id) |
Resets camera viewpoint to a 3D widget in the scene. More... | |
void | saveScreenshot (const String &file) |
Saves screenshot of the current scene. More... | |
void | setBackgroundColor (const Color &color=Color::black(), const Color &color2=Color::not_set()) |
Sets background color. More... | |
void | setBackgroundMeshLab () |
void | setBackgroundTexture (InputArray image=noArray()) |
void | setCamera (const Camera &camera) |
Sets the intrinsic parameters of the viewer using Camera. More... | |
void | setFullScreen (bool mode=true) |
Sets or unsets full-screen rendering mode. More... | |
void | setGlobalWarnings (bool enabled=false) |
void | setOffScreenRendering () |
Create a window in memory instead of on the screen. More... | |
void | setRenderingProperty (const String &id, int property, double value) |
Sets rendering property of a widget. More... | |
void | setRepresentation (int representation) |
Sets geometry representation of the widgets to surface, wireframe or points. More... | |
void | setViewerPose (const Affine3d &pose) |
Sets pose of the viewer. More... | |
void | setWidgetPose (const String &id, const Affine3d &pose) |
Sets pose of a widget in the window. More... | |
void | setWindowPosition (const Point &window_position) |
Sets the position of the window in the screen. More... | |
void | setWindowSize (const Size &window_size) |
Sets the size of the window. More... | |
void | showImage (InputArray image, const Size &window_size=Size(-1, -1)) |
Removed all widgets and displays image scaled to whole window area. More... | |
void | showWidget (const String &id, const Widget &widget, const Affine3d &pose=Affine3d::Identity()) |
Shows a widget in the window. More... | |
void | spin () |
The window renders and starts the event loop. More... | |
void | spinOnce (int time=1, bool force_redraw=false) |
Starts the event loop for a given time. More... | |
void | updateWidgetPose (const String &id, const Affine3d &pose) |
Updates pose of a widget in the window by pre-multiplying its current pose. More... | |
bool | wasStopped () const |
Returns whether the event loop has been stopped. More... | |
Friends | |
class | VizStorage |
The Viz3d class represents a 3D visualizer window. This class is implicitly shared.
typedef cv::viz::Color cv::viz::Viz3d::Color |
typedef void(* cv::viz::Viz3d::KeyboardCallback) (const KeyboardEvent &, void *) |
typedef void(* cv::viz::Viz3d::MouseCallback) (const MouseEvent &, void *) |
The constructors.
window_name | Name of the window. |
cv::viz::Viz3d::Viz3d | ( | const Viz3d & | ) |
cv::viz::Viz3d::~Viz3d | ( | ) |
void cv::viz::Viz3d::addLight | ( | const Vec3d & | position, |
const Vec3d & | focalPoint = Vec3d(0, 0, 0) , |
||
const Color & | color = Color::white() , |
||
const Color & | diffuseColor = Color::white() , |
||
const Color & | ambientColor = Color::black() , |
||
const Color & | specularColor = Color::white() |
||
) |
Add a light in the scene.
position | The position of the light. |
focalPoint | The point at which the light is shining |
color | The color of the light |
diffuseColor | The diffuse color of the light |
ambientColor | The ambient color of the light |
specularColor | The specular color of the light |
void cv::viz::Viz3d::close | ( | ) |
void cv::viz::Viz3d::converTo3DRay | ( | const Point3d & | window_coord, |
Point3d & | origin, | ||
Vec3d & | direction | ||
) |
Transforms a point in window coordinate system to a 3D ray in world coordinate system.
window_coord | Point in window coordinate system. |
origin | Output origin of the ray. |
direction | Output direction of the ray. |
Transforms a point in world coordinate system to window coordinate system.
pt | Point in world coordinate system. |
window_coord | Output point in window coordinate system. |
Camera cv::viz::Viz3d::getCamera | ( | ) | const |
Returns a camera object that contains intrinsic parameters of the current viewer.
double cv::viz::Viz3d::getRenderingProperty | ( | const String & | id, |
int | property | ||
) |
Returns rendering property of a widget.
id | Id of the widget. |
property | Property. |
Rendering property can be one of the following:
REPRESENTATION: Expected values are
IMMEDIATE_RENDERING:
SHADING: Expected values are
Affine3d cv::viz::Viz3d::getViewerPose | ( | ) | const |
Returns the current pose of the viewer.
Retrieves a widget from the window.
A widget is implicitly shared; that is, if the returned widget is modified, the changes will be immediately visible in the window.
id | The id of the widget that will be returned. |
Returns the current pose of a widget in the window.
id | The id of the widget whose pose will be returned. |
String cv::viz::Viz3d::getWindowName | ( | ) | const |
Returns the name of the window which has been set in the constructor. Viz -
is prepended to the name if necessary.
Size cv::viz::Viz3d::getWindowSize | ( | ) | const |
Returns the current size of the window.
void cv::viz::Viz3d::registerKeyboardCallback | ( | KeyboardCallback | callback, |
void * | cookie = 0 |
||
) |
Sets keyboard handler.
callback | Keyboard callback (void (*KeyboardCallbackFunction(const KeyboardEvent&, void*)). |
cookie | The optional parameter passed to the callback. |
void cv::viz::Viz3d::registerMouseCallback | ( | MouseCallback | callback, |
void * | cookie = 0 |
||
) |
Sets mouse handler.
callback | Mouse callback (void (*MouseCallback)(const MouseEvent&, void*)). |
cookie | The optional parameter passed to the callback. |
void cv::viz::Viz3d::removeAllLights | ( | ) |
Remove all lights from the current scene.
void cv::viz::Viz3d::removeAllWidgets | ( | ) |
Removes all widgets from the window.
void cv::viz::Viz3d::removeWidget | ( | const String & | id | ) |
Removes a widget from the window.
id | The id of the widget that will be removed. |
void cv::viz::Viz3d::resetCamera | ( | ) |
Resets camera.
void cv::viz::Viz3d::resetCameraViewpoint | ( | const String & | id | ) |
Resets camera viewpoint to a 3D widget in the scene.
id | Id of a 3D widget. |
void cv::viz::Viz3d::saveScreenshot | ( | const String & | file | ) |
Saves screenshot of the current scene.
file | Name of the file. |
void cv::viz::Viz3d::setBackgroundColor | ( | const Color & | color = Color::black() , |
const Color & | color2 = Color::not_set() |
||
) |
Sets background color.
void cv::viz::Viz3d::setBackgroundMeshLab | ( | ) |
void cv::viz::Viz3d::setBackgroundTexture | ( | InputArray | image = noArray() | ) |
void cv::viz::Viz3d::setCamera | ( | const Camera & | camera | ) |
void cv::viz::Viz3d::setFullScreen | ( | bool | mode = true | ) |
Sets or unsets full-screen rendering mode.
mode | If true, window will use full-screen mode. |
void cv::viz::Viz3d::setGlobalWarnings | ( | bool | enabled = false | ) |
void cv::viz::Viz3d::setOffScreenRendering | ( | ) |
Create a window in memory instead of on the screen.
void cv::viz::Viz3d::setRenderingProperty | ( | const String & | id, |
int | property, | ||
double | value | ||
) |
Sets rendering property of a widget.
id | Id of the widget. |
property | Property that will be modified. |
value | The new value of the property. |
Rendering property can be one of the following:
REPRESENTATION: Expected values are
IMMEDIATE_RENDERING:
SHADING: Expected values are
void cv::viz::Viz3d::setRepresentation | ( | int | representation | ) |
Sets geometry representation of the widgets to surface, wireframe or points.
representation | Geometry representation which can be one of the following:
|
void cv::viz::Viz3d::setViewerPose | ( | const Affine3d & | pose | ) |
Sets pose of the viewer.
pose | The new pose of the viewer. |
Sets pose of a widget in the window.
id | The id of the widget whose pose will be set. |
pose | The new pose of the widget. |
void cv::viz::Viz3d::setWindowPosition | ( | const Point & | window_position | ) |
Sets the position of the window in the screen.
window_position | coordinates of the window |
void cv::viz::Viz3d::setWindowSize | ( | const Size & | window_size | ) |
Sets the size of the window.
window_size | New size of the window. |
void cv::viz::Viz3d::showImage | ( | InputArray | image, |
const Size & | window_size = Size(-1, -1) |
||
) |
Removed all widgets and displays image scaled to whole window area.
image | Image to be displayed. |
window_size | Size of Viz3d window. Default value means no change. |
void cv::viz::Viz3d::showWidget | ( | const String & | id, |
const Widget & | widget, | ||
const Affine3d & | pose = Affine3d::Identity() |
||
) |
Shows a widget in the window.
id | A unique id for the widget. |
widget | The widget to be displayed in the window. |
pose | Pose of the widget. |
void cv::viz::Viz3d::spin | ( | ) |
The window renders and starts the event loop.
void cv::viz::Viz3d::spinOnce | ( | int | time = 1 , |
bool | force_redraw = false |
||
) |
Starts the event loop for a given time.
time | Amount of time in milliseconds for the event loop to keep running. |
force_redraw | If true, window renders. |
Updates pose of a widget in the window by pre-multiplying its current pose.
id | The id of the widget whose pose will be updated. |
pose | The pose that the current pose of the widget will be pre-multiplied by. |
bool cv::viz::Viz3d::wasStopped | ( | ) | const |
Returns whether the event loop has been stopped.
|
friend |