Commit c7730614 authored by Ozan Tonkal's avatar Ozan Tonkal

updated documentation

parent 3bdb55e1
Viz3d Viz
===== ===
.. highlight:: cpp .. highlight:: cpp
Viz3d This section describes 3D visualization window as well as classes and methods
----- that are used to interact with it.
3D visualization window (see :ocv:class:`Viz3d`) is used to display widgets (see :ocv:class:`Widget`), and it provides
several methods to interact with scene and widgets.
viz::makeTransformToGlobal
--------------------------
Takes coordinate frame data and builds transform to global coordinate frame.
.. ocv:function:: Affine3f viz::makeTransformToGlobal(const Vec3f& axis_x, const Vec3f& axis_y, const Vec3f& axis_z, const Vec3f& origin = Vec3f::all(0))
:param axis_x: X axis vector in global coordinate frame.
:param axis_y: Y axis vector in global coordinate frame.
:param axis_z: Z axis vector in global coordinate frame.
:param origin: Origin of the coordinate frame in global coordinate frame.
This function returns affine transform that describes transformation between global coordinate frame and a given coordinate frame.
viz::makeCameraPose
-------------------
Constructs camera pose from position, focal_point and up_vector (see gluLookAt() for more infromation).
.. ocv:function:: Affine3f makeCameraPose(const Vec3f& position, const Vec3f& focal_point, const Vec3f& y_dir)
:param position: Position of the camera in global coordinate frame.
:param focal_point: Focal point of the camera in global coordinate frame.
:param y_dir: Up vector of the camera in global coordinate frame.
This function returns pose of the camera in global coordinate frame.
viz::get
--------
Retrieves a window by its name.
.. ocv:function:: Viz3d get(const String &window_name)
:param window_name: Name of the window that is to be retrieved.
This function returns a :ocv:class:`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.
.. note:: Window names are automatically prefixed by "Viz - " if it is not done by the user.
.. code-block:: cpp
/// window and window_2 are the same windows.
viz::Viz3d window = viz::get("myWindow");
viz::Viz3d window_2 = viz::get("Viz - myWindow");
viz::isNan
----------
Checks **float/double** value for nan.
.. ocv:function:: bool isNan(float x)
.. ocv:function:: bool isNan(double x)
:param x: return true if nan.
Checks **vector** for nan.
.. ocv:function:: bool isNan(const Vec<_Tp, cn>& v)
:param v: return true if **any** of the elements of the vector is *nan*.
Checks **point** for nan
.. ocv:function:: bool isNan(const Point3_<_Tp>& p)
:param p: return true if **any** of the elements of the point is *nan*.
viz::VizAccessor
----------------
.. ocv:class:: VizAccessor
A singleton class that provides access by name infrastructure for 3D visualization windows. ::
class CV_EXPORTS VizAccessor
{
public:
static VizAccessor & getInstance();
static void release();
Viz3d get(const String &window_name);
//! window names automatically have Viz - prefix even though not provided by the users
static void generateWindowName(const String &window_name, String &output);
private:
/* hidden */
};
viz::VizAccessor::getInstance
-----------------------------
Returns the single instance of VizAccessor.
.. ocv:function:: static VizAccessor & getInstance()
viz::VizAccessor::release
-------------------------
Deletes the single instance of VizAccessor.
.. ocv:function:: static void release()
viz::VizAccessor::get
---------------------
Retrieves a window by its name.
.. ocv:function:: Viz3d get(const String &window_name)
:param window_name: Name of the window that is to be retrieved.
This function returns a :ocv:class:`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.
.. note:: Window names are automatically prefixed by "Viz - " if it is not done by the user.
.. code-block:: cpp
/// window and window_2 are the same windows.
viz::Viz3d window = viz::get("myWindow");
viz::Viz3d window_2 = viz::get("Viz - myWindow");
viz::VizAccessor::generateWindowName
------------------------------------
Generates a window name by prefixing "Viz - " if it has not already been prefixed.
.. ocv:function:: static void generateWindowName(const String &window_name, String &output)
:param window_name: Window name
:param output: Prefixed window name
viz::Viz3d
----------
.. ocv:class:: Viz3d .. ocv:class:: Viz3d
The Viz3d class represents a 3D visualizer window. This class is implicitly shared. :: The Viz3d class represents a 3D visualizer window. This class is implicitly shared. ::
...@@ -62,41 +197,39 @@ The Viz3d class represents a 3D visualizer window. This class is implicitly shar ...@@ -62,41 +197,39 @@ The Viz3d class represents a 3D visualizer window. This class is implicitly shar
void setDesiredUpdateRate(double rate); void setDesiredUpdateRate(double rate);
double getDesiredUpdateRate(); double getDesiredUpdateRate();
void setRepresentationToSurface(); void setRepresentation(int representation);
void setRepresentationToWireframe();
void setRepresentationToPoints();
private: private:
/* hidden */ /* hidden */
}; };
Viz3d::Viz3d viz::Viz3d::Viz3d
------------ -----------------
The constructors. The constructors.
.. ocv:function:: Viz3d::Viz3d(const String& window_name = String()) .. ocv:function:: Viz3d::Viz3d(const String& window_name = String())
:param window_name: Name of the window. :param window_name: Name of the window.
Viz3d::showWidget viz::Viz3d::showWidget
----------------- ----------------------
Shows a widget in the window. Shows a widget in the window.
.. ocv:function:: void Viz3d::showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity()) .. ocv:function:: void Viz3d::showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity())
:param id: A unique id for the widget. :param id: A unique id for the widget.
:param widget: The widget to be rendered in the window. :param widget: The widget to be displayed in the window.
:param pose: Pose of the widget. :param pose: Pose of the widget.
Viz3d::removeWidget viz::Viz3d::removeWidget
------------------- ------------------------
Removes a widget from the window. Removes a widget from the window.
.. ocv:function:: void removeWidget(const String &id) .. ocv:function:: void removeWidget(const String &id)
:param id: The id of the widget that will be removed. :param id: The id of the widget that will be removed.
Viz3d::getWidget viz::Viz3d::getWidget
---------------- ---------------------
Retrieves a widget from the window. A widget is implicitly shared; Retrieves a widget from the window. A widget is implicitly shared;
that is, if the returned widget is modified, the changes will be that is, if the returned widget is modified, the changes will be
immediately visible in the window. immediately visible in the window.
...@@ -105,14 +238,14 @@ immediately visible in the window. ...@@ -105,14 +238,14 @@ immediately visible in the window.
:param id: The id of the widget that will be returned. :param id: The id of the widget that will be returned.
Viz3d::removeAllWidgets viz::Viz3d::removeAllWidgets
----------------------- ----------------------------
Removes all widgets from the window. Removes all widgets from the window.
.. ocv:function:: void removeAllWidgets() .. ocv:function:: void removeAllWidgets()
Viz3d::setWidgetPose viz::Viz3d::setWidgetPose
-------------------- -------------------------
Sets pose of a widget in the window. Sets pose of a widget in the window.
.. ocv:function:: void setWidgetPose(const String &id, const Affine3f &pose) .. ocv:function:: void setWidgetPose(const String &id, const Affine3f &pose)
...@@ -120,8 +253,8 @@ Sets pose of a widget in the window. ...@@ -120,8 +253,8 @@ Sets pose of a widget in the window.
:param id: The id of the widget whose pose will be set. :param id: The id of the widget whose pose will be set.
:param pose: The new pose of the widget. :param pose: The new pose of the widget.
Viz3d::updateWidgetPose viz::Viz3d::updateWidgetPose
----------------------- ----------------------------
Updates pose of a widget in the window by pre-multiplying its current pose. Updates pose of a widget in the window by pre-multiplying its current pose.
.. ocv:function:: void updateWidgetPose(const String &id, const Affine3f &pose) .. ocv:function:: void updateWidgetPose(const String &id, const Affine3f &pose)
...@@ -129,58 +262,58 @@ Updates pose of a widget in the window by pre-multiplying its current pose. ...@@ -129,58 +262,58 @@ Updates pose of a widget in the window by pre-multiplying its current pose.
:param id: The id of the widget whose pose will be updated. :param id: The id of the widget whose pose will be updated.
:param pose: The pose that the current pose of the widget will be pre-multiplied by. :param pose: The pose that the current pose of the widget will be pre-multiplied by.
Viz3d::getWidgetPose viz::Viz3d::getWidgetPose
-------------------- -------------------------
Returns the current pose of a widget in the window. Returns the current pose of a widget in the window.
.. ocv:function:: Affine3f getWidgetPose(const String &id) const .. ocv:function:: Affine3f getWidgetPose(const String &id) const
:param id: The id of the widget whose pose will be returned. :param id: The id of the widget whose pose will be returned.
Viz3d::setCamera viz::Viz3d::setCamera
---------------- ---------------------
Sets the intrinsic parameters of the viewer using Camera. Sets the intrinsic parameters of the viewer using Camera.
.. ocv:function:: void setCamera(const Camera &camera) .. ocv:function:: void setCamera(const Camera &camera)
:param camera: Camera object wrapping intrinsinc parameters. :param camera: Camera object wrapping intrinsinc parameters.
Viz3d::getCamera viz::Viz3d::getCamera
---------------- ---------------------
Returns a camera object that contains intrinsic parameters of the current viewer. Returns a camera object that contains intrinsic parameters of the current viewer.
.. ocv:function:: Camera getCamera() const .. ocv:function:: Camera getCamera() const
Viz3d::getViewerPose viz::Viz3d::getViewerPose
-------------------- -------------------------
Returns the current pose of the viewer. Returns the current pose of the viewer.
..ocv:function:: Affine3f getViewerPose() ..ocv:function:: Affine3f getViewerPose()
Viz3d::setViewerPose viz::Viz3d::setViewerPose
-------------------- -------------------------
Sets pose of the viewer. Sets pose of the viewer.
.. ocv:function:: void setViewerPose(const Affine3f &pose) .. ocv:function:: void setViewerPose(const Affine3f &pose)
:param pose: The new pose of the viewer. :param pose: The new pose of the viewer.
Viz3d::resetCameraViewpoint viz::Viz3d::resetCameraViewpoint
--------------------------- --------------------------------
Resets camera viewpoint to a 3D widget in the scene. Resets camera viewpoint to a 3D widget in the scene.
.. ocv:function:: void resetCameraViewpoint (const String &id) .. ocv:function:: void resetCameraViewpoint (const String &id)
:param pose: Id of a 3D widget. :param pose: Id of a 3D widget.
Viz3d::resetCamera viz::Viz3d::resetCamera
------------------ -----------------------
Resets camera. Resets camera.
.. ocv:function:: void resetCamera() .. ocv:function:: void resetCamera()
Viz3d::convertToWindowCoordinates viz::Viz3d::convertToWindowCoordinates
--------------------------------- --------------------------------------
Transforms a point in world coordinate system to window coordinate system. Transforms a point in world coordinate system to window coordinate system.
.. ocv:function:: void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord) .. ocv:function:: void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord)
...@@ -188,8 +321,8 @@ Transforms a point in world coordinate system to window coordinate system. ...@@ -188,8 +321,8 @@ Transforms a point in world coordinate system to window coordinate system.
:param pt: Point in world coordinate system. :param pt: Point in world coordinate system.
:param window_coord: Output point in window coordinate system. :param window_coord: Output point in window coordinate system.
Viz3d::converTo3DRay viz::Viz3d::converTo3DRay
-------------------- -------------------------
Transforms a point in window coordinate system to a 3D ray in world coordinate system. Transforms a point in window coordinate system to a 3D ray in world coordinate system.
.. ocv:function:: void converTo3DRay(const Point3d &window_coord, Point3d &origin, Vec3d &direction) .. ocv:function:: void converTo3DRay(const Point3d &window_coord, Point3d &origin, Vec3d &direction)
...@@ -198,36 +331,36 @@ Transforms a point in window coordinate system to a 3D ray in world coordinate s ...@@ -198,36 +331,36 @@ Transforms a point in window coordinate system to a 3D ray in world coordinate s
:param origin: Output origin of the ray. :param origin: Output origin of the ray.
:param direction: Output direction of the ray. :param direction: Output direction of the ray.
Viz3d::getWindowSize viz::Viz3d::getWindowSize
-------------------- -------------------------
Returns the current size of the window. Returns the current size of the window.
.. ocv:function:: Size getWindowSize() const .. ocv:function:: Size getWindowSize() const
Viz3d::setWindowSize viz::Viz3d::setWindowSize
-------------------- -------------------------
Sets the size of the window. Sets the size of the window.
.. ocv:function:: void setWindowSize(const Size &window_size) .. ocv:function:: void setWindowSize(const Size &window_size)
:param window_size: New size of the window. :param window_size: New size of the window.
Viz3d::getWindowName viz::Viz3d::getWindowName
-------------------- -------------------------
Returns the name of the window which has been set in the constructor. Returns the name of the window which has been set in the constructor.
.. ocv:function:: String getWindowName() const .. ocv:function:: String getWindowName() const
Viz3d::saveScreenshot viz::Viz3d::saveScreenshot
--------------------- --------------------------
Saves screenshot of the current scene. Saves screenshot of the current scene.
.. ocv:function:: void saveScreenshot(const String &file) .. ocv:function:: void saveScreenshot(const String &file)
:param file: Name of the file. :param file: Name of the file.
Viz3d::setWindowPosition viz::Viz3d::setWindowPosition
------------------------ -----------------------------
Sets the position of the window in the screen. Sets the position of the window in the screen.
.. ocv:function:: void setWindowPosition(int x, int y) .. ocv:function:: void setWindowPosition(int x, int y)
...@@ -235,28 +368,28 @@ Sets the position of the window in the screen. ...@@ -235,28 +368,28 @@ Sets the position of the window in the screen.
:param x: x coordinate of the window :param x: x coordinate of the window
:param y: y coordinate of the window :param y: y coordinate of the window
Viz3d::setFullScreen viz::Viz3d::setFullScreen
-------------------- -------------------------
Sets or unsets full-screen rendering mode. Sets or unsets full-screen rendering mode.
.. ocv:function:: void setFullScreen(bool mode) .. ocv:function:: void setFullScreen(bool mode)
:param mode: If true, window will use full-screen mode. :param mode: If true, window will use full-screen mode.
Viz3d::setBackgroundColor viz::Viz3d::setBackgroundColor
------------------------- ------------------------------
Sets background color. Sets background color.
.. ocv:function:: void setBackgroundColor(const Color& color = Color::black()) .. ocv:function:: void setBackgroundColor(const Color& color = Color::black())
Viz3d::spin viz::Viz3d::spin
----------- ----------------
The window renders and starts the event loop. The window renders and starts the event loop.
.. ocv:function:: void spin() .. ocv:function:: void spin()
Viz3d::spinOnce viz::Viz3d::spinOnce
--------------- --------------------
Starts the event loop for a given time. Starts the event loop for a given time.
.. ocv:function:: void spinOnce(int time = 1, bool force_redraw = false) .. ocv:function:: void spinOnce(int time = 1, bool force_redraw = false)
...@@ -264,32 +397,32 @@ Starts the event loop for a given time. ...@@ -264,32 +397,32 @@ Starts the event loop for a given time.
:param time: Amount of time in milliseconds for the event loop to keep running. :param time: Amount of time in milliseconds for the event loop to keep running.
:param force_draw: If true, window renders. :param force_draw: If true, window renders.
Viz3d::wasStopped viz::Viz3d::wasStopped
----------------- ----------------------
Returns whether the event loop has been stopped. Returns whether the event loop has been stopped.
.. ocv:function:: bool wasStopped() .. ocv:function:: bool wasStopped()
Viz3d::registerKeyboardCallback viz::Viz3d::registerKeyboardCallback
------------------------------- ------------------------------------
Sets keyboard handler. Sets keyboard handler.
.. ocv:function:: void registerKeyboardCallback(KeyboardCallback callback, void* cookie = 0) .. ocv:function:: void registerKeyboardCallback(KeyboardCallback callback, void* cookie = 0)
:param callback: Keyboard callback. :param callback: Keyboard callback ``(void (*KeyboardCallbackFunction(const KeyboardEvent&, void*))``.
:param cookie: The optional parameter passed to the callback. :param cookie: The optional parameter passed to the callback.
Viz3d::registerMouseCallback viz::Viz3d::registerMouseCallback
---------------------------- ---------------------------------
Sets mouse handler. Sets mouse handler.
.. ocv:function:: void registerMouseCallback(MouseCallback callback, void* cookie = 0) .. ocv:function:: void registerMouseCallback(MouseCallback callback, void* cookie = 0)
:param callback: Mouse callback. :param callback: Mouse callback ``(void (*MouseCallback)(const MouseEvent&, void*))``.
:param cookie: The optional parameter passed to the callback. :param cookie: The optional parameter passed to the callback.
Viz3d::setRenderingProperty viz::Viz3d::setRenderingProperty
--------------------------- --------------------------------
Sets rendering property of a widget. Sets rendering property of a widget.
.. ocv:function:: void setRenderingProperty(const String &id, int property, double value) .. ocv:function:: void setRenderingProperty(const String &id, int property, double value)
...@@ -298,49 +431,79 @@ Sets rendering property of a widget. ...@@ -298,49 +431,79 @@ Sets rendering property of a widget.
:param property: Property that will be modified. :param property: Property that will be modified.
:param value: The new value of the property. :param value: The new value of the property.
Viz3d::getRenderingProperty **Rendering property** can be one of the following:
---------------------------
* **POINT_SIZE**
* **OPACITY**
* **LINE_WIDTH**
* **FONT_SIZE**
* **REPRESENTATION**: Expected values are
* **REPRESENTATION_POINTS**
* **REPRESENTATION_WIREFRAME**
* **REPRESENTATION_SURFACE**
* **IMMEDIATE_RENDERING**:
* Turn on immediate rendering by setting the value to ``1``.
* Turn off immediate rendering by setting the value to ``0``.
* **SHADING**: Expected values are
* **SHADING_FLAT**
* **SHADING_GOURAUD**
* **SHADING_PHONG**
viz::Viz3d::getRenderingProperty
--------------------------------
Returns rendering property of a widget. Returns rendering property of a widget.
.. ocv:function:: double getRenderingProperty(const String &id, int property) .. ocv:function:: double getRenderingProperty(const String &id, int property)
:param id: Id of the widget. :param id: Id of the widget.
:param property: Property. :param property: Property.
Viz3d::setDesiredUpdateRate **Rendering property** can be one of the following:
---------------------------
* **POINT_SIZE**
* **OPACITY**
* **LINE_WIDTH**
* **FONT_SIZE**
* **REPRESENTATION**: Expected values are
* **REPRESENTATION_POINTS**
* **REPRESENTATION_WIREFRAME**
* **REPRESENTATION_SURFACE**
* **IMMEDIATE_RENDERING**:
* Turn on immediate rendering by setting the value to ``1``.
* Turn off immediate rendering by setting the value to ``0``.
* **SHADING**: Expected values are
* **SHADING_FLAT**
* **SHADING_GOURAUD**
* **SHADING_PHONG**
viz::Viz3d::setDesiredUpdateRate
--------------------------------
Sets desired update rate of the window. Sets desired update rate of the window.
.. ocv:function:: void setDesiredUpdateRate(double rate) .. ocv:function:: void setDesiredUpdateRate(double rate)
:param rate: Desired update rate. The default is 30. :param rate: Desired update rate. The default is 30.
Viz3d::getDesiredUpdateRate viz::Viz3d::getDesiredUpdateRate
--------------------------- --------------------------------
Returns desired update rate of the window. Returns desired update rate of the window.
.. ocv:function:: double getDesiredUpdateRate() .. ocv:function:: double getDesiredUpdateRate()
Viz3d::setRepresentationToSurface viz::Viz3d::setRepresentation
--------------------------------- -----------------------------
Sets geometry representation of the widgets to surface. Sets geometry representation of the widgets to surface, wireframe or points.
.. ocv:function:: void setRepresentationToSurface()
Viz3d::setRepresentationToWireframe
-----------------------------------
Sets geometry representation of the widgets to wireframe.
.. ocv:function:: void setRepresentationToWireframe()
Viz3d::setRepresentationToPoints
--------------------------------
Sets geometry representation of the widgets to points.
.. ocv:function:: void setRepresentationToPoints() .. ocv:function:: void setRepresentation(int representation)
Color :param representation: Geometry representation which can be one of the following:
-----
* **REPRESENTATION_POINTS**
* **REPRESENTATION_WIREFRAME**
* **REPRESENTATION_SURFACE**
viz::Color
----------
.. ocv:class:: Color .. ocv:class:: Color
This class a represents BGR color. :: This class a represents BGR color. ::
...@@ -367,8 +530,8 @@ This class a represents BGR color. :: ...@@ -367,8 +530,8 @@ This class a represents BGR color. ::
static Color gray(); static Color gray();
}; };
Mesh3d viz::Mesh3d
------ -----------
.. ocv:class:: Mesh3d .. ocv:class:: Mesh3d
This class wraps mesh attributes, and it can load a mesh from a ``ply`` file. :: This class wraps mesh attributes, and it can load a mesh from a ``ply`` file. ::
...@@ -387,8 +550,8 @@ This class wraps mesh attributes, and it can load a mesh from a ``ply`` file. :: ...@@ -387,8 +550,8 @@ This class wraps mesh attributes, and it can load a mesh from a ``ply`` file. ::
/* hidden */ /* hidden */
}; };
Mesh3d::loadMesh viz::Mesh3d::loadMesh
---------------- ---------------------
Loads a mesh from a ``ply`` file. Loads a mesh from a ``ply`` file.
.. ocv:function:: static Mesh3d loadMesh(const String& file) .. ocv:function:: static Mesh3d loadMesh(const String& file)
...@@ -396,8 +559,8 @@ Loads a mesh from a ``ply`` file. ...@@ -396,8 +559,8 @@ Loads a mesh from a ``ply`` file.
:param file: File name. :param file: File name.
KeyboardEvent viz::KeyboardEvent
------------- ------------------
.. ocv:class:: KeyboardEvent .. ocv:class:: KeyboardEvent
This class represents a keyboard event. :: This class represents a keyboard event. ::
...@@ -427,8 +590,8 @@ This class represents a keyboard event. :: ...@@ -427,8 +590,8 @@ This class represents a keyboard event. ::
/* hidden */ /* hidden */
}; };
KeyboardEvent::KeyboardEvent viz::KeyboardEvent::KeyboardEvent
---------------------------- ---------------------------------
Constructs a KeyboardEvent. Constructs a KeyboardEvent.
.. ocv:function:: KeyboardEvent (bool action, const std::string& key_sym, unsigned char key, bool alt, bool ctrl, bool shift) .. ocv:function:: KeyboardEvent (bool action, const std::string& key_sym, unsigned char key, bool alt, bool ctrl, bool shift)
...@@ -440,8 +603,8 @@ Constructs a KeyboardEvent. ...@@ -440,8 +603,8 @@ Constructs a KeyboardEvent.
:param ctrl: If true, ``ctrl`` is pressed. :param ctrl: If true, ``ctrl`` is pressed.
:param shift: If true, ``shift`` is pressed. :param shift: If true, ``shift`` is pressed.
MouseEvent viz::MouseEvent
---------- ---------------
.. ocv:class:: MouseEvent .. ocv:class:: MouseEvent
This class represents a mouse event. :: This class represents a mouse event. ::
...@@ -460,8 +623,8 @@ This class represents a mouse event. :: ...@@ -460,8 +623,8 @@ This class represents a mouse event. ::
unsigned int key_state; unsigned int key_state;
}; };
MouseEvent::MouseEvent viz::MouseEvent::MouseEvent
---------------------- ---------------------------
Constructs a MouseEvent. Constructs a MouseEvent.
.. ocv:function:: MouseEvent (const Type& type, const MouseButton& button, const Point& p, bool alt, bool ctrl, bool shift) .. ocv:function:: MouseEvent (const Type& type, const MouseButton& button, const Point& p, bool alt, bool ctrl, bool shift)
...@@ -473,8 +636,8 @@ Constructs a MouseEvent. ...@@ -473,8 +636,8 @@ Constructs a MouseEvent.
:param ctrl: If true, ``ctrl`` is pressed. :param ctrl: If true, ``ctrl`` is pressed.
:param shift: If true, ``shift`` is pressed. :param shift: If true, ``shift`` is pressed.
Camera viz::Camera
------ -----------
.. ocv:class:: Camera .. ocv:class:: Camera
This class wraps intrinsic parameters of a camera. It provides several constructors This class wraps intrinsic parameters of a camera. It provides several constructors
...@@ -509,8 +672,8 @@ that can extract the intrinsic parameters from ``field of view``, ``intrinsic ma ...@@ -509,8 +672,8 @@ that can extract the intrinsic parameters from ``field of view``, ``intrinsic ma
/* hidden */ /* hidden */
}; };
Camera::Camera viz::Camera::Camera
-------------- -------------------
Constructs a Camera. Constructs a Camera.
.. ocv:function:: Camera(float f_x, float f_y, float c_x, float c_y, const Size &window_size) .. ocv:function:: Camera(float f_x, float f_y, float c_x, float c_y, const Size &window_size)
...@@ -538,16 +701,16 @@ Constructs a Camera. ...@@ -538,16 +701,16 @@ Constructs a Camera.
:param proj: Projection matrix of the camera. :param proj: Projection matrix of the camera.
:param window_size: Size of the window. This together with projection matrix determines the field of view. :param window_size: Size of the window. This together with projection matrix determines the field of view.
Camera::computeProjectionMatrix viz::Camera::computeProjectionMatrix
------------------------------- ------------------------------------
Computes projection matrix using intrinsic parameters of the camera. Computes projection matrix using intrinsic parameters of the camera.
.. ocv:function:: void computeProjectionMatrix(Matx44f &proj) const .. ocv:function:: void computeProjectionMatrix(Matx44f &proj) const
:param proj: Output projection matrix. :param proj: Output projection matrix.
Camera::KinectCamera viz::Camera::KinectCamera
-------------------- -------------------------
Creates a Kinect Camera. Creates a Kinect Camera.
.. ocv:function:: static Camera KinectCamera(const Size &window_size) .. ocv:function:: static Camera KinectCamera(const Size &window_size)
......
...@@ -3,13 +3,29 @@ Widget ...@@ -3,13 +3,29 @@ Widget
.. highlight:: cpp .. highlight:: cpp
In this section, the built-in widgets are presented. In this section, the widget framework is explained. Widgets represent
2D or 3D objects, varying from simple ones such as lines to complex one such as
point clouds and meshes.
Widget Widgets are **implicitly shared**. Therefore, one can add a widget to the scene,
------ and modify the widget without re-adding the widget.
.. code-block:: cpp
...
/// Create a cloud widget
viz::CloudWidget cw(cloud, viz::Color::red());
/// Display it in a window
myWindow.showWidget("CloudWidget1", cw);
/// Modify it, and it will be modified in the window.
cw.setColor(viz::Color::yellow());
...
viz::Widget
-----------
.. ocv:class:: Widget .. ocv:class:: Widget
Base class of all widgets. Widget is implicitly shared.:: Base class of all widgets. Widget is implicitly shared. ::
class CV_EXPORTS Widget class CV_EXPORTS Widget
{ {
...@@ -32,16 +48,16 @@ Base class of all widgets. Widget is implicitly shared.:: ...@@ -32,16 +48,16 @@ Base class of all widgets. Widget is implicitly shared.::
/* hidden */ /* hidden */
}; };
Widget::fromPlyFile viz::Widget::fromPlyFile
------------------- ------------------------
Creates a widget from ply file. Creates a widget from ply file.
.. ocv:function:: static Widget fromPlyFile(const String &file_name) .. ocv:function:: static Widget fromPlyFile(const String &file_name)
:param file_name: Ply file name. :param file_name: Ply file name.
Widget::setRenderingProperty viz::Widget::setRenderingProperty
---------------------------- ---------------------------------
Sets rendering property of the widget. Sets rendering property of the widget.
.. ocv:function:: void setRenderingProperty(int property, double value) .. ocv:function:: void setRenderingProperty(int property, double value)
...@@ -49,22 +65,67 @@ Sets rendering property of the widget. ...@@ -49,22 +65,67 @@ Sets rendering property of the widget.
:param property: Property that will be modified. :param property: Property that will be modified.
:param value: The new value of the property. :param value: The new value of the property.
Widget::getRenderingProperty **Rendering property** can be one of the following:
----------------------------
* **POINT_SIZE**
* **OPACITY**
* **LINE_WIDTH**
* **FONT_SIZE**
* **REPRESENTATION**: Expected values are
* **REPRESENTATION_POINTS**
* **REPRESENTATION_WIREFRAME**
* **REPRESENTATION_SURFACE**
* **IMMEDIATE_RENDERING**:
* Turn on immediate rendering by setting the value to ``1``.
* Turn off immediate rendering by setting the value to ``0``.
* **SHADING**: Expected values are
* **SHADING_FLAT**
* **SHADING_GOURAUD**
* **SHADING_PHONG**
viz::Widget::getRenderingProperty
---------------------------------
Returns rendering property of the widget. Returns rendering property of the widget.
.. ocv:function:: double getRenderingProperty(int property) const .. ocv:function:: double getRenderingProperty(int property) const
:param property: Property. :param property: Property.
Widget::cast **Rendering property** can be one of the following:
------------
* **POINT_SIZE**
* **OPACITY**
* **LINE_WIDTH**
* **FONT_SIZE**
* **REPRESENTATION**: Expected values are
* **REPRESENTATION_POINTS**
* **REPRESENTATION_WIREFRAME**
* **REPRESENTATION_SURFACE**
* **IMMEDIATE_RENDERING**:
* Turn on immediate rendering by setting the value to ``1``.
* Turn off immediate rendering by setting the value to ``0``.
* **SHADING**: Expected values are
* **SHADING_FLAT**
* **SHADING_GOURAUD**
* **SHADING_PHONG**
viz::Widget::cast
-----------------
Casts a widget to another. Casts a widget to another.
.. ocv:function:: template<typename _W> _W cast() .. ocv:function:: template<typename _W> _W cast()
WidgetAccessor .. code-block:: cpp
--------------
// Create a sphere widget
viz::SphereWidget sw(Point3f(0.0f,0.0f,0.0f), 0.5f);
// Cast sphere widget to cloud widget
viz::CloudWidget cw = sw.cast<viz::CloudWidget>();
.. note:: 3D Widgets can only be cast to 3D Widgets. 2D Widgets can only be cast to 2D Widgets.
viz::WidgetAccessor
-------------------
.. ocv:class:: WidgetAccessor .. ocv:class:: WidgetAccessor
This class is for users who want to develop their own widgets using VTK library API. :: This class is for users who want to develop their own widgets using VTK library API. ::
...@@ -75,8 +136,31 @@ This class is for users who want to develop their own widgets using VTK library ...@@ -75,8 +136,31 @@ This class is for users who want to develop their own widgets using VTK library
static void setProp(Widget &widget, vtkSmartPointer<vtkProp> prop); static void setProp(Widget &widget, vtkSmartPointer<vtkProp> prop);
}; };
Widget3D viz::WidgetAccessor::getProp
-------- ----------------------------
Returns ``vtkProp`` of a given widget.
.. ocv:function:: static vtkSmartPointer<vtkProp> getProp(const Widget &widget)
:param widget: Widget whose ``vtkProp`` is to be returned.
.. note:: vtkProp has to be down cast appropriately to be modified.
.. code-block:: cpp
vtkActor * actor = vtkActor::SafeDownCast(viz::WidgetAccessor::getProp(widget));
viz::WidgetAccessor::setProp
----------------------------
Sets ``vtkProp`` of a given widget.
.. ocv:function:: static void setProp(Widget &widget, vtkSmartPointer<vtkProp> prop)
:param widget: Widget whose ``vtkProp`` is to be set.
:param prop: A ``vtkProp``.
viz::Widget3D
-------------
.. ocv:class:: Widget3D .. ocv:class:: Widget3D
Base class of all 3D widgets. :: Base class of all 3D widgets. ::
...@@ -95,38 +179,38 @@ Base class of all 3D widgets. :: ...@@ -95,38 +179,38 @@ Base class of all 3D widgets. ::
/* hidden */ /* hidden */
}; };
Widget3D::setPose viz::Widget3D::setPose
----------------- ----------------------
Sets pose of the widget. Sets pose of the widget.
.. ocv:function:: void setPose(const Affine3f &pose) .. ocv:function:: void setPose(const Affine3f &pose)
:param pose: The new pose of the widget. :param pose: The new pose of the widget.
Widget3D::updateWidgetPose viz::Widget3D::updateWidgetPose
-------------------------- -------------------------------
Updates pose of the widget by pre-multiplying its current pose. Updates pose of the widget by pre-multiplying its current pose.
.. ocv:function:: void updateWidgetPose(const Affine3f &pose) .. ocv:function:: void updateWidgetPose(const Affine3f &pose)
:param pose: The pose that the current pose of the widget will be pre-multiplied by. :param pose: The pose that the current pose of the widget will be pre-multiplied by.
Widget3D::getPose viz::Widget3D::getPose
----------------- ----------------------
Returns the current pose of the widget. Returns the current pose of the widget.
.. ocv:function:: Affine3f getWidgetPose() const .. ocv:function:: Affine3f getWidgetPose() const
Widget3D::setColor viz::Widget3D::setColor
------------------ -----------------------
Sets the color of the widget. Sets the color of the widget.
.. ocv:function:: void setColor(const Color &color) .. ocv:function:: void setColor(const Color &color)
:param color: Color :param color: color of type :ocv:class:`Color`
Widget2D viz::Widget2D
-------- -------------
.. ocv:class:: Widget2D .. ocv:class:: Widget2D
Base class of all 2D widgets. :: Base class of all 2D widgets. ::
...@@ -139,16 +223,16 @@ Base class of all 2D widgets. :: ...@@ -139,16 +223,16 @@ Base class of all 2D widgets. ::
void setColor(const Color &color); void setColor(const Color &color);
}; };
Widget2D::setColor viz::Widget2D::setColor
------------------ -----------------------
Sets the color of the widget. Sets the color of the widget.
.. ocv:function:: void setColor(const Color &color) .. ocv:function:: void setColor(const Color &color)
:param color: Color :param color: color of type :ocv:class:`Color`
LineWidget viz::LineWidget
---------- ---------------
.. ocv:class:: LineWidget .. ocv:class:: LineWidget
This 3D Widget defines a finite line. :: This 3D Widget defines a finite line. ::
...@@ -159,18 +243,18 @@ This 3D Widget defines a finite line. :: ...@@ -159,18 +243,18 @@ This 3D Widget defines a finite line. ::
LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white()); LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white());
}; };
LineWidget::LineWidget viz::LineWidget::LineWidget
---------------------- ---------------------------
Constructs a LineWidget. Constructs a LineWidget.
.. ocv:function:: LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white()) .. ocv:function:: LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white())
:param pt1: Start point of the line. :param pt1: Start point of the line.
:param pt2: End point of the line. :param pt2: End point of the line.
:param color: Color of the line. :param color: :ocv:class:`Color` of the line.
PlaneWidget viz::PlaneWidget
----------- ----------------
.. ocv:class:: PlaneWidget .. ocv:class:: PlaneWidget
This 3D Widget defines a finite plane. :: This 3D Widget defines a finite plane. ::
...@@ -184,24 +268,25 @@ This 3D Widget defines a finite plane. :: ...@@ -184,24 +268,25 @@ This 3D Widget defines a finite plane. ::
/* hidden */ /* hidden */
}; };
PlaneWidget::PlaneWidget viz::PlaneWidget::PlaneWidget
------------------------ -----------------------------
Constructs a PlaneWidget. Constructs a PlaneWidget.
.. ocv:function:: PlaneWidget(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white()) .. ocv:function:: PlaneWidget(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white())
:param coefs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0. :param coefs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0.
:param size: Size of the plane. :param size: Size of the plane.
:param color: Color of the plane. :param color: :ocv:class:`Color` of the plane.
.. ocv:function:: PlaneWidget(const Vec4f& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white()) .. ocv:function:: PlaneWidget(const Vec4f& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white())
:param coefs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0. :param coefs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0.
:param pt: Position of the plane. :param pt: Position of the plane.
:param color: Color of the plane. :param size: Size of the plane.
:param color: :ocv:class:`Color` of the plane.
SphereWidget viz::SphereWidget
------------ -----------------
.. ocv:class:: SphereWidget .. ocv:class:: SphereWidget
This 3D Widget defines a sphere. :: This 3D Widget defines a sphere. ::
...@@ -212,8 +297,8 @@ This 3D Widget defines a sphere. :: ...@@ -212,8 +297,8 @@ This 3D Widget defines a sphere. ::
SphereWidget(const cv::Point3f &center, float radius, int sphere_resolution = 10, const Color &color = Color::white()) SphereWidget(const cv::Point3f &center, float radius, int sphere_resolution = 10, const Color &color = Color::white())
}; };
SphereWidget::SphereWidget viz::SphereWidget::SphereWidget
-------------------------- -------------------------------
Constructs a SphereWidget. Constructs a SphereWidget.
.. ocv:function:: SphereWidget(const cv::Point3f &center, float radius, int sphere_resolution = 10, const Color &color = Color::white()) .. ocv:function:: SphereWidget(const cv::Point3f &center, float radius, int sphere_resolution = 10, const Color &color = Color::white())
...@@ -221,10 +306,10 @@ Constructs a SphereWidget. ...@@ -221,10 +306,10 @@ Constructs a SphereWidget.
:param center: Center of the sphere. :param center: Center of the sphere.
:param radius: Radius of the sphere. :param radius: Radius of the sphere.
:param sphere_resolution: Resolution of the sphere. :param sphere_resolution: Resolution of the sphere.
:param color: Color of the sphere. :param color: :ocv:class:`Color` of the sphere.
ArrowWidget viz::ArrowWidget
----------- ----------------
.. ocv:class:: ArrowWidget .. ocv:class:: ArrowWidget
This 3D Widget defines an arrow. :: This 3D Widget defines an arrow. ::
...@@ -235,8 +320,8 @@ This 3D Widget defines an arrow. :: ...@@ -235,8 +320,8 @@ This 3D Widget defines an arrow. ::
ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white()); ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white());
}; };
ArrowWidget::ArrowWidget viz::ArrowWidget::ArrowWidget
------------------------ -----------------------------
Constructs an ArrowWidget. Constructs an ArrowWidget.
.. ocv:function:: ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white()) .. ocv:function:: ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white())
...@@ -244,12 +329,12 @@ Constructs an ArrowWidget. ...@@ -244,12 +329,12 @@ Constructs an ArrowWidget.
:param pt1: Start point of the arrow. :param pt1: Start point of the arrow.
:param pt2: End point of the arrow. :param pt2: End point of the arrow.
:param thickness: Thickness of the arrow. Thickness of arrow head is also adjusted accordingly. :param thickness: Thickness of the arrow. Thickness of arrow head is also adjusted accordingly.
:param color: Color of the arrow. :param color: :ocv:class:`Color` of the arrow.
Arrow head is located at the end point of the arrow. Arrow head is located at the end point of the arrow.
CircleWidget viz::CircleWidget
------------ -----------------
.. ocv:class:: CircleWidget .. ocv:class:: CircleWidget
This 3D Widget defines a circle. :: This 3D Widget defines a circle. ::
...@@ -260,8 +345,8 @@ This 3D Widget defines a circle. :: ...@@ -260,8 +345,8 @@ This 3D Widget defines a circle. ::
CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white()); CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white());
}; };
CircleWidget::CircleWidget viz::CircleWidget::CircleWidget
-------------------------- -------------------------------
Constructs a CircleWidget. Constructs a CircleWidget.
.. ocv:function:: CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white()) .. ocv:function:: CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white())
...@@ -269,10 +354,10 @@ Constructs a CircleWidget. ...@@ -269,10 +354,10 @@ Constructs a CircleWidget.
:param pt: Center of the circle. :param pt: Center of the circle.
:param radius: Radius of the circle. :param radius: Radius of the circle.
:param thickness: Thickness of the circle. :param thickness: Thickness of the circle.
:param color: Color of the circle. :param color: :ocv:class:`Color` of the circle.
CylinderWidget viz::CylinderWidget
-------------- -------------------
.. ocv:class:: CylinderWidget .. ocv:class:: CylinderWidget
This 3D Widget defines a cylinder. :: This 3D Widget defines a cylinder. ::
...@@ -283,8 +368,8 @@ This 3D Widget defines a cylinder. :: ...@@ -283,8 +368,8 @@ This 3D Widget defines a cylinder. ::
CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white()); CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white());
}; };
CylinderWidget::CylinderWidget viz::CylinderWidget::CylinderWidget
------------------------------ -----------------------------------
Constructs a CylinderWidget. Constructs a CylinderWidget.
.. ocv:function:: CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white()) .. ocv:function:: CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white())
...@@ -293,10 +378,10 @@ Constructs a CylinderWidget. ...@@ -293,10 +378,10 @@ Constructs a CylinderWidget.
:param axis_direction: Direction of the axis of the cylinder. :param axis_direction: Direction of the axis of the cylinder.
:param radius: Radius of the cylinder. :param radius: Radius of the cylinder.
:param numsides: Resolution of the cylinder. :param numsides: Resolution of the cylinder.
:param color: Color of the cylinder. :param color: :ocv:class:`Color` of the cylinder.
CubeWidget viz::CubeWidget
---------- ---------------
.. ocv:class:: CubeWidget .. ocv:class:: CubeWidget
This 3D Widget defines a cube. :: This 3D Widget defines a cube. ::
...@@ -307,8 +392,8 @@ This 3D Widget defines a cube. :: ...@@ -307,8 +392,8 @@ This 3D Widget defines a cube. ::
CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white()); CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white());
}; };
CubeWidget::CubeWidget viz::CubeWidget::CubeWidget
---------------------- ---------------------------
Constructs a CudeWidget. Constructs a CudeWidget.
.. ocv:function:: CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white()) .. ocv:function:: CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white())
...@@ -316,10 +401,14 @@ Constructs a CudeWidget. ...@@ -316,10 +401,14 @@ Constructs a CudeWidget.
:param pt_min: Specifies minimum point of the bounding box. :param pt_min: Specifies minimum point of the bounding box.
:param pt_max: Specifies maximum point of the bounding box. :param pt_max: Specifies maximum point of the bounding box.
:param wire_frame: If true, cube is represented as wireframe. :param wire_frame: If true, cube is represented as wireframe.
:param color: Color of the cube. :param color: :ocv:class:`Color` of the cube.
CoordinateSystemWidget .. image:: images/cube_widget.png
---------------------- :alt: Cube Widget
:align: center
viz::CoordinateSystemWidget
---------------------------
.. ocv:class:: CoordinateSystemWidget .. ocv:class:: CoordinateSystemWidget
This 3D Widget represents a coordinate system. :: This 3D Widget represents a coordinate system. ::
...@@ -330,16 +419,16 @@ This 3D Widget represents a coordinate system. :: ...@@ -330,16 +419,16 @@ This 3D Widget represents a coordinate system. ::
CoordinateSystemWidget(double scale = 1.0); CoordinateSystemWidget(double scale = 1.0);
}; };
CoordinateSystemWidget::CoordinateSystemWidget viz::CoordinateSystemWidget::CoordinateSystemWidget
---------------------------------------------- ---------------------------------------------------
Constructs a CoordinateSystemWidget. Constructs a CoordinateSystemWidget.
.. ocv:function:: CoordinateSystemWidget(double scale = 1.0) .. ocv:function:: CoordinateSystemWidget(double scale = 1.0)
:param scale: Determines the size of the axes. :param scale: Determines the size of the axes.
PolyLineWidget viz::PolyLineWidget
-------------- -------------------
.. ocv:class:: PolyLineWidget .. ocv:class:: PolyLineWidget
This 3D Widget defines a poly line. :: This 3D Widget defines a poly line. ::
...@@ -353,17 +442,17 @@ This 3D Widget defines a poly line. :: ...@@ -353,17 +442,17 @@ This 3D Widget defines a poly line. ::
/* hidden */ /* hidden */
}; };
PolyLineWidget::PolyLineWidget viz::PolyLineWidget::PolyLineWidget
------------------------------ -----------------------------------
Constructs a PolyLineWidget. Constructs a PolyLineWidget.
.. ocv:function:: PolyLineWidget(InputArray points, const Color &color = Color::white()) .. ocv:function:: PolyLineWidget(InputArray points, const Color &color = Color::white())
:param points: Point set. :param points: Point set.
:param color: Color of the poly line. :param color: :ocv:class:`Color` of the poly line.
GridWidget viz::GridWidget
---------- ---------------
.. ocv:class:: GridWidget .. ocv:class:: GridWidget
This 3D Widget defines a grid. :: This 3D Widget defines a grid. ::
...@@ -379,25 +468,25 @@ This 3D Widget defines a grid. :: ...@@ -379,25 +468,25 @@ This 3D Widget defines a grid. ::
/* hidden */ /* hidden */
}; };
GridWidget::GridWidget viz::GridWidget::GridWidget
---------------------- ---------------------------
Constructs a GridWidget. Constructs a GridWidget.
.. ocv:function:: GridWidget(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white()) .. ocv:function:: GridWidget(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white())
:param dimensions: Number of columns and rows, respectively. :param dimensions: Number of columns and rows, respectively.
:param spacing: Size of each column and row, respectively. :param spacing: Size of each column and row, respectively.
:param color: Color of the grid. :param color: :ocv:class:`Color` of the grid.
.. ocv:function: GridWidget(const Vec4f &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white()) .. ocv:function: GridWidget(const Vec4f &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white())
:param coeffs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0. :param coeffs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0.
:param dimensions: Number of columns and rows, respectively. :param dimensions: Number of columns and rows, respectively.
:param spacing: Size of each column and row, respectively. :param spacing: Size of each column and row, respectively.
:param color: Color of the grid. :param color: :ocv:class:`Color` of the grid.
Text3DWidget viz::Text3DWidget
------------ -----------------
.. ocv:class:: Text3DWidget .. ocv:class:: Text3DWidget
This 3D Widget represents 3D text. The text always faces the camera. :: This 3D Widget represents 3D text. The text always faces the camera. ::
...@@ -405,39 +494,40 @@ This 3D Widget represents 3D text. The text always faces the camera. :: ...@@ -405,39 +494,40 @@ This 3D Widget represents 3D text. The text always faces the camera. ::
class CV_EXPORTS Text3DWidget : public Widget3D class CV_EXPORTS Text3DWidget : public Widget3D
{ {
public: public:
Text3DWidget(const String &text, const Point3f &position, double text_scale = 1.0, const Color &color = Color::white()); Text3DWidget(const String &text, const Point3f &position, double text_scale = 1.0, double face_camera = true, const Color &color = Color::white());
void setText(const String &text); void setText(const String &text);
String getText() const; String getText() const;
}; };
Text3DWidget::Text3DWidget viz::Text3DWidget::Text3DWidget
-------------------------- -------------------------------
Constructs a Text3DWidget. Constructs a Text3DWidget.
.. ocv:function:: Text3DWidget(const String &text, const Point3f &position, double text_scale = 1.0, const Color &color = Color::white()) .. ocv:function:: Text3DWidget(const String &text, const Point3f &position, double text_scale = 1.0, double face_camera = true, const Color &color = Color::white())
:param text: Text content of the widget. :param text: Text content of the widget.
:param position: Position of the text. :param position: Position of the text.
:param text_scale: Size of the text. :param text_scale: Size of the text.
:param color: Color of the text. :param face_camera: If true, text always faces the camera.
:param color: :ocv:class:`Color` of the text.
Text3DWidget::setText viz::Text3DWidget::setText
--------------------- --------------------------
Sets the text content of the widget. Sets the text content of the widget.
.. ocv:function:: void setText(const String &text) .. ocv:function:: void setText(const String &text)
:param text: Text content of the widget. :param text: Text content of the widget.
Text3DWidget::getText viz::Text3DWidget::getText
--------------------- --------------------------
Returns the current text content of the widget. Returns the current text content of the widget.
.. ocv:function:: String getText() const .. ocv:function:: String getText() const
TextWidget viz::TextWidget
---------- ---------------
.. ocv:class:: TextWidget .. ocv:class:: TextWidget
This 2D Widget represents text overlay. :: This 2D Widget represents text overlay. ::
...@@ -451,8 +541,8 @@ This 2D Widget represents text overlay. :: ...@@ -451,8 +541,8 @@ This 2D Widget represents text overlay. ::
String getText() const; String getText() const;
}; };
TextWidget::TextWidget viz::TextWidget::TextWidget
---------------------- ---------------------------
Constructs a TextWidget. Constructs a TextWidget.
.. ocv:function:: TextWidget(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white()) .. ocv:function:: TextWidget(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white())
...@@ -460,24 +550,24 @@ Constructs a TextWidget. ...@@ -460,24 +550,24 @@ Constructs a TextWidget.
:param text: Text content of the widget. :param text: Text content of the widget.
:param pos: Position of the text. :param pos: Position of the text.
:param font_size: Font size. :param font_size: Font size.
:param color: Color of the text. :param color: :ocv:class:`Color` of the text.
TextWidget::setText viz::TextWidget::setText
--------------------- ------------------------
Sets the text content of the widget. Sets the text content of the widget.
.. ocv:function:: void setText(const String &text) .. ocv:function:: void setText(const String &text)
:param text: Text content of the widget. :param text: Text content of the widget.
TextWidget::getText viz::TextWidget::getText
--------------------- ------------------------
Returns the current text content of the widget. Returns the current text content of the widget.
.. ocv:function:: String getText() const .. ocv:function:: String getText() const
ImageOverlayWidget viz::ImageOverlayWidget
------------------ -----------------------
.. ocv:class:: ImageOverlayWidget .. ocv:class:: ImageOverlayWidget
This 2D Widget represents an image overlay. :: This 2D Widget represents an image overlay. ::
...@@ -490,28 +580,28 @@ This 2D Widget represents an image overlay. :: ...@@ -490,28 +580,28 @@ This 2D Widget represents an image overlay. ::
void setImage(const Mat &image); void setImage(const Mat &image);
}; };
ImageOverlayWidget::ImageOverlayWidget viz::ImageOverlayWidget::ImageOverlayWidget
-------------------------------------- -------------------------------------------
Constructs a ImageOverlayWidget. Constructs an ImageOverlayWidget.
.. ocv:function:: ImageOverlayWidget(const Mat &image, const Rect &rect) .. ocv:function:: ImageOverlayWidget(const Mat &image, const Rect &rect)
:param image: BGR or Gray-Scale image. :param image: BGR or Gray-Scale image.
:param rect: Image is scaled and positioned based on rect. :param rect: Image is scaled and positioned based on rect.
ImageOverlayWidget::setImage viz::ImageOverlayWidget::setImage
---------------------------- ---------------------------------
Sets the image content of the widget. Sets the image content of the widget.
.. ocv:function:: void setImage(const Mat &image) .. ocv:function:: void setImage(const Mat &image)
:param image: BGR or Gray-Scale image. :param image: BGR or Gray-Scale image.
Image3DWidget viz::Image3DWidget
------------- ------------------
.. ocv:class:: Image3DWidget .. ocv:class:: Image3DWidget
This 3D Widget represents 3D image. :: This 3D Widget represents an image in 3D space. ::
class CV_EXPORTS Image3DWidget : public Widget3D class CV_EXPORTS Image3DWidget : public Widget3D
{ {
...@@ -524,9 +614,9 @@ This 3D Widget represents 3D image. :: ...@@ -524,9 +614,9 @@ This 3D Widget represents 3D image. ::
void setImage(const Mat &image); void setImage(const Mat &image);
}; };
Image3DWidget::Image3DWidget viz::Image3DWidget::Image3DWidget
---------------------------- ---------------------------------
Constructs a Image3DWidget. Constructs an Image3DWidget.
.. ocv:function:: Image3DWidget(const Mat &image, const Size &size) .. ocv:function:: Image3DWidget(const Mat &image, const Size &size)
...@@ -541,19 +631,19 @@ Constructs a Image3DWidget. ...@@ -541,19 +631,19 @@ Constructs a Image3DWidget.
:param image: BGR or Gray-Scale image. :param image: BGR or Gray-Scale image.
:param size: Size of the image. :param size: Size of the image.
Image3DWidget::setImage viz::Image3DWidget::setImage
----------------------- ----------------------------
Sets the image content of the widget. Sets the image content of the widget.
.. ocv:function:: void setImage(const Mat &image) .. ocv:function:: void setImage(const Mat &image)
:param image: BGR or Gray-Scale image. :param image: BGR or Gray-Scale image.
CameraPositionWidget viz::CameraPositionWidget
-------------------- -------------------------
.. ocv:class:: CameraPositionWidget .. ocv:class:: CameraPositionWidget
This 3D Widget represents camera position. :: This 3D Widget represents camera position in a scene by its axes or viewing frustum. ::
class CV_EXPORTS CameraPositionWidget : public Widget3D class CV_EXPORTS CameraPositionWidget : public Widget3D
{ {
...@@ -566,43 +656,72 @@ This 3D Widget represents camera position. :: ...@@ -566,43 +656,72 @@ This 3D Widget represents camera position. ::
CameraPositionWidget(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white()); CameraPositionWidget(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
//! Creates frustum and display given image at the far plane //! Creates frustum and display given image at the far plane
CameraPositionWidget(const Matx33f &K, const Mat &img, double scale = 1.0, const Color &color = Color::white()); CameraPositionWidget(const Matx33f &K, const Mat &img, double scale = 1.0, const Color &color = Color::white());
//! Creates frustum and display given image at the far plane
CameraPositionWidget(const Vec2f &fov, const Mat &img, double scale = 1.0, const Color &color = Color::white());
}; };
CameraPositionWidget::CameraPositionWidget viz::CameraPositionWidget::CameraPositionWidget
------------------------------------------ -----------------------------------------------
Constructs a CameraPositionWidget. Constructs a CameraPositionWidget.
.. ocv:function:: CameraPositionWidget(double scale = 1.0) - **Display camera coordinate frame.**
Creates camera coordinate frame at the origin. .. ocv:function:: CameraPositionWidget(double scale = 1.0)
.. ocv:function:: CameraPositionWidget(const Matx33f &K, double scale = 1.0, const Color &color = Color::white())
:param K: Intrinsic matrix of the camera. Creates camera coordinate frame at the origin.
:param scale: Scale of the frustum.
:param color: Color of the frustum. .. image:: images/cpw1.png
:alt: Camera coordinate frame
Creates viewing frustum of the camera based on its intrinsic matrix K. :align: center
.. ocv:function:: CameraPositionWidget(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white())
:param fov: Field of view of the camera (horizontal, vertical). - **Display the viewing frustum.**
:param scale: Scale of the frustum.
:param color: Color of the frustum.
Creates viewing frustum of the camera based on its field of view fov.
.. ocv:function:: CameraPositionWidget(const Matx33f &K, const Mat &img, double scale = 1.0, const Color &color = Color::white()) .. ocv:function:: CameraPositionWidget(const Matx33f &K, double scale = 1.0, const Color &color = Color::white())
:param K: Intrinsic matrix of the camera. :param K: Intrinsic matrix of the camera.
:param img: BGR or Gray-Scale image that is going to be displayed at the far plane of the frustum. :param scale: Scale of the frustum.
:param scale: Scale of the frustum and image. :param color: :ocv:class:`Color` of the frustum.
:param color: Color of the frustum.
Creates viewing frustum of the camera based on its intrinsic matrix K.
Creates viewing frustum of the camera based on its intrinsic matrix K, and displays image on the far end plane.
TrajectoryWidget .. ocv:function:: CameraPositionWidget(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white())
----------------
:param fov: Field of view of the camera (horizontal, vertical).
:param scale: Scale of the frustum.
:param color: :ocv:class:`Color` of the frustum.
Creates viewing frustum of the camera based on its field of view fov.
.. image:: images/cpw2.png
:alt: Camera viewing frustum
:align: center
- **Display image on the far plane of the viewing frustum.**
.. ocv:function:: CameraPositionWidget(const Matx33f &K, const Mat &img, double scale = 1.0, const Color &color = Color::white())
:param K: Intrinsic matrix of the camera.
:param img: BGR or Gray-Scale image that is going to be displayed on the far plane of the frustum.
:param scale: Scale of the frustum and image.
:param color: :ocv:class:`Color` of the frustum.
Creates viewing frustum of the camera based on its intrinsic matrix K, and displays image on the far end plane.
.. ocv:function:: CameraPositionWidget(const Vec2f &fov, const Mat &img, double scale = 1.0, const Color &color = Color::white())
:param fov: Field of view of the camera (horizontal, vertical).
:param img: BGR or Gray-Scale image that is going to be displayed on the far plane of the frustum.
:param scale: Scale of the frustum and image.
:param color: :ocv:class:`Color` of the frustum.
Creates viewing frustum of the camera based on its intrinsic matrix K, and displays image on the far end plane.
.. image:: images/cpw3.png
:alt: Camera viewing frustum with image
:align: center
viz::TrajectoryWidget
---------------------
.. ocv:class:: TrajectoryWidget .. ocv:class:: TrajectoryWidget
This 3D Widget represents a trajectory. :: This 3D Widget represents a trajectory. ::
...@@ -623,15 +742,15 @@ This 3D Widget represents a trajectory. :: ...@@ -623,15 +742,15 @@ This 3D Widget represents a trajectory. ::
/* hidden */ /* hidden */
}; };
TrajectoryWidget::TrajectoryWidget viz::TrajectoryWidget::TrajectoryWidget
---------------------------------- ---------------------------------------
Constructs a TrajectoryWidget. Constructs a TrajectoryWidget.
.. ocv:function:: TrajectoryWidget(const std::vector<Affine3f> &path, int display_mode = TrajectoryWidget::DISPLAY_PATH, const Color &color = Color::white(), double scale = 1.0) .. ocv:function:: TrajectoryWidget(const std::vector<Affine3f> &path, int display_mode = TrajectoryWidget::DISPLAY_PATH, const Color &color = Color::white(), double scale = 1.0)
:param path: List of poses on a trajectory. :param path: List of poses on a trajectory.
:param display_mode: Display mode. This can be DISPLAY_PATH, DISPLAY_FRAMES, DISPLAY_PATH & DISPLAY_FRAMES. :param display_mode: Display mode. This can be DISPLAY_PATH, DISPLAY_FRAMES, DISPLAY_PATH & DISPLAY_FRAMES.
:param color: Color of the polyline that represents path. Frames are not affected. :param color: :ocv:class:`Color` of the polyline that represents path. Frames are not affected.
:param scale: Scale of the frames. Polyline is not affected. :param scale: Scale of the frames. Polyline is not affected.
Displays trajectory of the given path as follows: Displays trajectory of the given path as follows:
...@@ -645,7 +764,7 @@ Constructs a TrajectoryWidget. ...@@ -645,7 +764,7 @@ Constructs a TrajectoryWidget.
:param path: List of poses on a trajectory. :param path: List of poses on a trajectory.
:param K: Intrinsic matrix of the camera. :param K: Intrinsic matrix of the camera.
:param scale: Scale of the frustums. :param scale: Scale of the frustums.
:param color: Color of the frustums. :param color: :ocv:class:`Color` of the frustums.
Displays frustums at each pose of the trajectory. Displays frustums at each pose of the trajectory.
...@@ -654,12 +773,12 @@ Constructs a TrajectoryWidget. ...@@ -654,12 +773,12 @@ Constructs a TrajectoryWidget.
:param path: List of poses on a trajectory. :param path: List of poses on a trajectory.
:param fov: Field of view of the camera (horizontal, vertical). :param fov: Field of view of the camera (horizontal, vertical).
:param scale: Scale of the frustums. :param scale: Scale of the frustums.
:param color: Color of the frustums. :param color: :ocv:class:`Color` of the frustums.
Displays frustums at each pose of the trajectory. Displays frustums at each pose of the trajectory.
SpheresTrajectoryWidget viz::SpheresTrajectoryWidget
----------------------- ----------------------------
.. ocv:class:: SpheresTrajectoryWidget .. ocv:class:: SpheresTrajectoryWidget
This 3D Widget represents a trajectory using spheres and lines, where spheres represent the positions of the camera, and lines This 3D Widget represents a trajectory using spheres and lines, where spheres represent the positions of the camera, and lines
...@@ -673,8 +792,8 @@ represent the direction from previous position to the current. :: ...@@ -673,8 +792,8 @@ represent the direction from previous position to the current. ::
Color &line_color = Color::white(), const Color &sphere_color = Color::white()); Color &line_color = Color::white(), const Color &sphere_color = Color::white());
}; };
SpheresTrajectoryWidget::SpheresTrajectoryWidget viz::SpheresTrajectoryWidget::SpheresTrajectoryWidget
------------------------------------------------ -----------------------------------------------------
Constructs a SpheresTrajectoryWidget. Constructs a SpheresTrajectoryWidget.
.. ocv:function:: SpheresTrajectoryWidget(const std::vector<Affine3f> &path, float line_length = 0.05f, double init_sphere_radius = 0.021, double sphere_radius = 0.007, const Color &line_color = Color::white(), const Color &sphere_color = Color::white()) .. ocv:function:: SpheresTrajectoryWidget(const std::vector<Affine3f> &path, float line_length = 0.05f, double init_sphere_radius = 0.021, double sphere_radius = 0.007, const Color &line_color = Color::white(), const Color &sphere_color = Color::white())
...@@ -683,11 +802,11 @@ Constructs a SpheresTrajectoryWidget. ...@@ -683,11 +802,11 @@ Constructs a SpheresTrajectoryWidget.
:param line_length: Length of the lines. :param line_length: Length of the lines.
:param init_sphere_radius: Radius of the first sphere which represents the initial position of the camera. :param init_sphere_radius: Radius of the first sphere which represents the initial position of the camera.
:param sphere_radius: Radius of the rest of the spheres. :param sphere_radius: Radius of the rest of the spheres.
:param line_color: Color of the lines. :param line_color: :ocv:class:`Color` of the lines.
:param sphere_color: Color of the spheres. :param sphere_color: :ocv:class:`Color` of the spheres.
CloudWidget viz::CloudWidget
----------- ----------------
.. ocv:class:: CloudWidget .. ocv:class:: CloudWidget
This 3D Widget defines a point cloud. :: This 3D Widget defines a point cloud. ::
...@@ -704,26 +823,28 @@ This 3D Widget defines a point cloud. :: ...@@ -704,26 +823,28 @@ This 3D Widget defines a point cloud. ::
/* hidden */ /* hidden */
}; };
CloudWidget::CloudWidget viz::CloudWidget::CloudWidget
------------------------ -----------------------------
Constructs a CloudWidget. Constructs a CloudWidget.
.. ocv:function:: CloudWidget(InputArray cloud, InputArray colors) .. ocv:function:: CloudWidget(InputArray cloud, InputArray colors)
:param cloud: Point set which can be of type: CV_32FC3, CV_32FC4, CV_64FC3, CV_64FC4. :param cloud: Set of points which can be of type: ``CV_32FC3``, ``CV_32FC4``, ``CV_64FC3``, ``CV_64FC4``.
:param colors: Set of colors. It has to be of the same size with cloud. :param colors: Set of colors. It has to be of the same size with cloud.
Points in the cloud belong to mask when they are set to (NaN, NaN, NaN). Points in the cloud belong to mask when they are set to (NaN, NaN, NaN).
.. ocv:function:: CloudWidget(InputArray cloud, const Color &color = Color::white()) .. ocv:function:: CloudWidget(InputArray cloud, const Color &color = Color::white())
:param cloud: Point set which can be of type: CV_32FC3, CV_32FC4, CV_64FC3, CV_64FC4. :param cloud: Set of points which can be of type: ``CV_32FC3``, ``CV_32FC4``, ``CV_64FC3``, ``CV_64FC4``.
:param color: A single color for the whole cloud. :param color: A single :ocv:class:`Color` for the whole cloud.
Points in the cloud belong to mask when they are set to (NaN, NaN, NaN). Points in the cloud belong to mask when they are set to (NaN, NaN, NaN).
.. note:: In case there are four channels in the cloud, fourth channel is ignored.
CloudCollectionWidget viz::CloudCollectionWidget
--------------------- --------------------------
.. ocv:class:: CloudCollectionWidget .. ocv:class:: CloudCollectionWidget
This 3D Widget defines a collection of clouds. :: This 3D Widget defines a collection of clouds. ::
...@@ -742,19 +863,19 @@ This 3D Widget defines a collection of clouds. :: ...@@ -742,19 +863,19 @@ This 3D Widget defines a collection of clouds. ::
/* hidden */ /* hidden */
}; };
CloudCollectionWidget::CloudCollectionWidget viz::CloudCollectionWidget::CloudCollectionWidget
-------------------------------------------- -------------------------------------------------
Constructs a CloudCollectionWidget. Constructs a CloudCollectionWidget.
.. ocv:function:: CloudCollectionWidget() .. ocv:function:: CloudCollectionWidget()
CloudCollectionWidget::addCloud viz::CloudCollectionWidget::addCloud
------------------------------- ------------------------------------
Adds a cloud to the collection. Adds a cloud to the collection.
.. ocv:function:: void addCloud(InputArray cloud, InputArray colors, const Affine3f &pose = Affine3f::Identity()) .. ocv:function:: void addCloud(InputArray cloud, InputArray colors, const Affine3f &pose = Affine3f::Identity())
:param cloud: Point set which can be of type: CV_32FC3, CV_32FC4, CV_64FC3, CV_64FC4. :param cloud: Point set which can be of type: ``CV_32FC3``, ``CV_32FC4``, ``CV_64FC3``, ``CV_64FC4``.
:param colors: Set of colors. It has to be of the same size with cloud. :param colors: Set of colors. It has to be of the same size with cloud.
:param pose: Pose of the cloud. :param pose: Pose of the cloud.
...@@ -762,14 +883,16 @@ Adds a cloud to the collection. ...@@ -762,14 +883,16 @@ Adds a cloud to the collection.
.. ocv:function:: void addCloud(InputArray cloud, const Color &color = Color::white(), const Affine3f &pose = Affine3f::Identity()) .. ocv:function:: void addCloud(InputArray cloud, const Color &color = Color::white(), const Affine3f &pose = Affine3f::Identity())
:param cloud: Point set which can be of type: CV_32FC3, CV_32FC4, CV_64FC3, CV_64FC4. :param cloud: Point set which can be of type: ``CV_32FC3``, ``CV_32FC4``, ``CV_64FC3``, ``CV_64FC4``.
:param colors: A single color for the whole cloud. :param colors: A single :ocv:class:`Color` for the whole cloud.
:param pose: Pose of the cloud. :param pose: Pose of the cloud.
Points in the cloud belong to mask when they are set to (NaN, NaN, NaN). Points in the cloud belong to mask when they are set to (NaN, NaN, NaN).
.. note:: In case there are four channels in the cloud, fourth channel is ignored.
CloudNormalsWidget viz::CloudNormalsWidget
------------------ -----------------------
.. ocv:class:: CloudNormalsWidget .. ocv:class:: CloudNormalsWidget
This 3D Widget represents normals of a point cloud. :: This 3D Widget represents normals of a point cloud. ::
...@@ -783,20 +906,22 @@ This 3D Widget represents normals of a point cloud. :: ...@@ -783,20 +906,22 @@ This 3D Widget represents normals of a point cloud. ::
/* hidden */ /* hidden */
}; };
CloudNormalsWidget::CloudNormalsWidget viz::CloudNormalsWidget::CloudNormalsWidget
-------------------------------------- -------------------------------------------
Constructs a CloudNormalsWidget. Constructs a CloudNormalsWidget.
.. ocv:function:: CloudNormalsWidget(InputArray cloud, InputArray normals, int level = 100, float scale = 0.02f, const Color &color = Color::white()) .. ocv:function:: CloudNormalsWidget(InputArray cloud, InputArray normals, int level = 100, float scale = 0.02f, const Color &color = Color::white())
:param cloud: Point set which can be of type: CV_32FC3, CV_32FC4, CV_64FC3, CV_64FC4. :param cloud: Point set which can be of type: ``CV_32FC3``, ``CV_32FC4``, ``CV_64FC3``, ``CV_64FC4``.
:param normals: A set of normals that has to be of same type with cloud. :param normals: A set of normals that has to be of same type with cloud.
:param level: Display only every levelth normal. :param level: Display only every ``level`` th normal.
:param scale: Scale of the arrows that represent normals. :param scale: Scale of the arrows that represent normals.
:param color: Color of the arrows that represent normals. :param color: :ocv:class:`Color` of the arrows that represent normals.
.. note:: In case there are four channels in the cloud, fourth channel is ignored.
MeshWidget viz::MeshWidget
---------- ---------------
.. ocv:class:: MeshWidget .. ocv:class:: MeshWidget
This 3D Widget defines a mesh. :: This 3D Widget defines a mesh. ::
...@@ -810,13 +935,13 @@ This 3D Widget defines a mesh. :: ...@@ -810,13 +935,13 @@ This 3D Widget defines a mesh. ::
/* hidden */ /* hidden */
}; };
MeshWidget::MeshWidget viz::MeshWidget::MeshWidget
---------------------- ---------------------------
Constructs a MeshWidget. Constructs a MeshWidget.
.. ocv:function:: MeshWidget(const Mesh3d &mesh) .. ocv:function:: MeshWidget(const Mesh3d &mesh)
:param mesh: Mesh object that will be displayed. :param mesh: :ocv:class:`Mesh3d` object that will be displayed.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment