Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
c31fb8ff
Commit
c31fb8ff
authored
Sep 15, 2013
by
Ozan Tonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename widgets from *Widgets to W*
parent
f570b3e1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
56 additions
and
56 deletions
+56
-56
creating_widgets.rst
doc/tutorials/viz/creating_widgets.rst
+9
-9
transformations.rst
doc/tutorials/viz/transformations.rst
+7
-7
widget_pose.rst
doc/tutorials/viz/widget_pose.rst
+10
-10
widget.rst
modules/viz/doc/widget.rst
+0
-0
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+0
-0
cloud_widgets.cpp
modules/viz/src/cloud_widgets.cpp
+19
-19
shape_widgets.cpp
modules/viz/src/shape_widgets.cpp
+0
-0
test_viz3d.cpp
modules/viz/test/test_viz3d.cpp
+0
-0
creating_widgets.cpp
samples/cpp/tutorial_code/viz/creating_widgets.cpp
+4
-4
transformations.cpp
samples/cpp/tutorial_code/viz/transformations.cpp
+4
-4
widget_pose.cpp
samples/cpp/tutorial_code/viz/widget_pose.cpp
+3
-3
No files found.
doc/tutorials/viz/creating_widgets.rst
View file @
c31fb8ff
...
@@ -37,19 +37,19 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
...
@@ -37,19 +37,19 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
using namespace std;
using namespace std;
/**
/**
* @class
TriangleWidget
* @class
WTriangle
* @brief Defining our own 3D Triangle widget
* @brief Defining our own 3D Triangle widget
*/
*/
class
TriangleWidget
: public viz::Widget3D
class
WTriangle
: public viz::Widget3D
{
{
public:
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
// Create a triangle
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
...
@@ -99,7 +99,7 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
...
@@ -99,7 +99,7 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
viz::Viz3d myWindow("Creating Widgets");
viz::Viz3d myWindow("Creating Widgets");
/// Create a triangle widget
/// 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
/// Show widget in the visualizer window
myWindow.showWidget("TRIANGLE", tw);
myWindow.showWidget("TRIANGLE", tw);
...
@@ -119,10 +119,10 @@ Here is the general structure of the program:
...
@@ -119,10 +119,10 @@ Here is the general structure of the program:
.. code-block:: cpp
.. code-block:: cpp
class
TriangleWidget
: public viz::Widget3D
class
WTriangle
: public viz::Widget3D
{
{
public:
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.
* Assign a VTK actor to the widget.
...
@@ -144,7 +144,7 @@ Here is the general structure of the program:
...
@@ -144,7 +144,7 @@ Here is the general structure of the program:
.. code-block:: cpp
.. code-block:: cpp
/// Create a triangle widget
/// 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
/// Show widget in the visualizer window
myWindow.showWidget("TRIANGLE", tw);
myWindow.showWidget("TRIANGLE", tw);
...
...
doc/tutorials/viz/transformations.rst
View file @
c31fb8ff
...
@@ -67,7 +67,7 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
...
@@ -67,7 +67,7 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
viz::Viz3d myWindow("Coordinate Frame");
viz::Viz3d myWindow("Coordinate Frame");
/// Add coordinate axes
/// Add coordinate axes
myWindow.showWidget("Coordinate Widget", viz::
CoordinateSystemWidget
());
myWindow.showWidget("Coordinate Widget", viz::
WCoordinateSystem
());
/// Let's assume camera has the following properties
/// 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);
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/
...
@@ -81,7 +81,7 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
/// Create a cloud widget.
/// Create a cloud widget.
Mat bunny_cloud = cvcloud_load();
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
/// Pose of the widget in camera frame
Affine3f cloud_pose = Affine3f().translate(Vec3f(0.0f,0.0f,3.0f));
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/
...
@@ -91,8 +91,8 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
/// Visualize camera frame
/// Visualize camera frame
if (!camera_pov)
if (!camera_pov)
{
{
viz::
CameraPositionWidget
cpw(0.5); // Coordinate axes
viz::
WCameraPosition
cpw(0.5); // Coordinate axes
viz::
CameraPositionWidget
cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
viz::
WCameraPosition
cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
myWindow.showWidget("CPW", cpw, cam_pose);
myWindow.showWidget("CPW", cpw, cam_pose);
myWindow.showWidget("CPW_FRUSTUM", cpw_frustum, cam_pose);
myWindow.showWidget("CPW_FRUSTUM", cpw_frustum, cam_pose);
}
}
...
@@ -147,7 +147,7 @@ Here is the general structure of the program:
...
@@ -147,7 +147,7 @@ Here is the general structure of the program:
/// Create a cloud widget.
/// Create a cloud widget.
Mat bunny_cloud = cvcloud_load();
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.
* Given the pose in camera coordinate system, estimate the global pose.
...
@@ -165,8 +165,8 @@ Here is the general structure of the program:
...
@@ -165,8 +165,8 @@ Here is the general structure of the program:
/// Visualize camera frame
/// Visualize camera frame
if (!camera_pov)
if (!camera_pov)
{
{
viz::
CameraPositionWidget
cpw(0.5); // Coordinate axes
viz::
WCameraPosition
cpw(0.5); // Coordinate axes
viz::
CameraPositionWidget
cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
viz::
WCameraPosition
cpw_frustum(Vec2f(0.889484, 0.523599)); // Camera frustum
myWindow.showWidget("CPW", cpw, cam_pose);
myWindow.showWidget("CPW", cpw, cam_pose);
myWindow.showWidget("CPW_FRUSTUM", cpw_frustum, cam_pose);
myWindow.showWidget("CPW_FRUSTUM", cpw_frustum, cam_pose);
}
}
...
...
doc/tutorials/viz/widget_pose.rst
View file @
c31fb8ff
...
@@ -37,16 +37,16 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
...
@@ -37,16 +37,16 @@ You can download the code from `here <../../../../samples/cpp/tutorial_code/viz/
viz::Viz3d myWindow("Coordinate Frame");
viz::Viz3d myWindow("Coordinate Frame");
/// Add coordinate axes
/// Add coordinate axes
myWindow.showWidget("Coordinate Widget", viz::
CoordinateSystemWidget
());
myWindow.showWidget("Coordinate Widget", viz::
WCoordinateSystem
());
/// Add line to represent (1,1,1) axis
/// 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::
VIZ_
LINE_WIDTH, 4.0);
axis.setRenderingProperty(viz::LINE_WIDTH, 4.0);
myWindow.showWidget("Line Widget", axis);
myWindow.showWidget("Line Widget", axis);
/// Construct a cube widget
/// 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::
VIZ_
LINE_WIDTH, 4.0);
cube_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
/// Display widget (update if already displayed)
/// Display widget (update if already displayed)
myWindow.showWidget("Cube Widget", cube_widget);
myWindow.showWidget("Cube Widget", cube_widget);
...
@@ -97,15 +97,15 @@ Here is the general structure of the program:
...
@@ -97,15 +97,15 @@ Here is the general structure of the program:
.. code-block:: cpp
.. code-block:: cpp
/// Add coordinate axes
/// Add coordinate axes
myWindow.showWidget("Coordinate Widget", viz::
CoordinateSystemWidget
());
myWindow.showWidget("Coordinate Widget", viz::
WCoordinateSystem
());
* Display a line representing the axis (1,1,1).
* Display a line representing the axis (1,1,1).
.. code-block:: cpp
.. code-block:: cpp
/// Add line to represent (1,1,1) axis
/// 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::
VIZ_
LINE_WIDTH, 4.0);
axis.setRenderingProperty(viz::LINE_WIDTH, 4.0);
myWindow.showWidget("Line Widget", axis);
myWindow.showWidget("Line Widget", axis);
* Construct a cube.
* Construct a cube.
...
@@ -113,8 +113,8 @@ Here is the general structure of the program:
...
@@ -113,8 +113,8 @@ Here is the general structure of the program:
.. code-block:: cpp
.. code-block:: cpp
/// Construct a cube widget
/// 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::
VIZ_
LINE_WIDTH, 4.0);
cube_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
myWindow.showWidget("Cube Widget", cube_widget);
myWindow.showWidget("Cube Widget", cube_widget);
* Create rotation matrix from rodrigues vector
* Create rotation matrix from rodrigues vector
...
...
modules/viz/doc/widget.rst
View file @
c31fb8ff
This diff is collapsed.
Click to expand it.
modules/viz/include/opencv2/viz/widgets.hpp
View file @
c31fb8ff
This diff is collapsed.
Click to expand it.
modules/viz/src/cloud_widgets.cpp
View file @
c31fb8ff
...
@@ -59,7 +59,7 @@ namespace cv
...
@@ -59,7 +59,7 @@ namespace cv
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
/// Point Cloud Widget implementation
/// 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
)
static
inline
vtkSmartPointer
<
vtkPolyData
>
create
(
const
Mat
&
cloud
,
vtkIdType
&
nr_points
)
{
{
...
@@ -146,7 +146,7 @@ struct cv::viz::CloudWidget::CreateCloudWidget
...
@@ -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
cloud
=
_cloud
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
...
@@ -201,7 +201,7 @@ cv::viz::CloudWidget::CloudWidget(InputArray _cloud, InputArray _colors)
...
@@ -201,7 +201,7 @@ cv::viz::CloudWidget::CloudWidget(InputArray _cloud, InputArray _colors)
WidgetAccessor
::
setProp
(
*
this
,
actor
);
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
();
Mat
cloud
=
_cloud
.
getMat
();
CV_Assert
(
cloud
.
type
()
==
CV_32FC3
||
cloud
.
type
()
==
CV_64FC3
||
cloud
.
type
()
==
CV_32FC4
||
cloud
.
type
()
==
CV_64FC4
);
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)
...
@@ -233,16 +233,16 @@ cv::viz::CloudWidget::CloudWidget(InputArray _cloud, const Color &color)
setColor
(
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
>
();
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
return
static_cast
<
CloudWidget
&>
(
widget
);
return
static_cast
<
WCloud
&>
(
widget
);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
/// Cloud Collection Widget implementation
/// 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
)
static
inline
vtkSmartPointer
<
vtkPolyData
>
create
(
const
Mat
&
cloud
,
vtkIdType
&
nr_points
)
{
{
...
@@ -376,14 +376,14 @@ struct cv::viz::CloudCollectionWidget::CreateCloudWidget
...
@@ -376,14 +376,14 @@ struct cv::viz::CloudCollectionWidget::CreateCloudWidget
}
}
};
};
cv
::
viz
::
CloudCollectionWidget
::
CloudCollectionWidget
()
cv
::
viz
::
WCloudCollection
::
WCloudCollection
()
{
{
// Just create the actor
// Just create the actor
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkSmartPointer
<
vtkLODActor
>::
New
();
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkSmartPointer
<
vtkLODActor
>::
New
();
WidgetAccessor
::
setProp
(
*
this
,
actor
);
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
cloud
=
_cloud
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
...
@@ -432,7 +432,7 @@ void cv::viz::CloudCollectionWidget::addCloud(InputArray _cloud, InputArray _col
...
@@ -432,7 +432,7 @@ void cv::viz::CloudCollectionWidget::addCloud(InputArray _cloud, InputArray _col
CreateCloudWidget
::
createMapper
(
actor
,
transform_filter
->
GetOutput
(),
minmax
);
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
();
Mat
cloud
=
_cloud
.
getMat
();
CV_Assert
(
cloud
.
type
()
==
CV_32FC3
||
cloud
.
type
()
==
CV_64FC3
||
cloud
.
type
()
==
CV_32FC4
||
cloud
.
type
()
==
CV_64FC4
);
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
...
@@ -471,16 +471,16 @@ void cv::viz::CloudCollectionWidget::addCloud(InputArray _cloud, const Color &co
CreateCloudWidget
::
createMapper
(
actor
,
transform_filter
->
GetOutput
(),
minmax
);
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
>
();
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
return
static_cast
<
CloudCollectionWidget
&>
(
widget
);
return
static_cast
<
WCloudCollection
&>
(
widget
);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
/// Cloud Normals Widget implementation
/// Cloud Normals Widget implementation
struct
cv
::
viz
::
CloudNormalsWidget
::
ApplyCloudNormals
struct
cv
::
viz
::
WCloudNormals
::
ApplyCloudNormals
{
{
template
<
typename
_Tp
>
template
<
typename
_Tp
>
struct
Impl
struct
Impl
...
@@ -555,7 +555,7 @@ struct cv::viz::CloudNormalsWidget::ApplyCloudNormals
...
@@ -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
cloud
=
_cloud
.
getMat
();
Mat
normals
=
_normals
.
getMat
();
Mat
normals
=
_normals
.
getMat
();
...
@@ -610,16 +610,16 @@ cv::viz::CloudNormalsWidget::CloudNormalsWidget(InputArray _cloud, InputArray _n
...
@@ -610,16 +610,16 @@ cv::viz::CloudNormalsWidget::CloudNormalsWidget(InputArray _cloud, InputArray _n
setColor
(
color
);
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
>
();
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
return
static_cast
<
CloudNormalsWidget
&>
(
widget
);
return
static_cast
<
WCloudNormals
&>
(
widget
);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
/// Mesh Widget implementation
/// Mesh Widget implementation
struct
cv
::
viz
::
MeshWidget
::
CopyImpl
struct
cv
::
viz
::
WMesh
::
CopyImpl
{
{
template
<
typename
_Tp
>
template
<
typename
_Tp
>
static
Vec
<
_Tp
,
3
>
*
copy
(
const
Mat
&
source
,
Vec
<
_Tp
,
3
>
*
output
,
int
*
look_up
,
const
Mat
&
nan_mask
)
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
...
@@ -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
.
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
()));
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)
...
@@ -766,8 +766,8 @@ cv::viz::MeshWidget::MeshWidget(const Mesh3d &mesh)
WidgetAccessor
::
setProp
(
*
this
,
actor
);
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
>
();
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
return
static_cast
<
MeshWidget
&>
(
widget
);
return
static_cast
<
WMesh
&>
(
widget
);
}
}
modules/viz/src/shape_widgets.cpp
View file @
c31fb8ff
This diff is collapsed.
Click to expand it.
modules/viz/test/test_viz3d.cpp
View file @
c31fb8ff
This diff is collapsed.
Click to expand it.
samples/cpp/tutorial_code/viz/creating_widgets.cpp
View file @
c31fb8ff
...
@@ -39,17 +39,17 @@ void help()
...
@@ -39,17 +39,17 @@ void help()
* @class TriangleWidget
* @class TriangleWidget
* @brief Defining our own 3D Triangle widget
* @brief Defining our own 3D Triangle widget
*/
*/
class
TriangleWidget
:
public
viz
::
Widget3D
class
WTriangle
:
public
viz
::
Widget3D
{
{
public
:
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 TriangleWidget::TriangleWidget
* @brief Constructor
* @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
// Create a triangle
vtkSmartPointer
<
vtkPoints
>
points
=
vtkSmartPointer
<
vtkPoints
>::
New
();
vtkSmartPointer
<
vtkPoints
>
points
=
vtkSmartPointer
<
vtkPoints
>::
New
();
...
@@ -101,7 +101,7 @@ int main()
...
@@ -101,7 +101,7 @@ int main()
viz
::
Viz3d
myWindow
(
"Creating Widgets"
);
viz
::
Viz3d
myWindow
(
"Creating Widgets"
);
/// Create a triangle widget
/// 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
/// Show widget in the visualizer window
myWindow
.
showWidget
(
"TRIANGLE"
,
tw
);
myWindow
.
showWidget
(
"TRIANGLE"
,
tw
);
...
...
samples/cpp/tutorial_code/viz/transformations.cpp
View file @
c31fb8ff
...
@@ -68,7 +68,7 @@ int main(int argn, char **argv)
...
@@ -68,7 +68,7 @@ int main(int argn, char **argv)
viz
::
Viz3d
myWindow
(
"Coordinate Frame"
);
viz
::
Viz3d
myWindow
(
"Coordinate Frame"
);
/// Add coordinate axes
/// Add coordinate axes
myWindow
.
showWidget
(
"Coordinate Widget"
,
viz
::
CoordinateSystemWidget
());
myWindow
.
showWidget
(
"Coordinate Widget"
,
viz
::
WCoordinateSystem
());
/// Let's assume camera has the following properties
/// Let's assume camera has the following properties
Point3f
cam_pos
(
3.0
f
,
3.0
f
,
3.0
f
),
cam_focal_point
(
3.0
f
,
3.0
f
,
2.0
f
),
cam_y_dir
(
-
1.0
f
,
0.0
f
,
0.0
f
);
Point3f
cam_pos
(
3.0
f
,
3.0
f
,
3.0
f
),
cam_focal_point
(
3.0
f
,
3.0
f
,
2.0
f
),
cam_y_dir
(
-
1.0
f
,
0.0
f
,
0.0
f
);
...
@@ -82,7 +82,7 @@ int main(int argn, char **argv)
...
@@ -82,7 +82,7 @@ int main(int argn, char **argv)
/// Create a cloud widget.
/// Create a cloud widget.
Mat
bunny_cloud
=
cvcloud_load
();
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
/// Pose of the widget in camera frame
Affine3f
cloud_pose
=
Affine3f
().
translate
(
Vec3f
(
0.0
f
,
0.0
f
,
3.0
f
));
Affine3f
cloud_pose
=
Affine3f
().
translate
(
Vec3f
(
0.0
f
,
0.0
f
,
3.0
f
));
...
@@ -92,8 +92,8 @@ int main(int argn, char **argv)
...
@@ -92,8 +92,8 @@ int main(int argn, char **argv)
/// Visualize camera frame
/// Visualize camera frame
if
(
!
camera_pov
)
if
(
!
camera_pov
)
{
{
viz
::
CameraPositionWidget
cpw
(
0.5
);
// Coordinate axes
viz
::
WCameraPosition
cpw
(
0.5
);
// Coordinate axes
viz
::
CameraPositionWidget
cpw_frustum
(
Vec2f
(
0.889484
,
0.523599
));
// Camera frustum
viz
::
WCameraPosition
cpw_frustum
(
Vec2f
(
0.889484
,
0.523599
));
// Camera frustum
myWindow
.
showWidget
(
"CPW"
,
cpw
,
cam_pose
);
myWindow
.
showWidget
(
"CPW"
,
cpw
,
cam_pose
);
myWindow
.
showWidget
(
"CPW_FRUSTUM"
,
cpw_frustum
,
cam_pose
);
myWindow
.
showWidget
(
"CPW_FRUSTUM"
,
cpw_frustum
,
cam_pose
);
}
}
...
...
samples/cpp/tutorial_code/viz/widget_pose.cpp
View file @
c31fb8ff
...
@@ -37,15 +37,15 @@ int main()
...
@@ -37,15 +37,15 @@ int main()
viz
::
Viz3d
myWindow
(
"Coordinate Frame"
);
viz
::
Viz3d
myWindow
(
"Coordinate Frame"
);
/// Add coordinate axes
/// Add coordinate axes
myWindow
.
showWidget
(
"Coordinate Widget"
,
viz
::
CoordinateSystemWidget
());
myWindow
.
showWidget
(
"Coordinate Widget"
,
viz
::
WCoordinateSystem
());
/// Add line to represent (1,1,1) axis
/// Add line to represent (1,1,1) axis
viz
::
LineWidget
axis
(
Point3f
(
-
1.0
f
,
-
1.0
f
,
-
1.0
f
),
Point3f
(
1.0
f
,
1.0
f
,
1.0
f
));
viz
::
WLine
axis
(
Point3f
(
-
1.0
f
,
-
1.0
f
,
-
1.0
f
),
Point3f
(
1.0
f
,
1.0
f
,
1.0
f
));
axis
.
setRenderingProperty
(
viz
::
LINE_WIDTH
,
4.0
);
axis
.
setRenderingProperty
(
viz
::
LINE_WIDTH
,
4.0
);
myWindow
.
showWidget
(
"Line Widget"
,
axis
);
myWindow
.
showWidget
(
"Line Widget"
,
axis
);
/// Construct a cube widget
/// 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
);
cube_widget
.
setRenderingProperty
(
viz
::
LINE_WIDTH
,
4.0
);
myWindow
.
showWidget
(
"Cube Widget"
,
cube_widget
);
myWindow
.
showWidget
(
"Cube Widget"
,
cube_widget
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment