rename widgets from *Widgets to W*
This commit is contained in:
parent
f570b3e18d
commit
c31fb8ffff
@ -37,19 +37,19 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* @class TriangleWidget
|
||||
* @class WTriangle
|
||||
* @brief Defining our own 3D Triangle widget
|
||||
*/
|
||||
class TriangleWidget : public viz::Widget3D
|
||||
class WTriangle : public viz::Widget3D
|
||||
{
|
||||
public:
|
||||
TriangleWidget(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white());
|
||||
WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white());
|
||||
};
|
||||
|
||||
/**
|
||||
* @function TriangleWidget::TriangleWidget
|
||||
* @function WTriangle::WTriangle
|
||||
*/
|
||||
TriangleWidget::TriangleWidget(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color)
|
||||
WTriangle::WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color)
|
||||
{
|
||||
// Create a triangle
|
||||
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
|
||||
@ -99,7 +99,7 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
|
||||
viz::Viz3d myWindow("Creating Widgets");
|
||||
|
||||
/// Create a triangle widget
|
||||
TriangleWidget tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red());
|
||||
WTriangle tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red());
|
||||
|
||||
/// Show widget in the visualizer window
|
||||
myWindow.showWidget("TRIANGLE", tw);
|
||||
@ -119,10 +119,10 @@ Here is the general structure of the program:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
class TriangleWidget : public viz::Widget3D
|
||||
class WTriangle : public viz::Widget3D
|
||||
{
|
||||
public:
|
||||
TriangleWidget(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white());
|
||||
WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white());
|
||||
};
|
||||
|
||||
* Assign a VTK actor to the widget.
|
||||
@ -144,7 +144,7 @@ Here is the general structure of the program:
|
||||
.. code-block:: cpp
|
||||
|
||||
/// Create a triangle widget
|
||||
TriangleWidget tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red());
|
||||
WTriangle tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red());
|
||||
|
||||
/// Show widget in the visualizer window
|
||||
myWindow.showWidget("TRIANGLE", tw);
|
||||
|
@ -67,7 +67,7 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
|
||||
viz::Viz3d myWindow("Coordinate Frame");
|
||||
|
||||
/// Add coordinate axes
|
||||
myWindow.showWidget("Coordinate Widget", viz::CoordinateSystemWidget());
|
||||
myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());
|
||||
|
||||
/// Let's assume camera has the following properties
|
||||
Point3f cam_pos(3.0f,3.0f,3.0f), cam_focal_point(3.0f,3.0f,2.0f), cam_y_dir(-1.0f,0.0f,0.0f);
|
||||
@ -81,7 +81,7 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
|
||||
|
||||
/// Create a cloud widget.
|
||||
Mat bunny_cloud = cvcloud_load();
|
||||
viz::CloudWidget cloud_widget(bunny_cloud, viz::Color::green());
|
||||
viz::WCloud cloud_widget(bunny_cloud, viz::Color::green());
|
||||
|
||||
/// Pose of the widget in camera frame
|
||||
Affine3f cloud_pose = Affine3f().translate(Vec3f(0.0f,0.0f,3.0f));
|
||||
@ -91,8 +91,8 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
|
||||
/// Visualize camera frame
|
||||
if (!camera_pov)
|
||||
{
|
||||
viz::CameraPositionWidget cpw(0.5); // Coordinate axes
|
||||
viz::CameraPositionWidget cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
|
||||
viz::WCameraPosition cpw(0.5); // Coordinate axes
|
||||
viz::WCameraPosition cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
|
||||
myWindow.showWidget("CPW", cpw, cam_pose);
|
||||
myWindow.showWidget("CPW_FRUSTUM", cpw_frustum, cam_pose);
|
||||
}
|
||||
@ -147,7 +147,7 @@ Here is the general structure of the program:
|
||||
|
||||
/// Create a cloud widget.
|
||||
Mat bunny_cloud = cvcloud_load();
|
||||
viz::CloudWidget cloud_widget(bunny_cloud, viz::Color::green());
|
||||
viz::WCloud cloud_widget(bunny_cloud, viz::Color::green());
|
||||
|
||||
* Given the pose in camera coordinate system, estimate the global pose.
|
||||
|
||||
@ -165,8 +165,8 @@ Here is the general structure of the program:
|
||||
/// Visualize camera frame
|
||||
if (!camera_pov)
|
||||
{
|
||||
viz::CameraPositionWidget cpw(0.5); // Coordinate axes
|
||||
viz::CameraPositionWidget cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
|
||||
viz::WCameraPosition cpw(0.5); // Coordinate axes
|
||||
viz::WCameraPosition cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
|
||||
myWindow.showWidget("CPW", cpw, cam_pose);
|
||||
myWindow.showWidget("CPW_FRUSTUM", cpw_frustum, cam_pose);
|
||||
}
|
||||
|
@ -37,16 +37,16 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
|
||||
viz::Viz3d myWindow("Coordinate Frame");
|
||||
|
||||
/// Add coordinate axes
|
||||
myWindow.showWidget("Coordinate Widget", viz::CoordinateSystemWidget());
|
||||
myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());
|
||||
|
||||
/// Add line to represent (1,1,1) axis
|
||||
viz::LineWidget axis(Point3f(-1.0f,-1.0f,-1.0f), Point3f(1.0f,1.0f,1.0f));
|
||||
axis.setRenderingProperty(viz::VIZ_LINE_WIDTH, 4.0);
|
||||
viz::WLine axis(Point3f(-1.0f,-1.0f,-1.0f), Point3f(1.0f,1.0f,1.0f));
|
||||
axis.setRenderingProperty(viz::LINE_WIDTH, 4.0);
|
||||
myWindow.showWidget("Line Widget", axis);
|
||||
|
||||
/// Construct a cube widget
|
||||
viz::CubeWidget cube_widget(Point3f(0.5,0.5,0.0), Point3f(0.0,0.0,-0.5), true, viz::Color::blue());
|
||||
cube_widget.setRenderingProperty(viz::VIZ_LINE_WIDTH, 4.0);
|
||||
viz::WCube cube_widget(Point3f(0.5,0.5,0.0), Point3f(0.0,0.0,-0.5), true, viz::Color::blue());
|
||||
cube_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
|
||||
|
||||
/// Display widget (update if already displayed)
|
||||
myWindow.showWidget("Cube Widget", cube_widget);
|
||||
@ -97,15 +97,15 @@ Here is the general structure of the program:
|
||||
.. code-block:: cpp
|
||||
|
||||
/// Add coordinate axes
|
||||
myWindow.showWidget("Coordinate Widget", viz::CoordinateSystemWidget());
|
||||
myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());
|
||||
|
||||
* Display a line representing the axis (1,1,1).
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
/// Add line to represent (1,1,1) axis
|
||||
viz::LineWidget axis(Point3f(-1.0f,-1.0f,-1.0f), Point3f(1.0f,1.0f,1.0f));
|
||||
axis.setRenderingProperty(viz::VIZ_LINE_WIDTH, 4.0);
|
||||
viz::WLine axis(Point3f(-1.0f,-1.0f,-1.0f), Point3f(1.0f,1.0f,1.0f));
|
||||
axis.setRenderingProperty(viz::LINE_WIDTH, 4.0);
|
||||
myWindow.showWidget("Line Widget", axis);
|
||||
|
||||
* Construct a cube.
|
||||
@ -113,8 +113,8 @@ Here is the general structure of the program:
|
||||
.. code-block:: cpp
|
||||
|
||||
/// Construct a cube widget
|
||||
viz::CubeWidget cube_widget(Point3f(0.5,0.5,0.0), Point3f(0.0,0.0,-0.5), true, viz::Color::blue());
|
||||
cube_widget.setRenderingProperty(viz::VIZ_LINE_WIDTH, 4.0);
|
||||
viz::WCube cube_widget(Point3f(0.5,0.5,0.0), Point3f(0.0,0.0,-0.5), true, viz::Color::blue());
|
||||
cube_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
|
||||
myWindow.showWidget("Cube Widget", cube_widget);
|
||||
|
||||
* Create rotation matrix from rodrigues vector
|
||||
|
@ -14,7 +14,7 @@ and modify the widget without re-adding the widget.
|
||||
|
||||
...
|
||||
/// Create a cloud widget
|
||||
viz::CloudWidget cw(cloud, viz::Color::red());
|
||||
viz::WCloud cw(cloud, viz::Color::red());
|
||||
/// Display it in a window
|
||||
myWindow.showWidget("CloudWidget1", cw);
|
||||
/// Modify it, and it will be modified in the window.
|
||||
@ -118,9 +118,9 @@ Casts a widget to another.
|
||||
.. code-block:: cpp
|
||||
|
||||
// Create a sphere widget
|
||||
viz::SphereWidget sw(Point3f(0.0f,0.0f,0.0f), 0.5f);
|
||||
viz::WSphere sw(Point3f(0.0f,0.0f,0.0f), 0.5f);
|
||||
// Cast sphere widget to cloud widget
|
||||
viz::CloudWidget cw = sw.cast<viz::CloudWidget>();
|
||||
viz::WCloud cw = sw.cast<viz::WCloud>();
|
||||
|
||||
.. note:: 3D Widgets can only be cast to 3D Widgets. 2D Widgets can only be cast to 2D Widgets.
|
||||
|
||||
@ -231,100 +231,100 @@ Sets the color of the widget.
|
||||
|
||||
:param color: color of type :ocv:class:`Color`
|
||||
|
||||
viz::LineWidget
|
||||
---------------
|
||||
.. ocv:class:: LineWidget
|
||||
viz::WLine
|
||||
----------
|
||||
.. ocv:class:: WLine
|
||||
|
||||
This 3D Widget defines a finite line. ::
|
||||
|
||||
class CV_EXPORTS LineWidget : public Widget3D
|
||||
class CV_EXPORTS WLine : public Widget3D
|
||||
{
|
||||
public:
|
||||
LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white());
|
||||
WLine(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
viz::LineWidget::LineWidget
|
||||
---------------------------
|
||||
Constructs a LineWidget.
|
||||
viz::WLine::WLine
|
||||
-----------------
|
||||
Constructs a WLine.
|
||||
|
||||
.. ocv:function:: LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white())
|
||||
.. ocv:function:: WLine(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white())
|
||||
|
||||
:param pt1: Start point of the line.
|
||||
:param pt2: End point of the line.
|
||||
:param color: :ocv:class:`Color` of the line.
|
||||
|
||||
viz::PlaneWidget
|
||||
----------------
|
||||
.. ocv:class:: PlaneWidget
|
||||
viz::WPlane
|
||||
-----------
|
||||
.. ocv:class:: WPlane
|
||||
|
||||
This 3D Widget defines a finite plane. ::
|
||||
|
||||
class CV_EXPORTS PlaneWidget : public Widget3D
|
||||
class CV_EXPORTS WPlane : public Widget3D
|
||||
{
|
||||
public:
|
||||
PlaneWidget(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white());
|
||||
PlaneWidget(const Vec4f& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
|
||||
WPlane(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white());
|
||||
WPlane(const Vec4f& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
|
||||
private:
|
||||
/* hidden */
|
||||
};
|
||||
|
||||
viz::PlaneWidget::PlaneWidget
|
||||
-----------------------------
|
||||
Constructs a PlaneWidget.
|
||||
viz::WPlane::WPlane
|
||||
-------------------
|
||||
Constructs a WPlane.
|
||||
|
||||
.. ocv:function:: PlaneWidget(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white())
|
||||
.. ocv:function:: WPlane(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 size: Size 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:: WPlane(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 pt: Position of the plane.
|
||||
:param size: Size of the plane.
|
||||
:param color: :ocv:class:`Color` of the plane.
|
||||
|
||||
viz::SphereWidget
|
||||
-----------------
|
||||
.. ocv:class:: SphereWidget
|
||||
viz::WSphere
|
||||
------------
|
||||
.. ocv:class:: WSphere
|
||||
|
||||
This 3D Widget defines a sphere. ::
|
||||
|
||||
class CV_EXPORTS SphereWidget : public Widget3D
|
||||
class CV_EXPORTS WSphere : public Widget3D
|
||||
{
|
||||
public:
|
||||
SphereWidget(const cv::Point3f ¢er, float radius, int sphere_resolution = 10, const Color &color = Color::white())
|
||||
WSphere(const cv::Point3f ¢er, float radius, int sphere_resolution = 10, const Color &color = Color::white())
|
||||
};
|
||||
|
||||
viz::SphereWidget::SphereWidget
|
||||
-------------------------------
|
||||
Constructs a SphereWidget.
|
||||
viz::WSphere::WSphere
|
||||
---------------------
|
||||
Constructs a WSphere.
|
||||
|
||||
.. ocv:function:: SphereWidget(const cv::Point3f ¢er, float radius, int sphere_resolution = 10, const Color &color = Color::white())
|
||||
.. ocv:function:: WSphere(const cv::Point3f ¢er, float radius, int sphere_resolution = 10, const Color &color = Color::white())
|
||||
|
||||
:param center: Center of the sphere.
|
||||
:param radius: Radius of the sphere.
|
||||
:param sphere_resolution: Resolution of the sphere.
|
||||
:param color: :ocv:class:`Color` of the sphere.
|
||||
|
||||
viz::ArrowWidget
|
||||
viz::WArrow
|
||||
----------------
|
||||
.. ocv:class:: ArrowWidget
|
||||
.. ocv:class:: WArrow
|
||||
|
||||
This 3D Widget defines an arrow. ::
|
||||
|
||||
class CV_EXPORTS ArrowWidget : public Widget3D
|
||||
class CV_EXPORTS WArrow : public Widget3D
|
||||
{
|
||||
public:
|
||||
ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white());
|
||||
WArrow(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
viz::ArrowWidget::ArrowWidget
|
||||
viz::WArrow::WArrow
|
||||
-----------------------------
|
||||
Constructs an ArrowWidget.
|
||||
Constructs an WArrow.
|
||||
|
||||
.. ocv:function:: ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white())
|
||||
.. ocv:function:: WArrow(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white())
|
||||
|
||||
:param pt1: Start point of the arrow.
|
||||
:param pt2: End point of the arrow.
|
||||
@ -333,46 +333,46 @@ Constructs an ArrowWidget.
|
||||
|
||||
Arrow head is located at the end point of the arrow.
|
||||
|
||||
viz::CircleWidget
|
||||
viz::WCircle
|
||||
-----------------
|
||||
.. ocv:class:: CircleWidget
|
||||
.. ocv:class:: WCircle
|
||||
|
||||
This 3D Widget defines a circle. ::
|
||||
|
||||
class CV_EXPORTS CircleWidget : public Widget3D
|
||||
class CV_EXPORTS WCircle : public Widget3D
|
||||
{
|
||||
public:
|
||||
CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white());
|
||||
WCircle(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
viz::CircleWidget::CircleWidget
|
||||
viz::WCircle::WCircle
|
||||
-------------------------------
|
||||
Constructs a CircleWidget.
|
||||
Constructs a WCircle.
|
||||
|
||||
.. ocv:function:: CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white())
|
||||
.. ocv:function:: WCircle(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white())
|
||||
|
||||
:param pt: Center of the circle.
|
||||
:param radius: Radius of the circle.
|
||||
:param thickness: Thickness of the circle.
|
||||
:param color: :ocv:class:`Color` of the circle.
|
||||
|
||||
viz::CylinderWidget
|
||||
-------------------
|
||||
.. ocv:class:: CylinderWidget
|
||||
viz::WCylinder
|
||||
--------------
|
||||
.. ocv:class:: WCylinder
|
||||
|
||||
This 3D Widget defines a cylinder. ::
|
||||
|
||||
class CV_EXPORTS CylinderWidget : public Widget3D
|
||||
class CV_EXPORTS WCylinder : public Widget3D
|
||||
{
|
||||
public:
|
||||
CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white());
|
||||
WCylinder(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
viz::CylinderWidget::CylinderWidget
|
||||
viz::WCylinder::WCylinder
|
||||
-----------------------------------
|
||||
Constructs a CylinderWidget.
|
||||
Constructs a WCylinder.
|
||||
|
||||
.. ocv:function:: CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white())
|
||||
.. ocv:function:: WCylinder(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white())
|
||||
|
||||
:param pt_on_axis: A point on the axis of the cylinder.
|
||||
:param axis_direction: Direction of the axis of the cylinder.
|
||||
@ -380,23 +380,23 @@ Constructs a CylinderWidget.
|
||||
:param numsides: Resolution of the cylinder.
|
||||
:param color: :ocv:class:`Color` of the cylinder.
|
||||
|
||||
viz::CubeWidget
|
||||
---------------
|
||||
.. ocv:class:: CubeWidget
|
||||
viz::WCube
|
||||
----------
|
||||
.. ocv:class:: WCube
|
||||
|
||||
This 3D Widget defines a cube. ::
|
||||
|
||||
class CV_EXPORTS CubeWidget : public Widget3D
|
||||
class CV_EXPORTS WCube : public Widget3D
|
||||
{
|
||||
public:
|
||||
CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white());
|
||||
WCube(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
viz::CubeWidget::CubeWidget
|
||||
viz::WCube::WCube
|
||||
---------------------------
|
||||
Constructs a CudeWidget.
|
||||
Constructs a WCube.
|
||||
|
||||
.. ocv:function:: CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white())
|
||||
.. ocv:function:: WCube(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white())
|
||||
|
||||
:param pt_min: Specifies minimum point of the bounding box.
|
||||
:param pt_max: Specifies maximum point of the bounding box.
|
||||
@ -407,104 +407,104 @@ Constructs a CudeWidget.
|
||||
:alt: Cube Widget
|
||||
:align: center
|
||||
|
||||
viz::CoordinateSystemWidget
|
||||
---------------------------
|
||||
.. ocv:class:: CoordinateSystemWidget
|
||||
viz::WCoordinateSystem
|
||||
----------------------
|
||||
.. ocv:class:: WCoordinateSystem
|
||||
|
||||
This 3D Widget represents a coordinate system. ::
|
||||
|
||||
class CV_EXPORTS CoordinateSystemWidget : public Widget3D
|
||||
class CV_EXPORTS WCoordinateSystem : public Widget3D
|
||||
{
|
||||
public:
|
||||
CoordinateSystemWidget(double scale = 1.0);
|
||||
WCoordinateSystem(double scale = 1.0);
|
||||
};
|
||||
|
||||
viz::CoordinateSystemWidget::CoordinateSystemWidget
|
||||
viz::WCoordinateSystem::WCoordinateSystem
|
||||
---------------------------------------------------
|
||||
Constructs a CoordinateSystemWidget.
|
||||
Constructs a WCoordinateSystem.
|
||||
|
||||
.. ocv:function:: CoordinateSystemWidget(double scale = 1.0)
|
||||
.. ocv:function:: WCoordinateSystem(double scale = 1.0)
|
||||
|
||||
:param scale: Determines the size of the axes.
|
||||
|
||||
viz::PolyLineWidget
|
||||
-------------------
|
||||
.. ocv:class:: PolyLineWidget
|
||||
viz::WPolyLine
|
||||
--------------
|
||||
.. ocv:class:: WPolyLine
|
||||
|
||||
This 3D Widget defines a poly line. ::
|
||||
|
||||
class CV_EXPORTS PolyLineWidget : public Widget3D
|
||||
class CV_EXPORTS WPolyLine : public Widget3D
|
||||
{
|
||||
public:
|
||||
PolyLineWidget(InputArray points, const Color &color = Color::white());
|
||||
WPolyLine(InputArray points, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
/* hidden */
|
||||
};
|
||||
|
||||
viz::PolyLineWidget::PolyLineWidget
|
||||
viz::WPolyLine::WPolyLine
|
||||
-----------------------------------
|
||||
Constructs a PolyLineWidget.
|
||||
Constructs a WPolyLine.
|
||||
|
||||
.. ocv:function:: PolyLineWidget(InputArray points, const Color &color = Color::white())
|
||||
.. ocv:function:: WPolyLine(InputArray points, const Color &color = Color::white())
|
||||
|
||||
:param points: Point set.
|
||||
:param color: :ocv:class:`Color` of the poly line.
|
||||
|
||||
viz::GridWidget
|
||||
---------------
|
||||
.. ocv:class:: GridWidget
|
||||
viz::WGrid
|
||||
----------
|
||||
.. ocv:class:: WGrid
|
||||
|
||||
This 3D Widget defines a grid. ::
|
||||
|
||||
class CV_EXPORTS GridWidget : public Widget3D
|
||||
class CV_EXPORTS WGrid : public Widget3D
|
||||
{
|
||||
public:
|
||||
//! Creates grid at the origin
|
||||
GridWidget(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
|
||||
WGrid(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
|
||||
//! Creates grid based on the plane equation
|
||||
GridWidget(const Vec4f &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
|
||||
WGrid(const Vec4f &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
|
||||
private:
|
||||
/* hidden */
|
||||
};
|
||||
|
||||
viz::GridWidget::GridWidget
|
||||
viz::WGrid::WGrid
|
||||
---------------------------
|
||||
Constructs a GridWidget.
|
||||
Constructs a WGrid.
|
||||
|
||||
.. ocv:function:: GridWidget(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white())
|
||||
.. ocv:function:: WGrid(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white())
|
||||
|
||||
:param dimensions: Number of columns and rows, respectively.
|
||||
:param spacing: Size of each column and row, respectively.
|
||||
: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: WGrid(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 dimensions: Number of columns and rows, respectively.
|
||||
:param spacing: Size of each column and row, respectively.
|
||||
:param color: :ocv:class:`Color` of the grid.
|
||||
|
||||
viz::Text3DWidget
|
||||
-----------------
|
||||
.. ocv:class:: Text3DWidget
|
||||
viz::WText3D
|
||||
------------
|
||||
.. ocv:class:: WText3D
|
||||
|
||||
This 3D Widget represents 3D text. The text always faces the camera. ::
|
||||
|
||||
class CV_EXPORTS Text3DWidget : public Widget3D
|
||||
class CV_EXPORTS WText3D : public Widget3D
|
||||
{
|
||||
public:
|
||||
Text3DWidget(const String &text, const Point3f &position, double text_scale = 1.0, double face_camera = true, const Color &color = Color::white());
|
||||
WText3D(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);
|
||||
String getText() const;
|
||||
};
|
||||
|
||||
viz::Text3DWidget::Text3DWidget
|
||||
viz::WText3D::WText3D
|
||||
-------------------------------
|
||||
Constructs a Text3DWidget.
|
||||
Constructs a WText3D.
|
||||
|
||||
.. ocv:function:: Text3DWidget(const String &text, const Point3f &position, double text_scale = 1.0, double face_camera = true, const Color &color = Color::white())
|
||||
.. ocv:function:: WText3D(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 position: Position of the text.
|
||||
@ -512,126 +512,84 @@ Constructs a Text3DWidget.
|
||||
:param face_camera: If true, text always faces the camera.
|
||||
:param color: :ocv:class:`Color` of the text.
|
||||
|
||||
viz::Text3DWidget::setText
|
||||
--------------------------
|
||||
viz::WText3D::setText
|
||||
---------------------
|
||||
Sets the text content of the widget.
|
||||
|
||||
.. ocv:function:: void setText(const String &text)
|
||||
|
||||
:param text: Text content of the widget.
|
||||
|
||||
viz::Text3DWidget::getText
|
||||
--------------------------
|
||||
viz::WText3D::getText
|
||||
---------------------
|
||||
Returns the current text content of the widget.
|
||||
|
||||
.. ocv:function:: String getText() const
|
||||
|
||||
viz::TextWidget
|
||||
---------------
|
||||
.. ocv:class:: TextWidget
|
||||
viz::WText
|
||||
----------
|
||||
.. ocv:class:: WText
|
||||
|
||||
This 2D Widget represents text overlay. ::
|
||||
|
||||
class CV_EXPORTS TextWidget : public Widget2D
|
||||
class CV_EXPORTS WText : public Widget2D
|
||||
{
|
||||
public:
|
||||
TextWidget(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white());
|
||||
WText(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white());
|
||||
|
||||
void setText(const String &text);
|
||||
String getText() const;
|
||||
};
|
||||
|
||||
viz::TextWidget::TextWidget
|
||||
---------------------------
|
||||
Constructs a TextWidget.
|
||||
viz::WText::WText
|
||||
-----------------
|
||||
Constructs a WText.
|
||||
|
||||
.. ocv:function:: TextWidget(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white())
|
||||
.. ocv:function:: WText(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white())
|
||||
|
||||
:param text: Text content of the widget.
|
||||
:param pos: Position of the text.
|
||||
:param font_size: Font size.
|
||||
:param color: :ocv:class:`Color` of the text.
|
||||
|
||||
viz::TextWidget::setText
|
||||
------------------------
|
||||
viz::WText::setText
|
||||
-------------------
|
||||
Sets the text content of the widget.
|
||||
|
||||
.. ocv:function:: void setText(const String &text)
|
||||
|
||||
:param text: Text content of the widget.
|
||||
|
||||
viz::TextWidget::getText
|
||||
------------------------
|
||||
viz::WText::getText
|
||||
-------------------
|
||||
Returns the current text content of the widget.
|
||||
|
||||
.. ocv:function:: String getText() const
|
||||
|
||||
viz::ImageOverlayWidget
|
||||
-----------------------
|
||||
.. ocv:class:: ImageOverlayWidget
|
||||
viz::WImageOverlay
|
||||
------------------
|
||||
.. ocv:class:: WImageOverlay
|
||||
|
||||
This 2D Widget represents an image overlay. ::
|
||||
|
||||
class CV_EXPORTS ImageOverlayWidget : public Widget2D
|
||||
class CV_EXPORTS WImageOverlay : public Widget2D
|
||||
{
|
||||
public:
|
||||
ImageOverlayWidget(const Mat &image, const Rect &rect);
|
||||
WImageOverlay(const Mat &image, const Rect &rect);
|
||||
|
||||
void setImage(const Mat &image);
|
||||
};
|
||||
|
||||
viz::ImageOverlayWidget::ImageOverlayWidget
|
||||
-------------------------------------------
|
||||
Constructs an ImageOverlayWidget.
|
||||
viz::WImageOverlay::WImageOverlay
|
||||
---------------------------------
|
||||
Constructs an WImageOverlay.
|
||||
|
||||
.. ocv:function:: ImageOverlayWidget(const Mat &image, const Rect &rect)
|
||||
.. ocv:function:: WImageOverlay(const Mat &image, const Rect &rect)
|
||||
|
||||
:param image: BGR or Gray-Scale image.
|
||||
:param rect: Image is scaled and positioned based on rect.
|
||||
|
||||
viz::ImageOverlayWidget::setImage
|
||||
---------------------------------
|
||||
Sets the image content of the widget.
|
||||
|
||||
.. ocv:function:: void setImage(const Mat &image)
|
||||
|
||||
:param image: BGR or Gray-Scale image.
|
||||
|
||||
viz::Image3DWidget
|
||||
------------------
|
||||
.. ocv:class:: Image3DWidget
|
||||
|
||||
This 3D Widget represents an image in 3D space. ::
|
||||
|
||||
class CV_EXPORTS Image3DWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
//! Creates 3D image at the origin
|
||||
Image3DWidget(const Mat &image, const Size &size);
|
||||
//! Creates 3D image at a given position, pointing in the direction of the normal, and having the up_vector orientation
|
||||
Image3DWidget(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size);
|
||||
|
||||
void setImage(const Mat &image);
|
||||
};
|
||||
|
||||
viz::Image3DWidget::Image3DWidget
|
||||
---------------------------------
|
||||
Constructs an Image3DWidget.
|
||||
|
||||
.. ocv:function:: Image3DWidget(const Mat &image, const Size &size)
|
||||
|
||||
:param image: BGR or Gray-Scale image.
|
||||
:param size: Size of the image.
|
||||
|
||||
.. ocv:function:: Image3DWidget(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size)
|
||||
|
||||
:param position: Position of the image.
|
||||
:param normal: Normal of the plane that represents the image.
|
||||
:param up_vector: Determines orientation of the image.
|
||||
:param image: BGR or Gray-Scale image.
|
||||
:param size: Size of the image.
|
||||
|
||||
viz::Image3DWidget::setImage
|
||||
viz::WImageOverlay::setImage
|
||||
----------------------------
|
||||
Sets the image content of the widget.
|
||||
|
||||
@ -639,34 +597,76 @@ Sets the image content of the widget.
|
||||
|
||||
:param image: BGR or Gray-Scale image.
|
||||
|
||||
viz::CameraPositionWidget
|
||||
-------------------------
|
||||
.. ocv:class:: CameraPositionWidget
|
||||
viz::WImage3D
|
||||
-------------
|
||||
.. ocv:class:: WImage3D
|
||||
|
||||
This 3D Widget represents an image in 3D space. ::
|
||||
|
||||
class CV_EXPORTS WImage3D : public Widget3D
|
||||
{
|
||||
public:
|
||||
//! Creates 3D image at the origin
|
||||
WImage3D(const Mat &image, const Size &size);
|
||||
//! Creates 3D image at a given position, pointing in the direction of the normal, and having the up_vector orientation
|
||||
WImage3D(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size);
|
||||
|
||||
void setImage(const Mat &image);
|
||||
};
|
||||
|
||||
viz::WImage3D::WImage3D
|
||||
-----------------------
|
||||
Constructs an WImage3D.
|
||||
|
||||
.. ocv:function:: WImage3D(const Mat &image, const Size &size)
|
||||
|
||||
:param image: BGR or Gray-Scale image.
|
||||
:param size: Size of the image.
|
||||
|
||||
.. ocv:function:: WImage3D(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size)
|
||||
|
||||
:param position: Position of the image.
|
||||
:param normal: Normal of the plane that represents the image.
|
||||
:param up_vector: Determines orientation of the image.
|
||||
:param image: BGR or Gray-Scale image.
|
||||
:param size: Size of the image.
|
||||
|
||||
viz::WImage3D::setImage
|
||||
-----------------------
|
||||
Sets the image content of the widget.
|
||||
|
||||
.. ocv:function:: void setImage(const Mat &image)
|
||||
|
||||
:param image: BGR or Gray-Scale image.
|
||||
|
||||
viz::WCameraPosition
|
||||
--------------------
|
||||
.. ocv:class:: WCameraPosition
|
||||
|
||||
This 3D Widget represents camera position in a scene by its axes or viewing frustum. ::
|
||||
|
||||
class CV_EXPORTS CameraPositionWidget : public Widget3D
|
||||
class CV_EXPORTS WCameraPosition : public Widget3D
|
||||
{
|
||||
public:
|
||||
//! Creates camera coordinate frame (axes) at the origin
|
||||
CameraPositionWidget(double scale = 1.0);
|
||||
WCameraPosition(double scale = 1.0);
|
||||
//! Creates frustum based on the intrinsic marix K at the origin
|
||||
CameraPositionWidget(const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
|
||||
WCameraPosition(const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
|
||||
//! Creates frustum based on the field of view at the origin
|
||||
CameraPositionWidget(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
|
||||
WCameraPosition(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
|
||||
//! 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());
|
||||
WCameraPosition(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());
|
||||
WCameraPosition(const Vec2f &fov, const Mat &img, double scale = 1.0, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
viz::CameraPositionWidget::CameraPositionWidget
|
||||
-----------------------------------------------
|
||||
Constructs a CameraPositionWidget.
|
||||
viz::WCameraPosition::WCameraPosition
|
||||
-------------------------------------
|
||||
Constructs a WCameraPosition.
|
||||
|
||||
- **Display camera coordinate frame.**
|
||||
|
||||
.. ocv:function:: CameraPositionWidget(double scale = 1.0)
|
||||
.. ocv:function:: WCameraPosition(double scale = 1.0)
|
||||
|
||||
Creates camera coordinate frame at the origin.
|
||||
|
||||
@ -676,7 +676,7 @@ Constructs a CameraPositionWidget.
|
||||
|
||||
- **Display the viewing frustum.**
|
||||
|
||||
.. ocv:function:: CameraPositionWidget(const Matx33f &K, double scale = 1.0, const Color &color = Color::white())
|
||||
.. ocv:function:: WCameraPosition(const Matx33f &K, double scale = 1.0, const Color &color = Color::white())
|
||||
|
||||
:param K: Intrinsic matrix of the camera.
|
||||
:param scale: Scale of the frustum.
|
||||
@ -684,7 +684,7 @@ Constructs a CameraPositionWidget.
|
||||
|
||||
Creates viewing frustum of the camera based on its intrinsic matrix K.
|
||||
|
||||
.. ocv:function:: CameraPositionWidget(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white())
|
||||
.. ocv:function:: WCameraPosition(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.
|
||||
@ -698,7 +698,7 @@ Constructs a CameraPositionWidget.
|
||||
|
||||
- **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())
|
||||
.. ocv:function:: WCameraPosition(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.
|
||||
@ -707,7 +707,7 @@ Constructs a CameraPositionWidget.
|
||||
|
||||
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())
|
||||
.. ocv:function:: WCameraPosition(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.
|
||||
@ -720,33 +720,33 @@ Constructs a CameraPositionWidget.
|
||||
:alt: Camera viewing frustum with image
|
||||
:align: center
|
||||
|
||||
viz::TrajectoryWidget
|
||||
---------------------
|
||||
.. ocv:class:: TrajectoryWidget
|
||||
viz::WTrajectory
|
||||
----------------
|
||||
.. ocv:class:: WTrajectory
|
||||
|
||||
This 3D Widget represents a trajectory. ::
|
||||
|
||||
class CV_EXPORTS TrajectoryWidget : public Widget3D
|
||||
class CV_EXPORTS WTrajectory : public Widget3D
|
||||
{
|
||||
public:
|
||||
enum {DISPLAY_FRAMES = 1, DISPLAY_PATH = 2};
|
||||
|
||||
//! Displays trajectory of the given path either by coordinate frames or polyline
|
||||
TrajectoryWidget(const std::vector<Affine3f> &path, int display_mode = TrajectoryWidget::DISPLAY_PATH, const Color &color = Color::white(), double scale = 1.0);
|
||||
WTrajectory(const std::vector<Affine3f> &path, int display_mode = WTrajectory::DISPLAY_PATH, const Color &color = Color::white(), double scale = 1.0);
|
||||
//! Displays trajectory of the given path by frustums
|
||||
TrajectoryWidget(const std::vector<Affine3f> &path, const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
|
||||
WTrajectory(const std::vector<Affine3f> &path, const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
|
||||
//! Displays trajectory of the given path by frustums
|
||||
TrajectoryWidget(const std::vector<Affine3f> &path, const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
|
||||
WTrajectory(const std::vector<Affine3f> &path, const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
/* hidden */
|
||||
};
|
||||
|
||||
viz::TrajectoryWidget::TrajectoryWidget
|
||||
---------------------------------------
|
||||
Constructs a TrajectoryWidget.
|
||||
viz::WTrajectory::WTrajectory
|
||||
-----------------------------
|
||||
Constructs a WTrajectory.
|
||||
|
||||
.. 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:: WTrajectory(const std::vector<Affine3f> &path, int display_mode = WTrajectory::DISPLAY_PATH, const Color &color = Color::white(), double scale = 1.0)
|
||||
|
||||
:param path: List of poses on a trajectory.
|
||||
:param display_mode: Display mode. This can be DISPLAY_PATH, DISPLAY_FRAMES, DISPLAY_PATH & DISPLAY_FRAMES.
|
||||
@ -759,7 +759,7 @@ Constructs a TrajectoryWidget.
|
||||
* DISPLAY_FRAMES : Displays coordinate frames at each pose.
|
||||
* DISPLAY_PATH & DISPLAY_FRAMES : Displays both poly line and coordinate frames.
|
||||
|
||||
.. ocv:function:: TrajectoryWidget(const std::vector<Affine3f> &path, const Matx33f &K, double scale = 1.0, const Color &color = Color::white())
|
||||
.. ocv:function:: WTrajectory(const std::vector<Affine3f> &path, const Matx33f &K, double scale = 1.0, const Color &color = Color::white())
|
||||
|
||||
:param path: List of poses on a trajectory.
|
||||
:param K: Intrinsic matrix of the camera.
|
||||
@ -768,7 +768,7 @@ Constructs a TrajectoryWidget.
|
||||
|
||||
Displays frustums at each pose of the trajectory.
|
||||
|
||||
.. ocv:function:: TrajectoryWidget(const std::vector<Affine3f> &path, const Vec2f &fov, double scale = 1.0, const Color &color = Color::white())
|
||||
.. ocv:function:: WTrajectory(const std::vector<Affine3f> &path, const Vec2f &fov, double scale = 1.0, const Color &color = Color::white())
|
||||
|
||||
:param path: List of poses on a trajectory.
|
||||
:param fov: Field of view of the camera (horizontal, vertical).
|
||||
@ -777,26 +777,26 @@ Constructs a TrajectoryWidget.
|
||||
|
||||
Displays frustums at each pose of the trajectory.
|
||||
|
||||
viz::SpheresTrajectoryWidget
|
||||
----------------------------
|
||||
.. ocv:class:: SpheresTrajectoryWidget
|
||||
viz::WSpheresTrajectory
|
||||
-----------------------
|
||||
.. ocv:class:: WSpheresTrajectory
|
||||
|
||||
This 3D Widget represents a trajectory using spheres and lines, where spheres represent the positions of the camera, and lines
|
||||
represent the direction from previous position to the current. ::
|
||||
|
||||
class CV_EXPORTS SpheresTrajectoryWidget : public Widget3D
|
||||
class CV_EXPORTS WSpheresTrajectory : public Widget3D
|
||||
{
|
||||
public:
|
||||
SpheresTrajectoryWidget(const std::vector<Affine3f> &path, float line_length = 0.05f,
|
||||
WSpheresTrajectory(const std::vector<Affine3f> &path, float line_length = 0.05f,
|
||||
double init_sphere_radius = 0.021, sphere_radius = 0.007,
|
||||
Color &line_color = Color::white(), const Color &sphere_color = Color::white());
|
||||
};
|
||||
|
||||
viz::SpheresTrajectoryWidget::SpheresTrajectoryWidget
|
||||
-----------------------------------------------------
|
||||
Constructs a SpheresTrajectoryWidget.
|
||||
viz::WSpheresTrajectory::WSpheresTrajectory
|
||||
-------------------------------------------
|
||||
Constructs a WSpheresTrajectory.
|
||||
|
||||
.. 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:: WSpheresTrajectory(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())
|
||||
|
||||
:param path: List of poses on a trajectory.
|
||||
:param line_length: Length of the lines.
|
||||
@ -805,36 +805,36 @@ Constructs a SpheresTrajectoryWidget.
|
||||
:param line_color: :ocv:class:`Color` of the lines.
|
||||
:param sphere_color: :ocv:class:`Color` of the spheres.
|
||||
|
||||
viz::CloudWidget
|
||||
----------------
|
||||
.. ocv:class:: CloudWidget
|
||||
viz::WCloud
|
||||
-----------
|
||||
.. ocv:class:: WCloud
|
||||
|
||||
This 3D Widget defines a point cloud. ::
|
||||
|
||||
class CV_EXPORTS CloudWidget : public Widget3D
|
||||
class CV_EXPORTS WCloud : public Widget3D
|
||||
{
|
||||
public:
|
||||
//! Each point in cloud is mapped to a color in colors
|
||||
CloudWidget(InputArray cloud, InputArray colors);
|
||||
WCloud(InputArray cloud, InputArray colors);
|
||||
//! All points in cloud have the same color
|
||||
CloudWidget(InputArray cloud, const Color &color = Color::white());
|
||||
WCloud(InputArray cloud, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
/* hidden */
|
||||
};
|
||||
|
||||
viz::CloudWidget::CloudWidget
|
||||
-----------------------------
|
||||
Constructs a CloudWidget.
|
||||
viz::WCloud::WCloud
|
||||
-------------------
|
||||
Constructs a WCloud.
|
||||
|
||||
.. ocv:function:: CloudWidget(InputArray cloud, InputArray colors)
|
||||
.. ocv:function:: WCloud(InputArray cloud, InputArray colors)
|
||||
|
||||
: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.
|
||||
|
||||
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:: WCloud(InputArray cloud, const Color &color = Color::white())
|
||||
|
||||
:param cloud: Set of points which can be of type: ``CV_32FC3``, ``CV_32FC4``, ``CV_64FC3``, ``CV_64FC4``.
|
||||
:param color: A single :ocv:class:`Color` for the whole cloud.
|
||||
@ -843,16 +843,16 @@ Constructs a CloudWidget.
|
||||
|
||||
.. note:: In case there are four channels in the cloud, fourth channel is ignored.
|
||||
|
||||
viz::CloudCollectionWidget
|
||||
--------------------------
|
||||
.. ocv:class:: CloudCollectionWidget
|
||||
viz::WCloudCollection
|
||||
---------------------
|
||||
.. ocv:class:: WCloudCollection
|
||||
|
||||
This 3D Widget defines a collection of clouds. ::
|
||||
|
||||
class CV_EXPORTS CloudCollectionWidget : public Widget3D
|
||||
class CV_EXPORTS WCloudCollection : public Widget3D
|
||||
{
|
||||
public:
|
||||
CloudCollectionWidget();
|
||||
WCloudCollection();
|
||||
|
||||
//! Each point in cloud is mapped to a color in colors
|
||||
void addCloud(InputArray cloud, InputArray colors, const Affine3f &pose = Affine3f::Identity());
|
||||
@ -863,14 +863,14 @@ This 3D Widget defines a collection of clouds. ::
|
||||
/* hidden */
|
||||
};
|
||||
|
||||
viz::CloudCollectionWidget::CloudCollectionWidget
|
||||
-------------------------------------------------
|
||||
Constructs a CloudCollectionWidget.
|
||||
viz::WCloudCollection::WCloudCollection
|
||||
---------------------------------------
|
||||
Constructs a WCloudCollection.
|
||||
|
||||
.. ocv:function:: CloudCollectionWidget()
|
||||
.. ocv:function:: WCloudCollection()
|
||||
|
||||
viz::CloudCollectionWidget::addCloud
|
||||
------------------------------------
|
||||
viz::WCloudCollection::addCloud
|
||||
-------------------------------
|
||||
Adds a cloud to the collection.
|
||||
|
||||
.. ocv:function:: void addCloud(InputArray cloud, InputArray colors, const Affine3f &pose = Affine3f::Identity())
|
||||
@ -891,26 +891,26 @@ Adds a cloud to the collection.
|
||||
|
||||
.. note:: In case there are four channels in the cloud, fourth channel is ignored.
|
||||
|
||||
viz::CloudNormalsWidget
|
||||
-----------------------
|
||||
.. ocv:class:: CloudNormalsWidget
|
||||
viz::WCloudNormals
|
||||
------------------
|
||||
.. ocv:class:: WCloudNormals
|
||||
|
||||
This 3D Widget represents normals of a point cloud. ::
|
||||
|
||||
class CV_EXPORTS CloudNormalsWidget : public Widget3D
|
||||
class CV_EXPORTS WCloudNormals : public Widget3D
|
||||
{
|
||||
public:
|
||||
CloudNormalsWidget(InputArray cloud, InputArray normals, int level = 100, float scale = 0.02f, const Color &color = Color::white());
|
||||
WCloudNormals(InputArray cloud, InputArray normals, int level = 100, float scale = 0.02f, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
/* hidden */
|
||||
};
|
||||
|
||||
viz::CloudNormalsWidget::CloudNormalsWidget
|
||||
-------------------------------------------
|
||||
Constructs a CloudNormalsWidget.
|
||||
viz::WCloudNormals::WCloudNormals
|
||||
---------------------------------
|
||||
Constructs a WCloudNormals.
|
||||
|
||||
.. ocv:function:: CloudNormalsWidget(InputArray cloud, InputArray normals, int level = 100, float scale = 0.02f, const Color &color = Color::white())
|
||||
.. ocv:function:: WCloudNormals(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 normals: A set of normals that has to be of same type with cloud.
|
||||
@ -920,26 +920,26 @@ Constructs a CloudNormalsWidget.
|
||||
|
||||
.. note:: In case there are four channels in the cloud, fourth channel is ignored.
|
||||
|
||||
viz::MeshWidget
|
||||
---------------
|
||||
.. ocv:class:: MeshWidget
|
||||
viz::WMesh
|
||||
----------
|
||||
.. ocv:class:: WMesh
|
||||
|
||||
This 3D Widget defines a mesh. ::
|
||||
|
||||
class CV_EXPORTS MeshWidget : public Widget3D
|
||||
class CV_EXPORTS WMesh : public Widget3D
|
||||
{
|
||||
public:
|
||||
MeshWidget(const Mesh3d &mesh);
|
||||
WMesh(const Mesh3d &mesh);
|
||||
|
||||
private:
|
||||
/* hidden */
|
||||
};
|
||||
|
||||
viz::MeshWidget::MeshWidget
|
||||
---------------------------
|
||||
Constructs a MeshWidget.
|
||||
viz::WMesh::WMesh
|
||||
-----------------
|
||||
Constructs a WMesh.
|
||||
|
||||
.. ocv:function:: MeshWidget(const Mesh3d &mesh)
|
||||
.. ocv:function:: WMesh(const Mesh3d &mesh)
|
||||
|
||||
:param mesh: :ocv:class:`Mesh3d` object that will be displayed.
|
||||
|
||||
|
@ -134,173 +134,173 @@ namespace cv
|
||||
void setColor(const Color &color);
|
||||
};
|
||||
|
||||
class CV_EXPORTS LineWidget : public Widget3D
|
||||
class CV_EXPORTS WLine : public Widget3D
|
||||
{
|
||||
public:
|
||||
LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white());
|
||||
WLine(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS PlaneWidget : public Widget3D
|
||||
class CV_EXPORTS WPlane : public Widget3D
|
||||
{
|
||||
public:
|
||||
PlaneWidget(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white());
|
||||
PlaneWidget(const Vec4f& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
|
||||
WPlane(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white());
|
||||
WPlane(const Vec4f& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
|
||||
private:
|
||||
struct SetSizeImpl;
|
||||
};
|
||||
|
||||
class CV_EXPORTS SphereWidget : public Widget3D
|
||||
class CV_EXPORTS WSphere : public Widget3D
|
||||
{
|
||||
public:
|
||||
SphereWidget(const cv::Point3f ¢er, float radius, int sphere_resolution = 10, const Color &color = Color::white());
|
||||
WSphere(const cv::Point3f ¢er, float radius, int sphere_resolution = 10, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS ArrowWidget : public Widget3D
|
||||
class CV_EXPORTS WArrow : public Widget3D
|
||||
{
|
||||
public:
|
||||
ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white());
|
||||
WArrow(const Point3f& pt1, const Point3f& pt2, double thickness = 0.03, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CircleWidget : public Widget3D
|
||||
class CV_EXPORTS WCircle : public Widget3D
|
||||
{
|
||||
public:
|
||||
CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white());
|
||||
WCircle(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CylinderWidget : public Widget3D
|
||||
class CV_EXPORTS WCylinder : public Widget3D
|
||||
{
|
||||
public:
|
||||
CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white());
|
||||
WCylinder(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CubeWidget : public Widget3D
|
||||
class CV_EXPORTS WCube : public Widget3D
|
||||
{
|
||||
public:
|
||||
CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white());
|
||||
WCube(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CoordinateSystemWidget : public Widget3D
|
||||
class CV_EXPORTS WCoordinateSystem : public Widget3D
|
||||
{
|
||||
public:
|
||||
CoordinateSystemWidget(double scale = 1.0);
|
||||
WCoordinateSystem(double scale = 1.0);
|
||||
};
|
||||
|
||||
class CV_EXPORTS PolyLineWidget : public Widget3D
|
||||
class CV_EXPORTS WPolyLine : public Widget3D
|
||||
{
|
||||
public:
|
||||
PolyLineWidget(InputArray points, const Color &color = Color::white());
|
||||
WPolyLine(InputArray points, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct CopyImpl;
|
||||
};
|
||||
|
||||
class CV_EXPORTS GridWidget : public Widget3D
|
||||
class CV_EXPORTS WGrid : public Widget3D
|
||||
{
|
||||
public:
|
||||
//! Creates grid at the origin
|
||||
GridWidget(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
|
||||
WGrid(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
|
||||
//! Creates grid based on the plane equation
|
||||
GridWidget(const Vec4f &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
|
||||
WGrid(const Vec4f &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct GridImpl;
|
||||
|
||||
};
|
||||
|
||||
class CV_EXPORTS Text3DWidget : public Widget3D
|
||||
class CV_EXPORTS WText3D : public Widget3D
|
||||
{
|
||||
public:
|
||||
Text3DWidget(const String &text, const Point3f &position, double text_scale = 1.0, bool face_camera = true, const Color &color = Color::white());
|
||||
WText3D(const String &text, const Point3f &position, double text_scale = 1.0, bool face_camera = true, const Color &color = Color::white());
|
||||
|
||||
void setText(const String &text);
|
||||
String getText() const;
|
||||
};
|
||||
|
||||
class CV_EXPORTS TextWidget : public Widget2D
|
||||
class CV_EXPORTS WText : public Widget2D
|
||||
{
|
||||
public:
|
||||
TextWidget(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white());
|
||||
WText(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white());
|
||||
|
||||
void setText(const String &text);
|
||||
String getText() const;
|
||||
};
|
||||
|
||||
class CV_EXPORTS ImageOverlayWidget : public Widget2D
|
||||
class CV_EXPORTS WImageOverlay : public Widget2D
|
||||
{
|
||||
public:
|
||||
ImageOverlayWidget(const Mat &image, const Rect &rect);
|
||||
WImageOverlay(const Mat &image, const Rect &rect);
|
||||
|
||||
void setImage(const Mat &image);
|
||||
};
|
||||
|
||||
class CV_EXPORTS Image3DWidget : public Widget3D
|
||||
class CV_EXPORTS WImage3D : public Widget3D
|
||||
{
|
||||
public:
|
||||
//! Creates 3D image at the origin
|
||||
Image3DWidget(const Mat &image, const Size &size);
|
||||
WImage3D(const Mat &image, const Size &size);
|
||||
//! Creates 3D image at a given position, pointing in the direction of the normal, and having the up_vector orientation
|
||||
Image3DWidget(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size);
|
||||
WImage3D(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size);
|
||||
|
||||
void setImage(const Mat &image);
|
||||
};
|
||||
|
||||
class CV_EXPORTS CameraPositionWidget : public Widget3D
|
||||
class CV_EXPORTS WCameraPosition : public Widget3D
|
||||
{
|
||||
public:
|
||||
//! Creates camera coordinate frame (axes) at the origin
|
||||
CameraPositionWidget(double scale = 1.0);
|
||||
WCameraPosition(double scale = 1.0);
|
||||
//! Creates frustum based on the intrinsic marix K at the origin
|
||||
CameraPositionWidget(const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
|
||||
WCameraPosition(const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
|
||||
//! Creates frustum based on the field of view at the origin
|
||||
CameraPositionWidget(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
|
||||
WCameraPosition(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
|
||||
//! 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());
|
||||
WCameraPosition(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());
|
||||
WCameraPosition(const Vec2f &fov, const Mat &img, double scale = 1.0, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct ProjectImage;
|
||||
};
|
||||
|
||||
class CV_EXPORTS TrajectoryWidget : public Widget3D
|
||||
class CV_EXPORTS WTrajectory : public Widget3D
|
||||
{
|
||||
public:
|
||||
enum {DISPLAY_FRAMES = 1, DISPLAY_PATH = 2};
|
||||
|
||||
//! Displays trajectory of the given path either by coordinate frames or polyline
|
||||
TrajectoryWidget(const std::vector<Affine3f> &path, int display_mode = TrajectoryWidget::DISPLAY_PATH, const Color &color = Color::white(), double scale = 1.0);
|
||||
WTrajectory(const std::vector<Affine3f> &path, int display_mode = WTrajectory::DISPLAY_PATH, const Color &color = Color::white(), double scale = 1.0);
|
||||
//! Displays trajectory of the given path by frustums
|
||||
TrajectoryWidget(const std::vector<Affine3f> &path, const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
|
||||
WTrajectory(const std::vector<Affine3f> &path, const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
|
||||
//! Displays trajectory of the given path by frustums
|
||||
TrajectoryWidget(const std::vector<Affine3f> &path, const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
|
||||
WTrajectory(const std::vector<Affine3f> &path, const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct ApplyPath;
|
||||
};
|
||||
|
||||
class CV_EXPORTS SpheresTrajectoryWidget : public Widget3D
|
||||
class CV_EXPORTS WSpheresTrajectory: public Widget3D
|
||||
{
|
||||
public:
|
||||
SpheresTrajectoryWidget(const std::vector<Affine3f> &path, float line_length = 0.05f, double init_sphere_radius = 0.021,
|
||||
WSpheresTrajectory(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());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CloudWidget : public Widget3D
|
||||
class CV_EXPORTS WCloud: public Widget3D
|
||||
{
|
||||
public:
|
||||
//! Each point in cloud is mapped to a color in colors
|
||||
CloudWidget(InputArray cloud, InputArray colors);
|
||||
WCloud(InputArray cloud, InputArray colors);
|
||||
//! All points in cloud have the same color
|
||||
CloudWidget(InputArray cloud, const Color &color = Color::white());
|
||||
WCloud(InputArray cloud, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct CreateCloudWidget;
|
||||
};
|
||||
|
||||
class CV_EXPORTS CloudCollectionWidget : public Widget3D
|
||||
class CV_EXPORTS WCloudCollection : public Widget3D
|
||||
{
|
||||
public:
|
||||
CloudCollectionWidget();
|
||||
WCloudCollection();
|
||||
|
||||
//! Each point in cloud is mapped to a color in colors
|
||||
void addCloud(InputArray cloud, InputArray colors, const Affine3f &pose = Affine3f::Identity());
|
||||
@ -311,19 +311,19 @@ namespace cv
|
||||
struct CreateCloudWidget;
|
||||
};
|
||||
|
||||
class CV_EXPORTS CloudNormalsWidget : public Widget3D
|
||||
class CV_EXPORTS WCloudNormals : public Widget3D
|
||||
{
|
||||
public:
|
||||
CloudNormalsWidget(InputArray cloud, InputArray normals, int level = 100, float scale = 0.02f, const Color &color = Color::white());
|
||||
WCloudNormals(InputArray cloud, InputArray normals, int level = 100, float scale = 0.02f, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct ApplyCloudNormals;
|
||||
};
|
||||
|
||||
class CV_EXPORTS MeshWidget : public Widget3D
|
||||
class CV_EXPORTS WMesh : public Widget3D
|
||||
{
|
||||
public:
|
||||
MeshWidget(const Mesh3d &mesh);
|
||||
WMesh(const Mesh3d &mesh);
|
||||
|
||||
private:
|
||||
struct CopyImpl;
|
||||
@ -331,27 +331,27 @@ namespace cv
|
||||
|
||||
template<> CV_EXPORTS Widget2D Widget::cast<Widget2D>();
|
||||
template<> CV_EXPORTS Widget3D Widget::cast<Widget3D>();
|
||||
template<> CV_EXPORTS LineWidget Widget::cast<LineWidget>();
|
||||
template<> CV_EXPORTS PlaneWidget Widget::cast<PlaneWidget>();
|
||||
template<> CV_EXPORTS SphereWidget Widget::cast<SphereWidget>();
|
||||
template<> CV_EXPORTS CylinderWidget Widget::cast<CylinderWidget>();
|
||||
template<> CV_EXPORTS ArrowWidget Widget::cast<ArrowWidget>();
|
||||
template<> CV_EXPORTS CircleWidget Widget::cast<CircleWidget>();
|
||||
template<> CV_EXPORTS CubeWidget Widget::cast<CubeWidget>();
|
||||
template<> CV_EXPORTS CoordinateSystemWidget Widget::cast<CoordinateSystemWidget>();
|
||||
template<> CV_EXPORTS PolyLineWidget Widget::cast<PolyLineWidget>();
|
||||
template<> CV_EXPORTS GridWidget Widget::cast<GridWidget>();
|
||||
template<> CV_EXPORTS Text3DWidget Widget::cast<Text3DWidget>();
|
||||
template<> CV_EXPORTS TextWidget Widget::cast<TextWidget>();
|
||||
template<> CV_EXPORTS ImageOverlayWidget Widget::cast<ImageOverlayWidget>();
|
||||
template<> CV_EXPORTS Image3DWidget Widget::cast<Image3DWidget>();
|
||||
template<> CV_EXPORTS CameraPositionWidget Widget::cast<CameraPositionWidget>();
|
||||
template<> CV_EXPORTS TrajectoryWidget Widget::cast<TrajectoryWidget>();
|
||||
template<> CV_EXPORTS SpheresTrajectoryWidget Widget::cast<SpheresTrajectoryWidget>();
|
||||
template<> CV_EXPORTS CloudWidget Widget::cast<CloudWidget>();
|
||||
template<> CV_EXPORTS CloudCollectionWidget Widget::cast<CloudCollectionWidget>();
|
||||
template<> CV_EXPORTS CloudNormalsWidget Widget::cast<CloudNormalsWidget>();
|
||||
template<> CV_EXPORTS MeshWidget Widget::cast<MeshWidget>();
|
||||
template<> CV_EXPORTS WLine Widget::cast<WLine>();
|
||||
template<> CV_EXPORTS WPlane Widget::cast<WPlane>();
|
||||
template<> CV_EXPORTS WSphere Widget::cast<WSphere>();
|
||||
template<> CV_EXPORTS WCylinder Widget::cast<WCylinder>();
|
||||
template<> CV_EXPORTS WArrow Widget::cast<WArrow>();
|
||||
template<> CV_EXPORTS WCircle Widget::cast<WCircle>();
|
||||
template<> CV_EXPORTS WCube Widget::cast<WCube>();
|
||||
template<> CV_EXPORTS WCoordinateSystem Widget::cast<WCoordinateSystem>();
|
||||
template<> CV_EXPORTS WPolyLine Widget::cast<WPolyLine>();
|
||||
template<> CV_EXPORTS WGrid Widget::cast<WGrid>();
|
||||
template<> CV_EXPORTS WText3D Widget::cast<WText3D>();
|
||||
template<> CV_EXPORTS WText Widget::cast<WText>();
|
||||
template<> CV_EXPORTS WImageOverlay Widget::cast<WImageOverlay>();
|
||||
template<> CV_EXPORTS WImage3D Widget::cast<WImage3D>();
|
||||
template<> CV_EXPORTS WCameraPosition Widget::cast<WCameraPosition>();
|
||||
template<> CV_EXPORTS WTrajectory Widget::cast<WTrajectory>();
|
||||
template<> CV_EXPORTS WSpheresTrajectory Widget::cast<WSpheresTrajectory>();
|
||||
template<> CV_EXPORTS WCloud Widget::cast<WCloud>();
|
||||
template<> CV_EXPORTS WCloudCollection Widget::cast<WCloudCollection>();
|
||||
template<> CV_EXPORTS WCloudNormals Widget::cast<WCloudNormals>();
|
||||
template<> CV_EXPORTS WMesh Widget::cast<WMesh>();
|
||||
|
||||
} /* namespace viz */
|
||||
} /* namespace cv */
|
||||
|
@ -59,7 +59,7 @@ namespace cv
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Point Cloud Widget implementation
|
||||
|
||||
struct cv::viz::CloudWidget::CreateCloudWidget
|
||||
struct cv::viz::WCloud::CreateCloudWidget
|
||||
{
|
||||
static inline vtkSmartPointer<vtkPolyData> create(const Mat &cloud, vtkIdType &nr_points)
|
||||
{
|
||||
@ -146,7 +146,7 @@ struct cv::viz::CloudWidget::CreateCloudWidget
|
||||
}
|
||||
};
|
||||
|
||||
cv::viz::CloudWidget::CloudWidget(InputArray _cloud, InputArray _colors)
|
||||
cv::viz::WCloud::WCloud(InputArray _cloud, InputArray _colors)
|
||||
{
|
||||
Mat cloud = _cloud.getMat();
|
||||
Mat colors = _colors.getMat();
|
||||
@ -201,7 +201,7 @@ cv::viz::CloudWidget::CloudWidget(InputArray _cloud, InputArray _colors)
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
cv::viz::CloudWidget::CloudWidget(InputArray _cloud, const Color &color)
|
||||
cv::viz::WCloud::WCloud(InputArray _cloud, const Color &color)
|
||||
{
|
||||
Mat cloud = _cloud.getMat();
|
||||
CV_Assert(cloud.type() == CV_32FC3 || cloud.type() == CV_64FC3 || cloud.type() == CV_32FC4 || cloud.type() == CV_64FC4);
|
||||
@ -233,16 +233,16 @@ cv::viz::CloudWidget::CloudWidget(InputArray _cloud, const Color &color)
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::CloudWidget cv::viz::Widget::cast<cv::viz::CloudWidget>()
|
||||
template<> cv::viz::WCloud cv::viz::Widget::cast<cv::viz::WCloud>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<CloudWidget&>(widget);
|
||||
return static_cast<WCloud&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Cloud Collection Widget implementation
|
||||
|
||||
struct cv::viz::CloudCollectionWidget::CreateCloudWidget
|
||||
struct cv::viz::WCloudCollection::CreateCloudWidget
|
||||
{
|
||||
static inline vtkSmartPointer<vtkPolyData> create(const Mat &cloud, vtkIdType &nr_points)
|
||||
{
|
||||
@ -376,14 +376,14 @@ struct cv::viz::CloudCollectionWidget::CreateCloudWidget
|
||||
}
|
||||
};
|
||||
|
||||
cv::viz::CloudCollectionWidget::CloudCollectionWidget()
|
||||
cv::viz::WCloudCollection::WCloudCollection()
|
||||
{
|
||||
// Just create the actor
|
||||
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
void cv::viz::CloudCollectionWidget::addCloud(InputArray _cloud, InputArray _colors, const Affine3f &pose)
|
||||
void cv::viz::WCloudCollection::addCloud(InputArray _cloud, InputArray _colors, const Affine3f &pose)
|
||||
{
|
||||
Mat cloud = _cloud.getMat();
|
||||
Mat colors = _colors.getMat();
|
||||
@ -432,7 +432,7 @@ void cv::viz::CloudCollectionWidget::addCloud(InputArray _cloud, InputArray _col
|
||||
CreateCloudWidget::createMapper(actor, transform_filter->GetOutput(), minmax);
|
||||
}
|
||||
|
||||
void cv::viz::CloudCollectionWidget::addCloud(InputArray _cloud, const Color &color, const Affine3f &pose)
|
||||
void cv::viz::WCloudCollection::addCloud(InputArray _cloud, const Color &color, const Affine3f &pose)
|
||||
{
|
||||
Mat cloud = _cloud.getMat();
|
||||
CV_Assert(cloud.type() == CV_32FC3 || cloud.type() == CV_64FC3 || cloud.type() == CV_32FC4 || cloud.type() == CV_64FC4);
|
||||
@ -471,16 +471,16 @@ void cv::viz::CloudCollectionWidget::addCloud(InputArray _cloud, const Color &co
|
||||
CreateCloudWidget::createMapper(actor, transform_filter->GetOutput(), minmax);
|
||||
}
|
||||
|
||||
template<> cv::viz::CloudCollectionWidget cv::viz::Widget::cast<cv::viz::CloudCollectionWidget>()
|
||||
template<> cv::viz::WCloudCollection cv::viz::Widget::cast<cv::viz::WCloudCollection>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<CloudCollectionWidget&>(widget);
|
||||
return static_cast<WCloudCollection&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Cloud Normals Widget implementation
|
||||
|
||||
struct cv::viz::CloudNormalsWidget::ApplyCloudNormals
|
||||
struct cv::viz::WCloudNormals::ApplyCloudNormals
|
||||
{
|
||||
template<typename _Tp>
|
||||
struct Impl
|
||||
@ -555,7 +555,7 @@ struct cv::viz::CloudNormalsWidget::ApplyCloudNormals
|
||||
}
|
||||
};
|
||||
|
||||
cv::viz::CloudNormalsWidget::CloudNormalsWidget(InputArray _cloud, InputArray _normals, int level, float scale, const Color &color)
|
||||
cv::viz::WCloudNormals::WCloudNormals(InputArray _cloud, InputArray _normals, int level, float scale, const Color &color)
|
||||
{
|
||||
Mat cloud = _cloud.getMat();
|
||||
Mat normals = _normals.getMat();
|
||||
@ -610,16 +610,16 @@ cv::viz::CloudNormalsWidget::CloudNormalsWidget(InputArray _cloud, InputArray _n
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::CloudNormalsWidget cv::viz::Widget::cast<cv::viz::CloudNormalsWidget>()
|
||||
template<> cv::viz::WCloudNormals cv::viz::Widget::cast<cv::viz::WCloudNormals>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<CloudNormalsWidget&>(widget);
|
||||
return static_cast<WCloudNormals&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Mesh Widget implementation
|
||||
|
||||
struct cv::viz::MeshWidget::CopyImpl
|
||||
struct cv::viz::WMesh::CopyImpl
|
||||
{
|
||||
template<typename _Tp>
|
||||
static Vec<_Tp, 3> * copy(const Mat &source, Vec<_Tp, 3> *output, int *look_up, const Mat &nan_mask)
|
||||
@ -648,7 +648,7 @@ struct cv::viz::MeshWidget::CopyImpl
|
||||
}
|
||||
};
|
||||
|
||||
cv::viz::MeshWidget::MeshWidget(const Mesh3d &mesh)
|
||||
cv::viz::WMesh::WMesh(const Mesh3d &mesh)
|
||||
{
|
||||
CV_Assert(mesh.cloud.rows == 1 && (mesh.cloud.type() == CV_32FC3 || mesh.cloud.type() == CV_64FC3 || mesh.cloud.type() == CV_32FC4 || mesh.cloud.type() == CV_64FC4));
|
||||
CV_Assert(mesh.colors.empty() || (mesh.colors.type() == CV_8UC3 && mesh.cloud.size() == mesh.colors.size()));
|
||||
@ -766,8 +766,8 @@ cv::viz::MeshWidget::MeshWidget(const Mesh3d &mesh)
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
template<> CV_EXPORTS cv::viz::MeshWidget cv::viz::Widget::cast<cv::viz::MeshWidget>()
|
||||
template<> CV_EXPORTS cv::viz::WMesh cv::viz::Widget::cast<cv::viz::WMesh>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<MeshWidget&>(widget);
|
||||
return static_cast<WMesh&>(widget);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace cv
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// line widget implementation
|
||||
cv::viz::LineWidget::LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color)
|
||||
cv::viz::WLine::WLine(const Point3f &pt1, const Point3f &pt2, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkLineSource> line = vtkSmartPointer<vtkLineSource>::New();
|
||||
line->SetPoint1(pt1.x, pt1.y, pt1.z);
|
||||
@ -75,16 +75,16 @@ cv::viz::LineWidget::LineWidget(const Point3f &pt1, const Point3f &pt2, const Co
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::LineWidget cv::viz::Widget::cast<cv::viz::LineWidget>()
|
||||
template<> cv::viz::WLine cv::viz::Widget::cast<cv::viz::WLine>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<LineWidget&>(widget);
|
||||
return static_cast<WLine&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// plane widget implementation
|
||||
|
||||
struct cv::viz::PlaneWidget::SetSizeImpl
|
||||
struct cv::viz::WPlane::SetSizeImpl
|
||||
{
|
||||
template<typename _Tp>
|
||||
static vtkSmartPointer<vtkTransformPolyDataFilter> setSize(const Vec<_Tp, 3> ¢er, vtkSmartPointer<vtkAlgorithmOutput> poly_data_port, double size)
|
||||
@ -104,7 +104,7 @@ struct cv::viz::PlaneWidget::SetSizeImpl
|
||||
}
|
||||
};
|
||||
|
||||
cv::viz::PlaneWidget::PlaneWidget(const Vec4f& coefs, double size, const Color &color)
|
||||
cv::viz::WPlane::WPlane(const Vec4f& coefs, double size, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkPlaneSource> plane = vtkSmartPointer<vtkPlaneSource>::New();
|
||||
plane->SetNormal(coefs[0], coefs[1], coefs[2]);
|
||||
@ -124,7 +124,7 @@ cv::viz::PlaneWidget::PlaneWidget(const Vec4f& coefs, double size, const Color &
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
cv::viz::PlaneWidget::PlaneWidget(const Vec4f& coefs, const Point3f& pt, double size, const Color &color)
|
||||
cv::viz::WPlane::WPlane(const Vec4f& coefs, const Point3f& pt, double size, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkPlaneSource> plane = vtkSmartPointer<vtkPlaneSource>::New();
|
||||
Point3f coefs3(coefs[0], coefs[1], coefs[2]);
|
||||
@ -145,16 +145,16 @@ cv::viz::PlaneWidget::PlaneWidget(const Vec4f& coefs, const Point3f& pt, double
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::PlaneWidget cv::viz::Widget::cast<cv::viz::PlaneWidget>()
|
||||
template<> cv::viz::WPlane cv::viz::Widget::cast<cv::viz::WPlane>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<PlaneWidget&>(widget);
|
||||
return static_cast<WPlane&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// sphere widget implementation
|
||||
|
||||
cv::viz::SphereWidget::SphereWidget(const Point3f ¢er, float radius, int sphere_resolution, const Color &color)
|
||||
cv::viz::WSphere::WSphere(const Point3f ¢er, float radius, int sphere_resolution, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
|
||||
sphere->SetRadius(radius);
|
||||
@ -174,16 +174,16 @@ cv::viz::SphereWidget::SphereWidget(const Point3f ¢er, float radius, int sph
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::SphereWidget cv::viz::Widget::cast<cv::viz::SphereWidget>()
|
||||
template<> cv::viz::WSphere cv::viz::Widget::cast<cv::viz::WSphere>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<SphereWidget&>(widget);
|
||||
return static_cast<WSphere&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// arrow widget implementation
|
||||
|
||||
cv::viz::ArrowWidget::ArrowWidget(const Point3f& pt1, const Point3f& pt2, double thickness, const Color &color)
|
||||
cv::viz::WArrow::WArrow(const Point3f& pt1, const Point3f& pt2, double thickness, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkArrowSource> arrowSource = vtkSmartPointer<vtkArrowSource>::New();
|
||||
arrowSource->SetShaftRadius(thickness);
|
||||
@ -247,16 +247,16 @@ cv::viz::ArrowWidget::ArrowWidget(const Point3f& pt1, const Point3f& pt2, double
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::ArrowWidget cv::viz::Widget::cast<cv::viz::ArrowWidget>()
|
||||
template<> cv::viz::WArrow cv::viz::Widget::cast<cv::viz::WArrow>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<ArrowWidget&>(widget);
|
||||
return static_cast<WArrow&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// circle widget implementation
|
||||
|
||||
cv::viz::CircleWidget::CircleWidget(const Point3f& pt, double radius, double thickness, const Color& color)
|
||||
cv::viz::WCircle::WCircle(const Point3f& pt, double radius, double thickness, const Color& color)
|
||||
{
|
||||
vtkSmartPointer<vtkDiskSource> disk = vtkSmartPointer<vtkDiskSource>::New();
|
||||
// Maybe the resolution should be lower e.g. 50 or 25
|
||||
@ -283,16 +283,16 @@ cv::viz::CircleWidget::CircleWidget(const Point3f& pt, double radius, double thi
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::CircleWidget cv::viz::Widget::cast<cv::viz::CircleWidget>()
|
||||
template<> cv::viz::WCircle cv::viz::Widget::cast<cv::viz::WCircle>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<CircleWidget&>(widget);
|
||||
return static_cast<WCircle&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// cylinder widget implementation
|
||||
|
||||
cv::viz::CylinderWidget::CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides, const Color &color)
|
||||
cv::viz::WCylinder::WCylinder(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides, const Color &color)
|
||||
{
|
||||
const Point3f pt2 = pt_on_axis + axis_direction;
|
||||
vtkSmartPointer<vtkLineSource> line = vtkSmartPointer<vtkLineSource>::New();
|
||||
@ -314,16 +314,16 @@ cv::viz::CylinderWidget::CylinderWidget(const Point3f& pt_on_axis, const Point3f
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::CylinderWidget cv::viz::Widget::cast<cv::viz::CylinderWidget>()
|
||||
template<> cv::viz::WCylinder cv::viz::Widget::cast<cv::viz::WCylinder>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<CylinderWidget&>(widget);
|
||||
return static_cast<WCylinder&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// cylinder widget implementation
|
||||
|
||||
cv::viz::CubeWidget::CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame, const Color &color)
|
||||
cv::viz::WCube::WCube(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
|
||||
if (wire_frame)
|
||||
@ -346,16 +346,16 @@ cv::viz::CubeWidget::CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bo
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::CubeWidget cv::viz::Widget::cast<cv::viz::CubeWidget>()
|
||||
template<> cv::viz::WCube cv::viz::Widget::cast<cv::viz::WCube>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<CubeWidget&>(widget);
|
||||
return static_cast<WCube&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// coordinate system widget implementation
|
||||
|
||||
cv::viz::CoordinateSystemWidget::CoordinateSystemWidget(double scale)
|
||||
cv::viz::WCoordinateSystem::WCoordinateSystem(double scale)
|
||||
{
|
||||
vtkSmartPointer<vtkAxes> axes = vtkSmartPointer<vtkAxes>::New();
|
||||
axes->SetOrigin(0, 0, 0);
|
||||
@ -397,16 +397,16 @@ cv::viz::CoordinateSystemWidget::CoordinateSystemWidget(double scale)
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
template<> cv::viz::CoordinateSystemWidget cv::viz::Widget::cast<cv::viz::CoordinateSystemWidget>()
|
||||
template<> cv::viz::WCoordinateSystem cv::viz::Widget::cast<cv::viz::WCoordinateSystem>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<CoordinateSystemWidget&>(widget);
|
||||
return static_cast<WCoordinateSystem&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// polyline widget implementation
|
||||
|
||||
struct cv::viz::PolyLineWidget::CopyImpl
|
||||
struct cv::viz::WPolyLine::CopyImpl
|
||||
{
|
||||
template<typename _Tp>
|
||||
static void copy(const Mat& source, Vec<_Tp, 3> *output, vtkSmartPointer<vtkPolyLine> polyLine)
|
||||
@ -426,7 +426,7 @@ struct cv::viz::PolyLineWidget::CopyImpl
|
||||
}
|
||||
};
|
||||
|
||||
cv::viz::PolyLineWidget::PolyLineWidget(InputArray _pointData, const Color &color)
|
||||
cv::viz::WPolyLine::WPolyLine(InputArray _pointData, const Color &color)
|
||||
{
|
||||
Mat pointData = _pointData.getMat();
|
||||
CV_Assert(pointData.type() == CV_32FC3 || pointData.type() == CV_32FC4 || pointData.type() == CV_64FC3 || pointData.type() == CV_64FC4);
|
||||
@ -477,16 +477,16 @@ cv::viz::PolyLineWidget::PolyLineWidget(InputArray _pointData, const Color &colo
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::PolyLineWidget cv::viz::Widget::cast<cv::viz::PolyLineWidget>()
|
||||
template<> cv::viz::WPolyLine cv::viz::Widget::cast<cv::viz::WPolyLine>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<PolyLineWidget&>(widget);
|
||||
return static_cast<WPolyLine&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// grid widget implementation
|
||||
|
||||
struct cv::viz::GridWidget::GridImpl
|
||||
struct cv::viz::WGrid::GridImpl
|
||||
{
|
||||
static vtkSmartPointer<vtkPolyData> createGrid(const Vec2i &dimensions, const Vec2d &spacing)
|
||||
{
|
||||
@ -513,7 +513,7 @@ struct cv::viz::GridWidget::GridImpl
|
||||
}
|
||||
};
|
||||
|
||||
cv::viz::GridWidget::GridWidget(const Vec2i &dimensions, const Vec2d &spacing, const Color &color)
|
||||
cv::viz::WGrid::WGrid(const Vec2i &dimensions, const Vec2d &spacing, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkPolyData> grid = GridImpl::createGrid(dimensions, spacing);
|
||||
|
||||
@ -531,7 +531,7 @@ cv::viz::GridWidget::GridWidget(const Vec2i &dimensions, const Vec2d &spacing, c
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
cv::viz::GridWidget::GridWidget(const Vec4f &coefs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color)
|
||||
cv::viz::WGrid::WGrid(const Vec4f &coefs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkPolyData> grid = GridImpl::createGrid(dimensions, spacing);
|
||||
|
||||
@ -584,16 +584,16 @@ cv::viz::GridWidget::GridWidget(const Vec4f &coefs, const Vec2i &dimensions, con
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::GridWidget cv::viz::Widget::cast<cv::viz::GridWidget>()
|
||||
template<> cv::viz::WGrid cv::viz::Widget::cast<cv::viz::WGrid>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<GridWidget&>(widget);
|
||||
return static_cast<WGrid&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// text3D widget implementation
|
||||
|
||||
cv::viz::Text3DWidget::Text3DWidget(const String &text, const Point3f &position, double text_scale, bool face_camera, const Color &color)
|
||||
cv::viz::WText3D::WText3D(const String &text, const Point3f &position, double text_scale, bool face_camera, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkVectorText> textSource = vtkSmartPointer<vtkVectorText>::New();
|
||||
textSource->SetText(text.c_str());
|
||||
@ -622,7 +622,7 @@ cv::viz::Text3DWidget::Text3DWidget(const String &text, const Point3f &position,
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
void cv::viz::Text3DWidget::setText(const String &text)
|
||||
void cv::viz::WText3D::setText(const String &text)
|
||||
{
|
||||
vtkFollower *actor = vtkFollower::SafeDownCast(WidgetAccessor::getProp(*this));
|
||||
CV_Assert("This widget does not support text." && actor);
|
||||
@ -636,7 +636,7 @@ void cv::viz::Text3DWidget::setText(const String &text)
|
||||
textSource->Update();
|
||||
}
|
||||
|
||||
cv::String cv::viz::Text3DWidget::getText() const
|
||||
cv::String cv::viz::WText3D::getText() const
|
||||
{
|
||||
vtkFollower *actor = vtkFollower::SafeDownCast(WidgetAccessor::getProp(*this));
|
||||
CV_Assert("This widget does not support text." && actor);
|
||||
@ -648,16 +648,16 @@ cv::String cv::viz::Text3DWidget::getText() const
|
||||
return textSource->GetText();
|
||||
}
|
||||
|
||||
template<> cv::viz::Text3DWidget cv::viz::Widget::cast<cv::viz::Text3DWidget>()
|
||||
template<> cv::viz::WText3D cv::viz::Widget::cast<cv::viz::WText3D>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<Text3DWidget&>(widget);
|
||||
return static_cast<WText3D&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// text widget implementation
|
||||
|
||||
cv::viz::TextWidget::TextWidget(const String &text, const Point2i &pos, int font_size, const Color &color)
|
||||
cv::viz::WText::WText(const String &text, const Point2i &pos, int font_size, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkTextActor> actor = vtkSmartPointer<vtkTextActor>::New();
|
||||
actor->SetPosition(pos.x, pos.y);
|
||||
@ -675,20 +675,20 @@ cv::viz::TextWidget::TextWidget(const String &text, const Point2i &pos, int font
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
template<> cv::viz::TextWidget cv::viz::Widget::cast<cv::viz::TextWidget>()
|
||||
template<> cv::viz::WText cv::viz::Widget::cast<cv::viz::WText>()
|
||||
{
|
||||
Widget2D widget = this->cast<Widget2D>();
|
||||
return static_cast<TextWidget&>(widget);
|
||||
return static_cast<WText&>(widget);
|
||||
}
|
||||
|
||||
void cv::viz::TextWidget::setText(const String &text)
|
||||
void cv::viz::WText::setText(const String &text)
|
||||
{
|
||||
vtkTextActor *actor = vtkTextActor::SafeDownCast(WidgetAccessor::getProp(*this));
|
||||
CV_Assert("This widget does not support text." && actor);
|
||||
actor->SetInput(text.c_str());
|
||||
}
|
||||
|
||||
cv::String cv::viz::TextWidget::getText() const
|
||||
cv::String cv::viz::WText::getText() const
|
||||
{
|
||||
vtkTextActor *actor = vtkTextActor::SafeDownCast(WidgetAccessor::getProp(*this));
|
||||
CV_Assert("This widget does not support text." && actor);
|
||||
@ -698,7 +698,7 @@ cv::String cv::viz::TextWidget::getText() const
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// image overlay widget implementation
|
||||
|
||||
cv::viz::ImageOverlayWidget::ImageOverlayWidget(const Mat &image, const Rect &rect)
|
||||
cv::viz::WImageOverlay::WImageOverlay(const Mat &image, const Rect &rect)
|
||||
{
|
||||
CV_Assert(!image.empty() && image.depth() == CV_8U);
|
||||
|
||||
@ -739,7 +739,7 @@ cv::viz::ImageOverlayWidget::ImageOverlayWidget(const Mat &image, const Rect &re
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
void cv::viz::ImageOverlayWidget::setImage(const Mat &image)
|
||||
void cv::viz::WImageOverlay::setImage(const Mat &image)
|
||||
{
|
||||
CV_Assert(!image.empty() && image.depth() == CV_8U);
|
||||
|
||||
@ -766,16 +766,16 @@ void cv::viz::ImageOverlayWidget::setImage(const Mat &image)
|
||||
mapper->SetInputConnection(flipFilter->GetOutputPort());
|
||||
}
|
||||
|
||||
template<> cv::viz::ImageOverlayWidget cv::viz::Widget::cast<cv::viz::ImageOverlayWidget>()
|
||||
template<> cv::viz::WImageOverlay cv::viz::Widget::cast<cv::viz::WImageOverlay>()
|
||||
{
|
||||
Widget2D widget = this->cast<Widget2D>();
|
||||
return static_cast<ImageOverlayWidget&>(widget);
|
||||
return static_cast<WImageOverlay&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// image 3D widget implementation
|
||||
|
||||
cv::viz::Image3DWidget::Image3DWidget(const Mat &image, const Size &size)
|
||||
cv::viz::WImage3D::WImage3D(const Mat &image, const Size &size)
|
||||
{
|
||||
CV_Assert(!image.empty() && image.depth() == CV_8U);
|
||||
|
||||
@ -827,7 +827,7 @@ cv::viz::Image3DWidget::Image3DWidget(const Mat &image, const Size &size)
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
cv::viz::Image3DWidget::Image3DWidget(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size)
|
||||
cv::viz::WImage3D::WImage3D(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size)
|
||||
{
|
||||
CV_Assert(!image.empty() && image.depth() == CV_8U);
|
||||
|
||||
@ -901,7 +901,7 @@ cv::viz::Image3DWidget::Image3DWidget(const Vec3f &position, const Vec3f &normal
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
void cv::viz::Image3DWidget::setImage(const Mat &image)
|
||||
void cv::viz::WImage3D::setImage(const Mat &image)
|
||||
{
|
||||
CV_Assert(!image.empty() && image.depth() == CV_8U);
|
||||
|
||||
@ -929,16 +929,16 @@ void cv::viz::Image3DWidget::setImage(const Mat &image)
|
||||
actor->SetTexture(texture);
|
||||
}
|
||||
|
||||
template<> cv::viz::Image3DWidget cv::viz::Widget::cast<cv::viz::Image3DWidget>()
|
||||
template<> cv::viz::WImage3D cv::viz::Widget::cast<cv::viz::WImage3D>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<Image3DWidget&>(widget);
|
||||
return static_cast<WImage3D&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// camera position widget implementation
|
||||
|
||||
struct cv::viz::CameraPositionWidget::ProjectImage
|
||||
struct cv::viz::WCameraPosition::ProjectImage
|
||||
{
|
||||
static void projectImage(float fovy, float far_end_height, const Mat &image,
|
||||
double scale, const Color &color, vtkSmartPointer<vtkActor> actor)
|
||||
@ -1032,7 +1032,7 @@ struct cv::viz::CameraPositionWidget::ProjectImage
|
||||
}
|
||||
};
|
||||
|
||||
cv::viz::CameraPositionWidget::CameraPositionWidget(double scale)
|
||||
cv::viz::WCameraPosition::WCameraPosition(double scale)
|
||||
{
|
||||
vtkSmartPointer<vtkAxes> axes = vtkSmartPointer<vtkAxes>::New();
|
||||
axes->SetOrigin(0, 0, 0);
|
||||
@ -1074,7 +1074,7 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(double scale)
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, double scale, const Color &color)
|
||||
cv::viz::WCameraPosition::WCameraPosition(const Matx33f &K, double scale, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkCamera> camera = vtkSmartPointer<vtkCamera>::New();
|
||||
float f_x = K(0,0);
|
||||
@ -1116,7 +1116,7 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, double sca
|
||||
}
|
||||
|
||||
|
||||
cv::viz::CameraPositionWidget::CameraPositionWidget(const Vec2f &fov, double scale, const Color &color)
|
||||
cv::viz::WCameraPosition::WCameraPosition(const Vec2f &fov, double scale, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkCamera> camera = vtkSmartPointer<vtkCamera>::New();
|
||||
|
||||
@ -1154,7 +1154,7 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Vec2f &fov, double sca
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, const Mat &image, double scale, const Color &color)
|
||||
cv::viz::WCameraPosition::WCameraPosition(const Matx33f &K, const Mat &image, double scale, const Color &color)
|
||||
{
|
||||
CV_Assert(!image.empty() && image.depth() == CV_8U);
|
||||
float f_y = K(1,1);
|
||||
@ -1168,7 +1168,7 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, const Mat
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
cv::viz::CameraPositionWidget::CameraPositionWidget(const Vec2f &fov, const Mat &image, double scale, const Color &color)
|
||||
cv::viz::WCameraPosition::WCameraPosition(const Vec2f &fov, const Mat &image, double scale, const Color &color)
|
||||
{
|
||||
CV_Assert(!image.empty() && image.depth() == CV_8U);
|
||||
float fovy = fov[1] * 180.0f / CV_PI;
|
||||
@ -1179,16 +1179,16 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Vec2f &fov, const Mat
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
template<> cv::viz::CameraPositionWidget cv::viz::Widget::cast<cv::viz::CameraPositionWidget>()
|
||||
template<> cv::viz::WCameraPosition cv::viz::Widget::cast<cv::viz::WCameraPosition>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<CameraPositionWidget&>(widget);
|
||||
return static_cast<WCameraPosition&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// trajectory widget implementation
|
||||
|
||||
struct cv::viz::TrajectoryWidget::ApplyPath
|
||||
struct cv::viz::WTrajectory::ApplyPath
|
||||
{
|
||||
static void applyPath(vtkSmartPointer<vtkPolyData> poly_data, vtkSmartPointer<vtkAppendPolyData> append_filter, const std::vector<Affine3f> &path)
|
||||
{
|
||||
@ -1220,12 +1220,12 @@ struct cv::viz::TrajectoryWidget::ApplyPath
|
||||
}
|
||||
};
|
||||
|
||||
cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, int display_mode, const Color &color, double scale)
|
||||
cv::viz::WTrajectory::WTrajectory(const std::vector<Affine3f> &path, int display_mode, const Color &color, double scale)
|
||||
{
|
||||
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
|
||||
|
||||
// Bitwise and with 3 in order to limit the domain to 2 bits
|
||||
if ((~display_mode & 3) ^ TrajectoryWidget::DISPLAY_PATH)
|
||||
if ((~display_mode & 3) ^ WTrajectory::DISPLAY_PATH)
|
||||
{
|
||||
// Create a poly line along the path
|
||||
vtkIdType nr_points = path.size();
|
||||
@ -1269,7 +1269,7 @@ cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, i
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((~display_mode & 3) ^ TrajectoryWidget::DISPLAY_FRAMES)
|
||||
if ((~display_mode & 3) ^ WTrajectory::DISPLAY_FRAMES)
|
||||
{
|
||||
// Create frames and transform along the path
|
||||
vtkSmartPointer<vtkAxes> axes = vtkSmartPointer<vtkAxes>::New();
|
||||
@ -1316,7 +1316,7 @@ cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, i
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, const Matx33f &K, double scale, const Color &color)
|
||||
cv::viz::WTrajectory::WTrajectory(const std::vector<Affine3f> &path, const Matx33f &K, double scale, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkCamera> camera = vtkSmartPointer<vtkCamera>::New();
|
||||
float f_x = K(0,0);
|
||||
@ -1360,7 +1360,7 @@ cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, c
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, const Vec2f &fov, double scale, const Color &color)
|
||||
cv::viz::WTrajectory::WTrajectory(const std::vector<Affine3f> &path, const Vec2f &fov, double scale, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkCamera> camera = vtkSmartPointer<vtkCamera>::New();
|
||||
|
||||
@ -1400,16 +1400,16 @@ cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, c
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::TrajectoryWidget cv::viz::Widget::cast<cv::viz::TrajectoryWidget>()
|
||||
template<> cv::viz::WTrajectory cv::viz::Widget::cast<cv::viz::WTrajectory>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<TrajectoryWidget&>(widget);
|
||||
return static_cast<WTrajectory&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// spheres trajectory widget implementation
|
||||
|
||||
cv::viz::SpheresTrajectoryWidget::SpheresTrajectoryWidget(const std::vector<Affine3f> &path, float line_length, double init_sphere_radius, double sphere_radius,
|
||||
cv::viz::WSpheresTrajectory::WSpheresTrajectory(const std::vector<Affine3f> &path, float line_length, double init_sphere_radius, double sphere_radius,
|
||||
const Color &line_color, const Color &sphere_color)
|
||||
{
|
||||
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
|
||||
@ -1490,8 +1490,8 @@ cv::viz::SpheresTrajectoryWidget::SpheresTrajectoryWidget(const std::vector<Affi
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
template<> cv::viz::SpheresTrajectoryWidget cv::viz::Widget::cast<cv::viz::SpheresTrajectoryWidget>()
|
||||
template<> cv::viz::WSpheresTrajectory cv::viz::Widget::cast<cv::viz::WSpheresTrajectory>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<SpheresTrajectoryWidget&>(widget);
|
||||
return static_cast<WSpheresTrajectory&>(widget);
|
||||
}
|
||||
|
@ -41,15 +41,9 @@
|
||||
//M*/
|
||||
#include "test_precomp.hpp"
|
||||
#include <opencv2/viz.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/calib3d.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include <opencv2/viz.hpp>
|
||||
using namespace cv;
|
||||
|
||||
cv::Mat cvcloud_load()
|
||||
@ -68,226 +62,121 @@ cv::Mat cvcloud_load()
|
||||
return cloud;
|
||||
}
|
||||
|
||||
bool constant_cam = true;
|
||||
cv::viz::Widget cam_1, cam_coordinates;
|
||||
|
||||
void keyboard_callback(const viz::KeyboardEvent & event, void * cookie)
|
||||
{
|
||||
if (event.keyDown())
|
||||
{
|
||||
if (event.getKeySym() == "space")
|
||||
{
|
||||
viz::Viz3d &viz = *((viz::Viz3d *) cookie);
|
||||
constant_cam = !constant_cam;
|
||||
if (constant_cam)
|
||||
{
|
||||
viz.showWidget("cam_1", cam_1);
|
||||
viz.showWidget("cam_coordinate", cam_coordinates);
|
||||
viz.showWidget("cam_text", viz::WText("Global View", Point2i(5,5), 28));
|
||||
viz.resetCamera();
|
||||
}
|
||||
else
|
||||
{
|
||||
viz.showWidget("cam_text", viz::WText("Cam View", Point2i(5,5), 28));
|
||||
viz.removeWidget("cam_1");
|
||||
viz.removeWidget("cam_coordinate");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Viz_viz3d, accuracy)
|
||||
{
|
||||
cv::Mat cloud = cvcloud_load();
|
||||
cv::Mat colors(cloud.size(), CV_8UC3, cv::Scalar(0, 255, 0));
|
||||
cv::Mat normals(cloud.size(), cloud.type(), cv::Scalar(0, 10, 0));
|
||||
//cv::viz::Mesh3d::Ptr mesh = cv::viz::Mesh3d::mesh_load("/Users/nerei/horse.ply");
|
||||
|
||||
const Vec4d data[] = { Vec4d(0.0, 0.0, 0.0, 0.0), Vec4d(1.0, 1.0, 1.0, 1.0), cv::Vec4d(0.0, 2.0, 0.0, 0.0), cv::Vec4d(3.0, 4.0, 1.0, 1.0) };
|
||||
cv::Mat points(1, sizeof(data)/sizeof(data[0]), CV_64FC4, (void*)data);
|
||||
points = points.reshape(4, 2);
|
||||
|
||||
cv::viz::Viz3d viz("abc");
|
||||
viz.setBackgroundColor();
|
||||
|
||||
Vec3f angle = Vec3f::all(0);
|
||||
Vec3f pos = Vec3f::all(0);
|
||||
|
||||
//viz.addPolygonMesh(*mesh, "pq");
|
||||
cv::viz::Mesh3d bunny_mesh = cv::viz::Mesh3d::loadMesh("bunny.ply");
|
||||
cv::viz::WMesh bunny_widget(bunny_mesh);
|
||||
bunny_widget.setColor(cv::viz::Color::cyan());
|
||||
|
||||
viz::Color color = viz::Color::black();
|
||||
cam_1 = cv::viz::WCameraPosition(cv::Vec2f(0.6, 0.4), 0.2, cv::viz::Color::green());
|
||||
cam_coordinates = cv::viz::WCameraPosition(0.2);
|
||||
|
||||
viz::LineWidget lw(Point3f(0, 0, 0), Point3f(4.f, 4.f,4.f), viz::Color::green());
|
||||
viz::PlaneWidget pw(Vec4f(0.0,1.0,2.0,3.0));
|
||||
viz::PlaneWidget pw2(Vec4f(0.0,1.0,2.0,3.0), 2.0, viz::Color::red());
|
||||
viz::PlaneWidget pw3(Vec4f(0.0,1.0,2.0,3.0), 3.0, viz::Color::blue());
|
||||
viz::SphereWidget sw(Point3f(0, 0, 0), 0.2);
|
||||
viz::ArrowWidget aw(Point3f(0, 0, 0), Point3f(1, 1, 1), 0.01, viz::Color::red());
|
||||
viz::CircleWidget cw(Point3f(0, 0, 0), 0.5, 0.01, viz::Color::green());
|
||||
viz::CylinderWidget cyw(Point3f(0, 0, 0), Point3f(-1, -1, -1), 0.5, 30, viz::Color::green());
|
||||
viz::CubeWidget cuw(Point3f(-2, -2, -2), Point3f(-1, -1, -1));
|
||||
viz::CoordinateSystemWidget csw;
|
||||
viz::TextWidget tw("TEST", Point(100, 100), 20);
|
||||
viz::CloudWidget pcw(cloud, colors);
|
||||
// pcw.setRenderingProperty(VIZ_LINE_WIDTH));
|
||||
viz::CloudWidget pcw2(cloud, viz::Color::magenta());
|
||||
|
||||
// viz.showWidget("line", lw);
|
||||
viz.showWidget("plane", pw);
|
||||
viz.showWidget("plane2", pw2);
|
||||
viz.showWidget("plane3", pw3);
|
||||
// viz.showWidget("sphere", sw);
|
||||
// viz.showWidget("arrow", aw);
|
||||
// viz.showWidget("circle", cw);
|
||||
// viz.showWidget("cylinder", cyw);
|
||||
// viz.showWidget("cube", cuw);
|
||||
viz.showWidget("coordinateSystem", csw);
|
||||
// viz.showWidget("coordinateSystem2", viz::CoordinateSystemWidget(2.0), Affine3f().translate(Vec3f(2, 0, 0)));
|
||||
// viz.showWidget("text",tw);
|
||||
// viz.showWidget("pcw",pcw);
|
||||
// viz.showWidget("pcw2",pcw2);
|
||||
|
||||
// viz::LineWidget lw2 = lw;
|
||||
// v.showPointCloud("cld",cloud, colors);
|
||||
viz.showWidget("bunny", bunny_widget);
|
||||
viz.showWidget("cam_1", cam_1, viz::makeCameraPose(Point3f(1.0,0.0,0.0), Point3f(0.0,0.0,0.0), Point3f(0.0,1.0,0.0)));
|
||||
viz.showWidget("cam_coordinate", cam_coordinates, viz::makeCameraPose(Point3f(1.0,0.0,0.0), Point3f(0.0,0.0,0.0), Point3f(0.0,1.0,0.0)));
|
||||
|
||||
// v.addPointCloudNormals(cloud, normals, 100, 0.02, "n");
|
||||
//viz::CloudNormalsWidget cnw(cloud, normals);
|
||||
//v.showWidget("n", cnw);
|
||||
std::vector<Affine3f> cam_path;
|
||||
|
||||
|
||||
// lw = v.getWidget("n").cast<viz::LineWidget>();
|
||||
// pw = v.getWidget("n").cast<viz::PlaneWidget>();
|
||||
|
||||
|
||||
viz::PolyLineWidget plw(points, viz::Color::green());
|
||||
// viz.showWidget("polyline", plw);
|
||||
// lw = v.getWidget("polyline").cast<viz::LineWidget>();
|
||||
|
||||
viz::Mesh3d mesh = cv::viz::Mesh3d::loadMesh("/Users/nerei/horse.ply");
|
||||
|
||||
// viz::MeshWidget mw(mesh);
|
||||
// viz.showWidget("mesh", mw);
|
||||
|
||||
Mat img = imread("opencv.png");
|
||||
// resize(img, img, Size(50,50));
|
||||
// viz.showWidget("img", viz::ImageOverlayWidget(img, Point2i(50,50)));
|
||||
|
||||
Matx33f K(657, 0, 320,
|
||||
0, 657, 240,
|
||||
0, 0, 1);
|
||||
|
||||
//viz::CameraPositionWidget cpw(Vec3f(0.5, 0.5, 3.0), Vec3f(0.0,0.0,0.0), Vec3f(0.0,-1.0,0.0), 0.5);
|
||||
viz::CameraPositionWidget cpw2(0.5);
|
||||
viz::CameraPositionWidget frustum(K, 2.0, viz::Color::green());
|
||||
// viz::CameraPositionWidget frustum2(K, 4.0, viz::Color::red());
|
||||
viz::CameraPositionWidget frustum2(K, 4.0, viz::Color::red());
|
||||
viz::CameraPositionWidget frustum3(Vec2f(CV_PI, CV_PI/2), 4.0);
|
||||
viz::Text3DWidget t3w1("Camera1", Point3f(0.4, 0.6, 3.0), 0.1);
|
||||
viz::Text3DWidget t3w2("Camera2", Point3f(0,0,0), 0.1);
|
||||
|
||||
// viz.showWidget("CameraPositionWidget", cpw);
|
||||
// viz.showWidget("CameraPositionWidget2", cpw2, Affine3f(0.524, 0, 0, Vec3f(-1.0, 0.5, 0.5)));
|
||||
// viz.showWidget("camera_label", t3w1);
|
||||
// viz.showWidget("camera_label2", t3w2, Affine3f(0.524, 0, 0, Vec3f(-1.0, 0.5, 0.5)));
|
||||
// viz.showWidget("frustrum", frustum, Affine3f(0.524, 0, 0, Vec3f(-1.0, 0.5, 0.5)));
|
||||
// viz.showWidget("frustrum2", frustum2, Affine3f(0.524, 0, 0, Vec3f(-1.0, 0.5, 0.5)));
|
||||
// viz.showWidget("frustum3", frustum3, Affine3f(0.524, 0, 0, Vec3f(-1.0, 0.5, 0.5)));
|
||||
|
||||
std::vector<Affine3f> trajectory;
|
||||
|
||||
trajectory.push_back(Affine3f().translate(Vec3f(0.5,0.5,0.5)));
|
||||
trajectory.push_back(Affine3f().translate(Vec3f(1.0,0.0,0.0)));
|
||||
trajectory.push_back(Affine3f().translate(Vec3f(2.0,0.5,0.0)));
|
||||
trajectory.push_back(Affine3f(0.5, 0.0, 0.0, Vec3f(1.0,0.0,1.0)));
|
||||
//
|
||||
//viz.showWidget("trajectory1", viz::TrajectoryWidget(trajectory, viz::Color(0,255,255), true, 0.5));
|
||||
viz.showWidget("trajectory2", viz::TrajectoryWidget(trajectory, K, 1.0, viz::Color(255,0,255)));
|
||||
|
||||
// cv::Rodrigues2(Vec3f(), Mat());
|
||||
|
||||
|
||||
// viz.showWidget("trajectory1", viz::TrajectoryWidget(trajectory/*, viz::Color::yellow()*/));
|
||||
|
||||
// viz.showWidget("CameraPositionWidget2", cpw2);
|
||||
// viz.showWidget("CameraPositionWidget3", cpw3);
|
||||
|
||||
viz.spin();
|
||||
for (int i = 0, j = 0; i <= 360; ++i, j+=5)
|
||||
{
|
||||
cam_path.push_back(viz::makeCameraPose(Point3f(0.5*cos(double(i)*CV_PI/180.0), 0.5*sin(double(j)*CV_PI/180.0), 0.5*sin(double(i)*CV_PI/180.0)),
|
||||
Point3f(0.0,0.0,0.0), Point3f(0.0,1.0,0.0)));
|
||||
}
|
||||
|
||||
int path_counter = 0;
|
||||
int cam_path_size = cam_path.size();
|
||||
|
||||
//viz::GridWidget gw(viz::Vec2i(100,100), viz::Vec2d(1,1));
|
||||
//v.showWidget("grid", gw);
|
||||
// lw = viz.getWidget("grid").cast<cv::viz::LineWidget>();
|
||||
// OTHER WIDGETS
|
||||
cv::Mat img = imread("opencv.png");
|
||||
|
||||
//viz::Text3DWidget t3w("OpenCV", cv::Point3f(0.0, 2.0, 0.0), 1.0, viz::Color(255,255,0));
|
||||
//v.showWidget("txt3d", t3w);
|
||||
int downSample = 4;
|
||||
|
||||
int row_max = img.rows/downSample;
|
||||
int col_max = img.cols/downSample;
|
||||
|
||||
cv::Mat clouds[img.cols/downSample];
|
||||
cv::Mat colors[img.cols/downSample];
|
||||
|
||||
for (int col = 0; col < col_max; ++col)
|
||||
{
|
||||
clouds[col] = Mat::zeros(img.rows/downSample, 1, CV_32FC3);
|
||||
colors[col] = Mat::zeros(img.rows/downSample, 1, CV_8UC3);
|
||||
for (int row = 0; row < row_max; ++row)
|
||||
{
|
||||
clouds[col].at<Vec3f>(row) = Vec3f(downSample * float(col) / img.cols, 1.0-(downSample * float(row) / img.rows), 0.0);
|
||||
colors[col].at<Vec3b>(row) = img.at<Vec3b>(row*downSample,col*downSample);
|
||||
}
|
||||
}
|
||||
|
||||
for (int col = 0; col < col_max; ++col)
|
||||
{
|
||||
std::stringstream strstrm;
|
||||
strstrm << "cloud_" << col;
|
||||
viz.showWidget(strstrm.str(), viz::WCloud(clouds[col], colors[col]));
|
||||
viz.getWidget(strstrm.str()).setRenderingProperty(viz::POINT_SIZE, 3.0);
|
||||
viz.getWidget(strstrm.str()).setRenderingProperty(viz::OPACITY, 0.45);
|
||||
}
|
||||
|
||||
viz.showWidget("trajectory", viz::WTrajectory(cam_path, viz::WTrajectory::DISPLAY_PATH, viz::Color::yellow()));
|
||||
viz.showWidget("cam_text", viz::WText("Global View", Point2i(5,5), 28));
|
||||
viz.registerKeyboardCallback(keyboard_callback, (void *) &viz);
|
||||
|
||||
// float grid_x_angle = 0.0;
|
||||
|
||||
int angle = 0;
|
||||
|
||||
while(!viz.wasStopped())
|
||||
{
|
||||
// Creating new point cloud with id cloud1
|
||||
cv::Affine3f cloudPosition(angle, pos);
|
||||
cv::Affine3f cloudPosition2(angle, pos + Vec3f(0.2f, 0.2f, 0.2f));
|
||||
if (path_counter == cam_path_size)
|
||||
{
|
||||
path_counter = 0;
|
||||
}
|
||||
|
||||
lw.setColor(color);
|
||||
// lw.setLineWidth(pos_x * 10);
|
||||
if (!constant_cam)
|
||||
{
|
||||
viz.setViewerPose(cam_path[path_counter]);
|
||||
}
|
||||
|
||||
//plw.setColor(viz::Color(col_blue, col_green, col_red));
|
||||
|
||||
// sw.setPose(cloudPosition);
|
||||
// pw.setPose(cloudPosition);
|
||||
aw.setPose(cloudPosition);
|
||||
cw.setPose(cloudPosition);
|
||||
cyw.setPose(cloudPosition);
|
||||
|
||||
frustum.setPose(cloudPosition);
|
||||
// lw.setPose(cloudPosition);
|
||||
// cpw.updatePose(Affine3f(0.1,0.0,0.0, cv::Vec3f(0.0,0.0,0.0)));
|
||||
// cpw.setPose(cloudPosition);
|
||||
// cnw.setPose(cloudPosition);
|
||||
// v.showWidget("pcw",pcw, cloudPosition);
|
||||
// v.showWidget("pcw2",pcw2, cloudPosition2);
|
||||
// v.showWidget("plane", pw, cloudPosition);
|
||||
|
||||
// v.setWidgetPose("n",cloudPosition);
|
||||
// v.setWidgetPose("pcw2", cloudPosition);
|
||||
//cnw.setColor(viz::Color(col_blue, col_green, col_red));
|
||||
//pcw2.setColor(viz::Color(col_blue, col_green, col_red));
|
||||
|
||||
//gw.updatePose(viz::Affine3f(0.0, 0.1, 0.0, cv::Vec3f(0.0,0.0,0.0)));
|
||||
|
||||
angle[0] += 0.1f;
|
||||
angle[1] -= 0.1f;
|
||||
angle[2] += 0.1f;
|
||||
pos[0] = std::sin(angle[0]);
|
||||
pos[1] = std::sin(angle[1]);
|
||||
pos[2] = std::sin(angle[2]);
|
||||
if (angle == 360) angle = 0;
|
||||
|
||||
color[0] = int(angle[0] * 10) % 256;
|
||||
color[1] = int(angle[0] * 20) % 256;
|
||||
color[2] = int(angle[0] * 30) % 256;
|
||||
|
||||
viz.spinOnce(1, true);
|
||||
cam_1.cast<viz::WCameraPosition>().setPose(cam_path[path_counter]);
|
||||
cam_coordinates.cast<viz::WCameraPosition>().setPose(cam_path[path_counter++]);
|
||||
|
||||
for (int i = 0; i < col_max; ++i)
|
||||
{
|
||||
std::stringstream strstrm;
|
||||
strstrm << "cloud_" << i;
|
||||
viz.setWidgetPose(strstrm.str(), Affine3f().translate(Vec3f(-0.5,0.0, -0.7 + 0.2*sin((angle+i*10)*CV_PI / 180.0))));
|
||||
}
|
||||
angle += 10;
|
||||
viz.spinOnce(42, true);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// viz::ModelCoefficients mc;
|
||||
// mc.values.resize(4);
|
||||
// mc.values[0] = mc.values[1] = mc.values[2] = mc.values[3] = 1;
|
||||
// v.addPlane(mc);
|
||||
//
|
||||
//
|
||||
// viz::Mesh3d::Ptr mesh = viz::mesh_load("horse.ply");
|
||||
// v.addPolygonMesh(*mesh, "pq");
|
||||
//
|
||||
// v.spinOnce(1000, true);
|
||||
//
|
||||
// v.removeCoordinateSystem();
|
||||
//
|
||||
// for(int i = 0; i < mesh->cloud.cols; ++i)
|
||||
// mesh->cloud.ptr<cv::Point3f>()[i] += cv::Point3f(1, 1, 1);
|
||||
//
|
||||
// v.updatePolygonMesh(*mesh, "pq");
|
||||
//
|
||||
//
|
||||
// for(int i = 0; i < mesh->cloud.cols; ++i)
|
||||
// mesh->cloud.ptr<cv::Point3f>()[i] -= cv::Point3f(2, 2, 2);
|
||||
// v.addPolylineFromPolygonMesh(*mesh);
|
||||
//
|
||||
//
|
||||
// v.addText("===Abd sadfljsadlk", 100, 100, cv::Scalar(255, 0, 0), 15);
|
||||
// for(int i = 0; i < cloud.cols; ++i)
|
||||
// cloud.ptr<cv::Point3f>()[i].x *=2;
|
||||
//
|
||||
// colors.setTo(cv::Scalar(255, 0, 0));
|
||||
//
|
||||
// v.addSphere(cv::Point3f(0, 0, 0), 0.3, viz::Color::blue());
|
||||
//
|
||||
// cv::Mat cvpoly(1, 5, CV_32FC3);
|
||||
// cv::Point3f* pdata = cvpoly.ptr<cv::Point3f>();
|
||||
// pdata[0] = cv::Point3f(0, 0, 0);
|
||||
// pdata[1] = cv::Point3f(0, 1, 1);
|
||||
// pdata[2] = cv::Point3f(3, 1, 2);
|
||||
// pdata[3] = cv::Point3f(0, 2, 4);
|
||||
// pdata[4] = cv::Point3f(7, 2, 3);
|
||||
// v.addPolygon(cvpoly, viz::Color::white());
|
||||
//
|
||||
// // Updating cloud1
|
||||
// v.showPointCloud("cloud1", cloud, colors);
|
||||
// v.spin();
|
||||
}
|
||||
|
||||
|
@ -39,17 +39,17 @@ void help()
|
||||
* @class TriangleWidget
|
||||
* @brief Defining our own 3D Triangle widget
|
||||
*/
|
||||
class TriangleWidget : public viz::Widget3D
|
||||
class WTriangle : public viz::Widget3D
|
||||
{
|
||||
public:
|
||||
TriangleWidget(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white());
|
||||
WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color = viz::Color::white());
|
||||
};
|
||||
|
||||
/**
|
||||
* @function TriangleWidget::TriangleWidget
|
||||
* @brief Constructor
|
||||
*/
|
||||
TriangleWidget::TriangleWidget(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color)
|
||||
WTriangle::WTriangle(const Point3f &pt1, const Point3f &pt2, const Point3f &pt3, const viz::Color & color)
|
||||
{
|
||||
// Create a triangle
|
||||
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
|
||||
@ -101,7 +101,7 @@ int main()
|
||||
viz::Viz3d myWindow("Creating Widgets");
|
||||
|
||||
/// Create a triangle widget
|
||||
TriangleWidget tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red());
|
||||
WTriangle tw(Point3f(0.0,0.0,0.0), Point3f(1.0,1.0,1.0), Point3f(0.0,1.0,0.0), viz::Color::red());
|
||||
|
||||
/// Show widget in the visualizer window
|
||||
myWindow.showWidget("TRIANGLE", tw);
|
||||
|
@ -68,7 +68,7 @@ int main(int argn, char **argv)
|
||||
viz::Viz3d myWindow("Coordinate Frame");
|
||||
|
||||
/// Add coordinate axes
|
||||
myWindow.showWidget("Coordinate Widget", viz::CoordinateSystemWidget());
|
||||
myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());
|
||||
|
||||
/// Let's assume camera has the following properties
|
||||
Point3f cam_pos(3.0f,3.0f,3.0f), cam_focal_point(3.0f,3.0f,2.0f), cam_y_dir(-1.0f,0.0f,0.0f);
|
||||
@ -82,7 +82,7 @@ int main(int argn, char **argv)
|
||||
|
||||
/// Create a cloud widget.
|
||||
Mat bunny_cloud = cvcloud_load();
|
||||
viz::CloudWidget cloud_widget(bunny_cloud, viz::Color::green());
|
||||
viz::WCloud cloud_widget(bunny_cloud, viz::Color::green());
|
||||
|
||||
/// Pose of the widget in camera frame
|
||||
Affine3f cloud_pose = Affine3f().translate(Vec3f(0.0f,0.0f,3.0f));
|
||||
@ -92,8 +92,8 @@ int main(int argn, char **argv)
|
||||
/// Visualize camera frame
|
||||
if (!camera_pov)
|
||||
{
|
||||
viz::CameraPositionWidget cpw(0.5); // Coordinate axes
|
||||
viz::CameraPositionWidget cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
|
||||
viz::WCameraPosition cpw(0.5); // Coordinate axes
|
||||
viz::WCameraPosition cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
|
||||
myWindow.showWidget("CPW", cpw, cam_pose);
|
||||
myWindow.showWidget("CPW_FRUSTUM", cpw_frustum, cam_pose);
|
||||
}
|
||||
|
@ -37,15 +37,15 @@ int main()
|
||||
viz::Viz3d myWindow("Coordinate Frame");
|
||||
|
||||
/// Add coordinate axes
|
||||
myWindow.showWidget("Coordinate Widget", viz::CoordinateSystemWidget());
|
||||
myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());
|
||||
|
||||
/// Add line to represent (1,1,1) axis
|
||||
viz::LineWidget axis(Point3f(-1.0f,-1.0f,-1.0f), Point3f(1.0f,1.0f,1.0f));
|
||||
viz::WLine axis(Point3f(-1.0f,-1.0f,-1.0f), Point3f(1.0f,1.0f,1.0f));
|
||||
axis.setRenderingProperty(viz::LINE_WIDTH, 4.0);
|
||||
myWindow.showWidget("Line Widget", axis);
|
||||
|
||||
/// Construct a cube widget
|
||||
viz::CubeWidget cube_widget(Point3f(0.5,0.5,0.0), Point3f(0.0,0.0,-0.5), true, viz::Color::blue());
|
||||
viz::WCube cube_widget(Point3f(0.5,0.5,0.0), Point3f(0.0,0.0,-0.5), true, viz::Color::blue());
|
||||
cube_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
|
||||
myWindow.showWidget("Cube Widget", cube_widget);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user