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
80ab6e88
Commit
80ab6e88
authored
Dec 12, 2013
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring
parent
7dbf6bc8
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
77 additions
and
196 deletions
+77
-196
types.hpp
modules/viz/include/opencv2/viz/types.hpp
+3
-6
viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+2
-2
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+6
-6
clouds.cpp
modules/viz/src/clouds.cpp
+5
-7
interactor_style.cpp
modules/viz/src/interactor_style.cpp
+10
-14
interactor_style.hpp
modules/viz/src/interactor_style.hpp
+0
-6
shapes.cpp
modules/viz/src/shapes.cpp
+13
-35
types.cpp
modules/viz/src/types.cpp
+7
-7
viz3d.cpp
modules/viz/src/viz3d.cpp
+2
-5
vizimpl.cpp
modules/viz/src/vizimpl.cpp
+2
-14
vizimpl.hpp
modules/viz/src/vizimpl.hpp
+2
-5
widget.cpp
modules/viz/src/widget.cpp
+25
-89
No files found.
modules/viz/include/opencv2/viz/types.hpp
View file @
80ab6e88
...
@@ -112,10 +112,7 @@ namespace cv
...
@@ -112,10 +112,7 @@ namespace cv
Mat
polygons
;
Mat
polygons
;
//! Loads mesh from a given ply file
//! Loads mesh from a given ply file
static
cv
::
viz
::
Mesh3d
loadMesh
(
const
String
&
file
);
static
Mesh3d
loadMesh
(
const
String
&
file
);
private
:
struct
loadMeshImpl
;
};
};
class
CV_EXPORTS
Camera
class
CV_EXPORTS
Camera
...
@@ -123,8 +120,8 @@ namespace cv
...
@@ -123,8 +120,8 @@ namespace cv
public
:
public
:
Camera
(
float
fx
,
float
fy
,
float
cx
,
float
cy
,
const
Size
&
window_size
);
Camera
(
float
fx
,
float
fy
,
float
cx
,
float
cy
,
const
Size
&
window_size
);
explicit
Camera
(
const
Vec2f
&
fov
,
const
Size
&
window_size
);
explicit
Camera
(
const
Vec2f
&
fov
,
const
Size
&
window_size
);
explicit
Camera
(
const
cv
::
Matx33f
&
K
,
const
Size
&
window_size
);
explicit
Camera
(
const
Matx33f
&
K
,
const
Size
&
window_size
);
explicit
Camera
(
const
cv
::
Matx44f
&
proj
,
const
Size
&
window_size
);
explicit
Camera
(
const
Matx44f
&
proj
,
const
Size
&
window_size
);
inline
const
Vec2d
&
getClip
()
const
{
return
clip_
;
}
inline
const
Vec2d
&
getClip
()
const
{
return
clip_
;
}
inline
void
setClip
(
const
Vec2d
&
clip
)
{
clip_
=
clip
;
}
inline
void
setClip
(
const
Vec2d
&
clip
)
{
clip_
=
clip
;
}
...
...
modules/viz/include/opencv2/viz/viz3d.hpp
View file @
80ab6e88
...
@@ -94,8 +94,8 @@ namespace cv
...
@@ -94,8 +94,8 @@ namespace cv
void
setWindowSize
(
const
Size
&
window_size
);
void
setWindowSize
(
const
Size
&
window_size
);
String
getWindowName
()
const
;
String
getWindowName
()
const
;
void
saveScreenshot
(
const
String
&
file
);
void
saveScreenshot
(
const
String
&
file
);
void
setWindowPosition
(
int
x
,
int
y
);
void
setWindowPosition
(
const
Point
&
window_position
);
void
setFullScreen
(
bool
mode
);
void
setFullScreen
(
bool
mode
=
true
);
void
setBackgroundColor
(
const
Color
&
color
=
Color
::
black
());
void
setBackgroundColor
(
const
Color
&
color
=
Color
::
black
());
void
spin
();
void
spin
();
...
...
modules/viz/include/opencv2/viz/widgets.hpp
View file @
80ab6e88
...
@@ -245,13 +245,13 @@ namespace cv
...
@@ -245,13 +245,13 @@ namespace cv
//! Creates camera coordinate frame (axes) at the origin
//! Creates camera coordinate frame (axes) at the origin
WCameraPosition
(
float
scale
=
1.
f
);
WCameraPosition
(
float
scale
=
1.
f
);
//! Creates frustum based on the intrinsic marix K at the origin
//! Creates frustum based on the intrinsic marix K at the origin
explicit
WCameraPosition
(
const
Matx33f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WCameraPosition
(
const
Matx33f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
//! Creates frustum based on the field of view at the origin
//! Creates frustum based on the field of view at the origin
explicit
WCameraPosition
(
const
Vec2f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WCameraPosition
(
const
Vec2f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
//! Creates frustum and display given image at the far plane
//! Creates frustum and display given image at the far plane
explicit
WCameraPosition
(
const
Matx33f
&
K
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WCameraPosition
(
const
Matx33f
&
K
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
//! Creates frustum and display given image at the far plane
//! Creates frustum and display given image at the far plane
explicit
WCameraPosition
(
const
Vec2f
&
fov
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WCameraPosition
(
const
Vec2f
&
fov
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
};
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
...
@@ -270,9 +270,9 @@ namespace cv
...
@@ -270,9 +270,9 @@ namespace cv
{
{
public
:
public
:
//! Displays trajectory of the given path by frustums
//! Displays trajectory of the given path by frustums
explicit
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Matx33f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Matx33f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
//! Displays trajectory of the given path by frustums
//! Displays trajectory of the given path by frustums
explicit
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Vec2f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Vec2f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
};
};
class
CV_EXPORTS
WTrajectorySpheres
:
public
Widget3D
class
CV_EXPORTS
WTrajectorySpheres
:
public
Widget3D
...
...
modules/viz/src/clouds.cpp
View file @
80ab6e88
...
@@ -41,9 +41,6 @@
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
//M*/
#include "precomp.hpp"
#include "precomp.hpp"
...
@@ -61,6 +58,8 @@ namespace cv
...
@@ -61,6 +58,8 @@ namespace cv
cv
::
viz
::
WCloud
::
WCloud
(
InputArray
_cloud
,
InputArray
_colors
)
cv
::
viz
::
WCloud
::
WCloud
(
InputArray
_cloud
,
InputArray
_colors
)
{
{
CV_Assert
(
!
_cloud
.
empty
()
&&
!
_colors
.
empty
());
Mat
cloud
=
_cloud
.
getMat
();
Mat
cloud
=
_cloud
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
...
@@ -74,7 +73,7 @@ cv::viz::WCloud::WCloud(InputArray _cloud, InputArray _colors)
...
@@ -74,7 +73,7 @@ cv::viz::WCloud::WCloud(InputArray _cloud, InputArray _colors)
cloud_source
->
SetCloud
(
cloud
);
cloud_source
->
SetCloud
(
cloud
);
cloud_source
->
SetColors
(
colors
,
cloud
);
cloud_source
->
SetColors
(
colors
,
cloud
);
vtkSmartPointer
<
vtk
DataSetMapper
>
mapper
=
vtkSmartPointer
<
vtkDataSet
Mapper
>::
New
();
vtkSmartPointer
<
vtk
PolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyData
Mapper
>::
New
();
mapper
->
SetInputConnection
(
cloud_source
->
GetOutputPort
());
mapper
->
SetInputConnection
(
cloud_source
->
GetOutputPort
());
mapper
->
SetScalarModeToUsePointData
();
mapper
->
SetScalarModeToUsePointData
();
mapper
->
ImmediateModeRenderingOff
();
mapper
->
ImmediateModeRenderingOff
();
...
@@ -96,7 +95,7 @@ cv::viz::WCloud::WCloud(InputArray _cloud, const Color &color)
...
@@ -96,7 +95,7 @@ cv::viz::WCloud::WCloud(InputArray _cloud, const Color &color)
vtkSmartPointer
<
vtkCloudMatSource
>
cloud_source
=
vtkSmartPointer
<
vtkCloudMatSource
>::
New
();
vtkSmartPointer
<
vtkCloudMatSource
>
cloud_source
=
vtkSmartPointer
<
vtkCloudMatSource
>::
New
();
cloud_source
->
SetCloud
(
cloud
);
cloud_source
->
SetCloud
(
cloud
);
vtkSmartPointer
<
vtk
DataSetMapper
>
mapper
=
vtkSmartPointer
<
vtkDataSet
Mapper
>::
New
();
vtkSmartPointer
<
vtk
PolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyData
Mapper
>::
New
();
mapper
->
SetInputConnection
(
cloud_source
->
GetOutputPort
());
mapper
->
SetInputConnection
(
cloud_source
->
GetOutputPort
());
mapper
->
ImmediateModeRenderingOff
();
mapper
->
ImmediateModeRenderingOff
();
mapper
->
ScalarVisibilityOff
();
mapper
->
ScalarVisibilityOff
();
...
@@ -213,7 +212,7 @@ namespace cv { namespace viz { namespace
...
@@ -213,7 +212,7 @@ namespace cv { namespace viz { namespace
if
(
!
mapper
)
if
(
!
mapper
)
{
{
// This is the first cloud
// This is the first cloud
vtkSmartPointer
<
vtk
DataSetMapper
>
mapper_new
=
vtkSmartPointer
<
vtkDataSet
Mapper
>::
New
();
vtkSmartPointer
<
vtk
PolyDataMapper
>
mapper_new
=
vtkSmartPointer
<
vtkPolyData
Mapper
>::
New
();
#if VTK_MAJOR_VERSION <= 5
#if VTK_MAJOR_VERSION <= 5
mapper_new
->
SetInputConnection
(
poly_data
->
GetProducerPort
());
mapper_new
->
SetInputConnection
(
poly_data
->
GetProducerPort
());
#else
#else
...
@@ -309,7 +308,6 @@ void cv::viz::WCloudCollection::addCloud(InputArray _cloud, InputArray _colors,
...
@@ -309,7 +308,6 @@ void cv::viz::WCloudCollection::addCloud(InputArray _cloud, InputArray _colors,
CV_Assert
(
"Incompatible widget type."
&&
actor
);
CV_Assert
(
"Incompatible widget type."
&&
actor
);
CloudCollectionUtils
::
createMapper
(
actor
,
transform_filter
->
GetOutput
());
CloudCollectionUtils
::
createMapper
(
actor
,
transform_filter
->
GetOutput
());
}
}
void
cv
::
viz
::
WCloudCollection
::
addCloud
(
InputArray
_cloud
,
const
Color
&
color
,
const
Affine3f
&
pose
)
void
cv
::
viz
::
WCloudCollection
::
addCloud
(
InputArray
_cloud
,
const
Color
&
color
,
const
Affine3f
&
pose
)
...
...
modules/viz/src/interactor_style.cpp
View file @
80ab6e88
...
@@ -48,6 +48,13 @@
...
@@ -48,6 +48,13 @@
#include "precomp.hpp"
#include "precomp.hpp"
namespace
cv
{
namespace
viz
{
vtkStandardNewMacro
(
InteractorStyle
)
}}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
InteractorStyle
::
Initialize
()
void
cv
::
viz
::
InteractorStyle
::
Initialize
()
{
{
...
@@ -173,10 +180,6 @@ void cv::viz::InteractorStyle::registerKeyboardCallback(void (*callback)(const K
...
@@ -173,10 +180,6 @@ void cv::viz::InteractorStyle::registerKeyboardCallback(void (*callback)(const K
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
bool
cv
::
viz
::
InteractorStyle
::
getAltKey
()
{
return
Interactor
->
GetAltKey
()
!=
0
;
}
bool
cv
::
viz
::
InteractorStyle
::
getShiftKey
()
{
return
Interactor
->
GetShiftKey
()
!=
0
;
}
bool
cv
::
viz
::
InteractorStyle
::
getControlKey
()
{
return
Interactor
->
GetControlKey
()
!=
0
;
}
int
cv
::
viz
::
InteractorStyle
::
getModifiers
()
int
cv
::
viz
::
InteractorStyle
::
getModifiers
()
{
{
int
modifiers
=
KeyboardEvent
::
NONE
;
int
modifiers
=
KeyboardEvent
::
NONE
;
...
@@ -212,7 +215,7 @@ cv::viz::InteractorStyle::OnKeyDown()
...
@@ -212,7 +215,7 @@ cv::viz::InteractorStyle::OnKeyDown()
if
(
win_size_
[
0
]
==
-
1
||
win_size_
[
1
]
==
-
1
)
if
(
win_size_
[
0
]
==
-
1
||
win_size_
[
1
]
==
-
1
)
win_size_
=
Vec2i
(
Interactor
->
GetRenderWindow
()
->
GetSize
());
win_size_
=
Vec2i
(
Interactor
->
GetRenderWindow
()
->
GetSize
());
bool
alt
=
getAltKey
()
;
bool
alt
=
Interactor
->
GetAltKey
()
!=
0
;
std
::
string
key
(
Interactor
->
GetKeySym
());
std
::
string
key
(
Interactor
->
GetKeySym
());
if
(
key
.
find
(
"XF86ZoomIn"
)
!=
std
::
string
::
npos
)
if
(
key
.
find
(
"XF86ZoomIn"
)
!=
std
::
string
::
npos
)
...
@@ -425,8 +428,6 @@ cv::viz::InteractorStyle::OnKeyDown()
...
@@ -425,8 +428,6 @@ cv::viz::InteractorStyle::OnKeyDown()
break
;
break
;
}
}
vtkSmartPointer
<
vtkCamera
>
cam
=
CurrentRenderer
->
GetActiveCamera
();
static
WidgetActorMap
::
iterator
it
=
widget_actor_map_
->
begin
();
static
WidgetActorMap
::
iterator
it
=
widget_actor_map_
->
begin
();
// it might be that some actors don't have a valid transformation set -> we skip them to avoid a seg fault.
// it might be that some actors don't have a valid transformation set -> we skip them to avoid a seg fault.
bool
found_transformation
=
false
;
bool
found_transformation
=
false
;
...
@@ -444,6 +445,8 @@ cv::viz::InteractorStyle::OnKeyDown()
...
@@ -444,6 +445,8 @@ cv::viz::InteractorStyle::OnKeyDown()
}
}
}
}
vtkSmartPointer
<
vtkCamera
>
cam
=
CurrentRenderer
->
GetActiveCamera
();
// if a valid transformation was found, use it otherwise fall back to default view point.
// if a valid transformation was found, use it otherwise fall back to default view point.
if
(
found_transformation
)
if
(
found_transformation
)
{
{
...
@@ -487,7 +490,6 @@ cv::viz::InteractorStyle::OnKeyDown()
...
@@ -487,7 +490,6 @@ cv::viz::InteractorStyle::OnKeyDown()
}
}
}
}
KeyboardEvent
event
(
KeyboardEvent
::
KEY_DOWN
,
Interactor
->
GetKeySym
(),
Interactor
->
GetKeyCode
(),
getModifiers
());
KeyboardEvent
event
(
KeyboardEvent
::
KEY_DOWN
,
Interactor
->
GetKeySym
(),
Interactor
->
GetKeyCode
(),
getModifiers
());
// Check if there is a keyboard callback registered
// Check if there is a keyboard callback registered
if
(
keyboardCallback_
)
if
(
keyboardCallback_
)
...
@@ -656,9 +658,3 @@ void cv::viz::InteractorStyle::OnTimer()
...
@@ -656,9 +658,3 @@ void cv::viz::InteractorStyle::OnTimer()
renderer_
->
Render
();
renderer_
->
Render
();
Interactor
->
Render
();
Interactor
->
Render
();
}
}
namespace
cv
{
namespace
viz
{
//Standard VTK macro for *New()
vtkStandardNewMacro
(
InteractorStyle
)
}}
modules/viz/src/interactor_style.hpp
View file @
80ab6e88
...
@@ -41,9 +41,6 @@
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
//M*/
#ifndef __OPENCV_VIZ_INTERACTOR_STYLE_H__
#ifndef __OPENCV_VIZ_INTERACTOR_STYLE_H__
...
@@ -121,9 +118,6 @@ namespace cv
...
@@ -121,9 +118,6 @@ namespace cv
void
(
*
mouseCallback_
)(
const
MouseEvent
&
,
void
*
);
void
(
*
mouseCallback_
)(
const
MouseEvent
&
,
void
*
);
void
*
mouse_callback_cookie_
;
void
*
mouse_callback_cookie_
;
bool
getAltKey
();
bool
getControlKey
();
bool
getShiftKey
();
int
getModifiers
();
int
getModifiers
();
};
};
}
}
...
...
modules/viz/src/shapes.cpp
View file @
80ab6e88
...
@@ -41,9 +41,6 @@
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
//M*/
#include "precomp.hpp"
#include "precomp.hpp"
...
@@ -63,7 +60,6 @@ cv::viz::WLine::WLine(const Point3f &pt1, const Point3f &pt2, const Color &color
...
@@ -63,7 +60,6 @@ cv::viz::WLine::WLine(const Point3f &pt1, const Point3f &pt2, const Color &color
vtkSmartPointer
<
vtkLineSource
>
line
=
vtkSmartPointer
<
vtkLineSource
>::
New
();
vtkSmartPointer
<
vtkLineSource
>
line
=
vtkSmartPointer
<
vtkLineSource
>::
New
();
line
->
SetPoint1
(
pt1
.
x
,
pt1
.
y
,
pt1
.
z
);
line
->
SetPoint1
(
pt1
.
x
,
pt1
.
y
,
pt1
.
z
);
line
->
SetPoint2
(
pt2
.
x
,
pt2
.
y
,
pt2
.
z
);
line
->
SetPoint2
(
pt2
.
x
,
pt2
.
y
,
pt2
.
z
);
line
->
Update
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
mapper
->
SetInputConnection
(
line
->
GetOutputPort
());
mapper
->
SetInputConnection
(
line
->
GetOutputPort
());
...
@@ -165,7 +161,6 @@ cv::viz::WSphere::WSphere(const Point3f ¢er, float radius, int sphere_resolu
...
@@ -165,7 +161,6 @@ cv::viz::WSphere::WSphere(const Point3f ¢er, float radius, int sphere_resolu
sphere
->
SetPhiResolution
(
sphere_resolution
);
sphere
->
SetPhiResolution
(
sphere_resolution
);
sphere
->
SetThetaResolution
(
sphere_resolution
);
sphere
->
SetThetaResolution
(
sphere_resolution
);
sphere
->
LatLongTessellationOff
();
sphere
->
LatLongTessellationOff
();
sphere
->
Update
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
mapper
->
SetInputConnection
(
sphere
->
GetOutputPort
());
mapper
->
SetInputConnection
(
sphere
->
GetOutputPort
());
...
@@ -194,44 +189,27 @@ cv::viz::WArrow::WArrow(const Point3f& pt1, const Point3f& pt2, float thickness,
...
@@ -194,44 +189,27 @@ cv::viz::WArrow::WArrow(const Point3f& pt1, const Point3f& pt2, float thickness,
arrowSource
->
SetTipRadius
(
thickness
*
3.0
);
arrowSource
->
SetTipRadius
(
thickness
*
3.0
);
arrowSource
->
SetTipLength
(
thickness
*
10.0
);
arrowSource
->
SetTipLength
(
thickness
*
10.0
);
float
startPoint
[
3
],
endPoint
[
3
];
Vec3f
startPoint
(
pt1
.
x
,
pt1
.
y
,
pt1
.
z
),
endPoint
(
pt2
.
x
,
pt2
.
y
,
pt2
.
z
);
startPoint
[
0
]
=
pt1
.
x
;
Vec3f
arbitrary
(
theRNG
().
uniform
(
-
10.
f
,
10.
f
),
theRNG
().
uniform
(
-
10.
f
,
10.
f
),
theRNG
().
uniform
(
-
10.
f
,
10.
f
));
startPoint
[
1
]
=
pt1
.
y
;
double
length
=
cv
::
norm
(
endPoint
-
startPoint
);
startPoint
[
2
]
=
pt1
.
z
;
endPoint
[
0
]
=
pt2
.
x
;
Vec3f
xvec
=
normalized
(
endPoint
-
startPoint
);
endPoint
[
1
]
=
pt2
.
y
;
Vec3f
zvec
=
normalized
(
xvec
.
cross
(
arbitrary
));
endPoint
[
2
]
=
pt2
.
z
;
Vec3f
yvec
=
zvec
.
cross
(
xvec
);
float
normalizedX
[
3
],
normalizedY
[
3
],
normalizedZ
[
3
];
// The X axis is a vector from start to end
vtkMath
::
Subtract
(
endPoint
,
startPoint
,
normalizedX
);
float
length
=
vtkMath
::
Norm
(
normalizedX
);
vtkMath
::
Normalize
(
normalizedX
);
// The Z axis is an arbitrary vecotr cross X
float
arbitrary
[
3
];
arbitrary
[
0
]
=
vtkMath
::
Random
(
-
10
,
10
);
arbitrary
[
1
]
=
vtkMath
::
Random
(
-
10
,
10
);
arbitrary
[
2
]
=
vtkMath
::
Random
(
-
10
,
10
);
vtkMath
::
Cross
(
normalizedX
,
arbitrary
,
normalizedZ
);
vtkMath
::
Normalize
(
normalizedZ
);
// The Y axis is Z cross X
vtkMath
::
Cross
(
normalizedZ
,
normalizedX
,
normalizedY
);
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
vtkSmartPointer
<
vtkMatrix4x4
>::
New
();
// Create the direction cosine matrix
// Create the direction cosine matrix
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
vtkSmartPointer
<
vtkMatrix4x4
>::
New
();
matrix
->
Identity
();
matrix
->
Identity
();
for
(
unsigned
int
i
=
0
;
i
<
3
;
i
++
)
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
{
matrix
->
SetElement
(
i
,
0
,
normalizedX
[
i
]);
matrix
->
SetElement
(
i
,
0
,
xvec
[
i
]);
matrix
->
SetElement
(
i
,
1
,
normalizedY
[
i
]);
matrix
->
SetElement
(
i
,
1
,
yvec
[
i
]);
matrix
->
SetElement
(
i
,
2
,
normalizedZ
[
i
]);
matrix
->
SetElement
(
i
,
2
,
zvec
[
i
]);
}
}
// Apply the transforms
// Apply the transforms
vtkSmartPointer
<
vtkTransform
>
transform
=
vtkSmartPointer
<
vtkTransform
>::
New
();
vtkSmartPointer
<
vtkTransform
>
transform
=
vtkSmartPointer
<
vtkTransform
>::
New
();
transform
->
Translate
(
startPoint
);
transform
->
Translate
(
startPoint
.
val
);
transform
->
Concatenate
(
matrix
);
transform
->
Concatenate
(
matrix
);
transform
->
Scale
(
length
,
length
,
length
);
transform
->
Scale
(
length
,
length
,
length
);
...
...
modules/viz/src/types.cpp
View file @
80ab6e88
...
@@ -41,9 +41,6 @@
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
//M*/
#include "precomp.hpp"
#include "precomp.hpp"
...
@@ -60,9 +57,11 @@ cv::viz::MouseEvent::MouseEvent(const Type& _type, const MouseButton& _button, c
...
@@ -60,9 +57,11 @@ cv::viz::MouseEvent::MouseEvent(const Type& _type, const MouseButton& _button, c
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
/// cv::viz::Mesh3d
/// cv::viz::Mesh3d
struct
cv
::
viz
::
Mesh3d
::
loadMeshImpl
namespace
cv
{
namespace
viz
{
namespace
{
{
static
cv
::
viz
::
Mesh3d
loadMesh
(
const
String
&
file
)
struct
MeshUtils
{
static
Mesh3d
loadMesh
(
const
String
&
file
)
{
{
Mesh3d
mesh
;
Mesh3d
mesh
;
...
@@ -126,11 +125,12 @@ struct cv::viz::Mesh3d::loadMeshImpl
...
@@ -126,11 +125,12 @@ struct cv::viz::Mesh3d::loadMeshImpl
return
mesh
;
return
mesh
;
}
}
};
};
}}}
cv
::
viz
::
Mesh3d
cv
::
viz
::
Mesh3d
::
loadMesh
(
const
String
&
file
)
cv
::
viz
::
Mesh3d
cv
::
viz
::
Mesh3d
::
loadMesh
(
const
String
&
file
)
{
{
return
loadMeshImpl
::
loadMesh
(
file
);
return
MeshUtils
::
loadMesh
(
file
);
}
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
...
...
modules/viz/src/viz3d.cpp
View file @
80ab6e88
...
@@ -41,9 +41,6 @@
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
//M*/
#include "precomp.hpp"
#include "precomp.hpp"
...
@@ -131,10 +128,10 @@ void cv::viz::Viz3d::convertToWindowCoordinates(const Point3d &pt, Point3d &wind
...
@@ -131,10 +128,10 @@ void cv::viz::Viz3d::convertToWindowCoordinates(const Point3d &pt, Point3d &wind
void
cv
::
viz
::
Viz3d
::
converTo3DRay
(
const
Point3d
&
window_coord
,
Point3d
&
origin
,
Vec3d
&
direction
)
{
impl_
->
converTo3DRay
(
window_coord
,
origin
,
direction
);
}
void
cv
::
viz
::
Viz3d
::
converTo3DRay
(
const
Point3d
&
window_coord
,
Point3d
&
origin
,
Vec3d
&
direction
)
{
impl_
->
converTo3DRay
(
window_coord
,
origin
,
direction
);
}
cv
::
Size
cv
::
viz
::
Viz3d
::
getWindowSize
()
const
{
return
impl_
->
getWindowSize
();
}
cv
::
Size
cv
::
viz
::
Viz3d
::
getWindowSize
()
const
{
return
impl_
->
getWindowSize
();
}
void
cv
::
viz
::
Viz3d
::
setWindowSize
(
const
Size
&
window_size
)
{
impl_
->
setWindowSize
(
window_size
.
width
,
window_size
.
height
);
}
void
cv
::
viz
::
Viz3d
::
setWindowSize
(
const
Size
&
window_size
)
{
impl_
->
setWindowSize
(
window_size
);
}
cv
::
String
cv
::
viz
::
Viz3d
::
getWindowName
()
const
{
return
impl_
->
getWindowName
();
}
cv
::
String
cv
::
viz
::
Viz3d
::
getWindowName
()
const
{
return
impl_
->
getWindowName
();
}
void
cv
::
viz
::
Viz3d
::
saveScreenshot
(
const
String
&
file
)
{
impl_
->
saveScreenshot
(
file
);
}
void
cv
::
viz
::
Viz3d
::
saveScreenshot
(
const
String
&
file
)
{
impl_
->
saveScreenshot
(
file
);
}
void
cv
::
viz
::
Viz3d
::
setWindowPosition
(
int
x
,
int
y
)
{
impl_
->
setWindowPosition
(
x
,
y
);
}
void
cv
::
viz
::
Viz3d
::
setWindowPosition
(
const
Point
&
window_position
)
{
impl_
->
setWindowPosition
(
window_position
);
}
void
cv
::
viz
::
Viz3d
::
setFullScreen
(
bool
mode
)
{
impl_
->
setFullScreen
(
mode
);
}
void
cv
::
viz
::
Viz3d
::
setFullScreen
(
bool
mode
)
{
impl_
->
setFullScreen
(
mode
);
}
void
cv
::
viz
::
Viz3d
::
setBackgroundColor
(
const
Color
&
color
)
{
impl_
->
setBackgroundColor
(
color
);
}
void
cv
::
viz
::
Viz3d
::
setBackgroundColor
(
const
Color
&
color
)
{
impl_
->
setBackgroundColor
(
color
);
}
...
...
modules/viz/src/vizimpl.cpp
View file @
80ab6e88
...
@@ -41,9 +41,6 @@
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
//M*/
#include "precomp.hpp"
#include "precomp.hpp"
...
@@ -62,14 +59,11 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
...
@@ -62,14 +59,11 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
:
s_lastDone_
(
0.0
),
style_
(
vtkSmartPointer
<
cv
::
viz
::
InteractorStyle
>::
New
()),
widget_actor_map_
(
new
WidgetActorMap
)
:
s_lastDone_
(
0.0
),
style_
(
vtkSmartPointer
<
cv
::
viz
::
InteractorStyle
>::
New
()),
widget_actor_map_
(
new
WidgetActorMap
)
{
{
renderer_
=
vtkSmartPointer
<
vtkRenderer
>::
New
();
renderer_
=
vtkSmartPointer
<
vtkRenderer
>::
New
();
// Create a RendererWindow
window_
=
vtkSmartPointer
<
vtkRenderWindow
>::
New
();
window_
=
vtkSmartPointer
<
vtkRenderWindow
>::
New
();
// Set the window size as 1/2 of the screen size
// Set the window size as 1/2 of the screen size
cv
::
Vec2i
window_size
=
cv
::
Vec2i
(
window_
->
GetScreenSize
())
/
2
;
cv
::
Vec2i
window_size
=
cv
::
Vec2i
(
window_
->
GetScreenSize
())
/
2
;
window_
->
SetSize
(
window_size
.
val
);
window_
->
SetSize
(
window_size
.
val
);
window_
->
AddRenderer
(
renderer_
);
window_
->
AddRenderer
(
renderer_
);
// Create the interactor style
// Create the interactor style
...
@@ -100,11 +94,6 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
...
@@ -100,11 +94,6 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
interactor_
->
Initialize
();
interactor_
->
Initialize
();
timer_id_
=
interactor_
->
CreateRepeatingTimer
(
5000L
);
timer_id_
=
interactor_
->
CreateRepeatingTimer
(
5000L
);
// Set a simple PointPicker
//vtkSmartPointer<vtkPointPicker> pp = vtkSmartPointer<vtkPointPicker>::New();
//pp->SetTolerance(pp->GetTolerance() * 2);
//interactor_->SetPicker(pp);
exit_main_loop_timer_callback_
=
vtkSmartPointer
<
ExitMainLoopTimerCallback
>::
New
();
exit_main_loop_timer_callback_
=
vtkSmartPointer
<
ExitMainLoopTimerCallback
>::
New
();
exit_main_loop_timer_callback_
->
viz_
=
this
;
exit_main_loop_timer_callback_
->
viz_
=
this
;
exit_main_loop_timer_callback_
->
right_timer_id
=
-
1
;
exit_main_loop_timer_callback_
->
right_timer_id
=
-
1
;
...
@@ -116,7 +105,6 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
...
@@ -116,7 +105,6 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
resetStoppedFlag
();
resetStoppedFlag
();
//////////////////////////////
//////////////////////////////
String
window_name
=
VizStorage
::
generateWindowName
(
name
);
String
window_name
=
VizStorage
::
generateWindowName
(
name
);
window_
->
SetWindowName
(
window_name
.
c_str
());
window_
->
SetWindowName
(
window_name
.
c_str
());
...
@@ -521,6 +509,6 @@ cv::String cv::viz::Viz3d::VizImpl::getWindowName() const
...
@@ -521,6 +509,6 @@ cv::String cv::viz::Viz3d::VizImpl::getWindowName() const
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowPosition
(
int
x
,
int
y
)
{
window_
->
SetPosition
(
x
,
y
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowPosition
(
const
Point
&
position
)
{
window_
->
SetPosition
(
position
.
x
,
position
.
y
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowSize
(
int
xw
,
int
yw
)
{
window_
->
SetSize
(
xw
,
yw
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowSize
(
const
Size
&
window_size
)
{
window_
->
SetSize
(
window_size
.
width
,
window_size
.
height
);
}
cv
::
Size
cv
::
viz
::
Viz3d
::
VizImpl
::
getWindowSize
()
const
{
return
Size
(
window_
->
GetSize
()[
0
],
window_
->
GetSize
()[
1
]);
}
cv
::
Size
cv
::
viz
::
Viz3d
::
VizImpl
::
getWindowSize
()
const
{
return
Size
(
window_
->
GetSize
()[
0
],
window_
->
GetSize
()[
1
]);
}
modules/viz/src/vizimpl.hpp
View file @
80ab6e88
...
@@ -41,9 +41,6 @@
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
//M*/
#ifndef __OPENCV_VIZ_VIZ3D_IMPL_HPP__
#ifndef __OPENCV_VIZ_VIZ3D_IMPL_HPP__
...
@@ -105,9 +102,9 @@ public:
...
@@ -105,9 +102,9 @@ public:
void
converTo3DRay
(
const
Point3d
&
window_coord
,
Point3d
&
origin
,
Vec3d
&
direction
);
void
converTo3DRay
(
const
Point3d
&
window_coord
,
Point3d
&
origin
,
Vec3d
&
direction
);
void
saveScreenshot
(
const
String
&
file
);
void
saveScreenshot
(
const
String
&
file
);
void
setWindowPosition
(
int
x
,
int
y
);
void
setWindowPosition
(
const
Point
&
position
);
Size
getWindowSize
()
const
;
Size
getWindowSize
()
const
;
void
setWindowSize
(
int
xw
,
int
yw
);
void
setWindowSize
(
const
Size
&
window_size
);
void
setFullScreen
(
bool
mode
);
void
setFullScreen
(
bool
mode
);
String
getWindowName
()
const
;
String
getWindowName
()
const
;
void
setBackgroundColor
(
const
Color
&
color
);
void
setBackgroundColor
(
const
Color
&
color
);
...
...
modules/viz/src/widget.cpp
View file @
80ab6e88
...
@@ -41,9 +41,6 @@
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
//M*/
#include "precomp.hpp"
#include "precomp.hpp"
...
@@ -55,7 +52,6 @@ class cv::viz::Widget::Impl
...
@@ -55,7 +52,6 @@ class cv::viz::Widget::Impl
{
{
public
:
public
:
vtkSmartPointer
<
vtkProp
>
prop
;
vtkSmartPointer
<
vtkProp
>
prop
;
Impl
()
:
prop
(
0
)
{}
Impl
()
:
prop
(
0
)
{}
};
};
...
@@ -63,13 +59,17 @@ cv::viz::Widget::Widget() : impl_( new Impl() ) { }
...
@@ -63,13 +59,17 @@ cv::viz::Widget::Widget() : impl_( new Impl() ) { }
cv
::
viz
::
Widget
::
Widget
(
const
Widget
&
other
)
:
impl_
(
new
Impl
()
)
cv
::
viz
::
Widget
::
Widget
(
const
Widget
&
other
)
:
impl_
(
new
Impl
()
)
{
{
if
(
other
.
impl_
&&
other
.
impl_
->
prop
)
impl_
->
prop
=
other
.
impl_
->
prop
;
if
(
other
.
impl_
&&
other
.
impl_
->
prop
)
impl_
->
prop
=
other
.
impl_
->
prop
;
}
}
cv
::
viz
::
Widget
&
cv
::
viz
::
Widget
::
operator
=
(
const
Widget
&
other
)
cv
::
viz
::
Widget
&
cv
::
viz
::
Widget
::
operator
=
(
const
Widget
&
other
)
{
{
if
(
!
impl_
)
impl_
=
new
Impl
();
if
(
!
impl_
)
if
(
other
.
impl_
)
impl_
->
prop
=
other
.
impl_
->
prop
;
impl_
=
new
Impl
();
if
(
other
.
impl_
)
impl_
->
prop
=
other
.
impl_
->
prop
;
return
*
this
;
return
*
this
;
}
}
...
@@ -84,45 +84,22 @@ cv::viz::Widget::~Widget()
...
@@ -84,45 +84,22 @@ cv::viz::Widget::~Widget()
cv
::
viz
::
Widget
cv
::
viz
::
Widget
::
fromPlyFile
(
const
String
&
file_name
)
cv
::
viz
::
Widget
cv
::
viz
::
Widget
::
fromPlyFile
(
const
String
&
file_name
)
{
{
CV_Assert
(
vtkPLYReader
::
CanReadFile
(
file_name
.
c_str
()));
vtkSmartPointer
<
vtkPLYReader
>
reader
=
vtkSmartPointer
<
vtkPLYReader
>::
New
();
vtkSmartPointer
<
vtkPLYReader
>
reader
=
vtkSmartPointer
<
vtkPLYReader
>::
New
();
reader
->
SetFileName
(
file_name
.
c_str
());
reader
->
SetFileName
(
file_name
.
c_str
());
vtkSmartPointer
<
vtkDataSet
>
data
=
reader
->
GetOutput
();
CV_Assert
(
"File does not exist or file format is not supported."
&&
data
);
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkSmartPointer
<
vtkLODActor
>::
New
();
vtkSmartPointer
<
vtkDataSetMapper
>
mapper
=
vtkSmartPointer
<
vtkDataSetMapper
>::
New
();
vtkSmartPointer
<
vtkDataSetMapper
>
mapper
=
vtkSmartPointer
<
vtkDataSetMapper
>::
New
();
#if VTK_MAJOR_VERSION <= 5
mapper
->
SetInputConnection
(
reader
->
GetOutputPort
()
);
mapper
->
SetInput
(
data
);
#else
mapper
->
SetInputData
(
data
);
#endif
vtkSmartPointer
<
vtkDataArray
>
scalars
=
data
->
GetPointData
()
->
GetScalars
();
if
(
scalars
)
{
cv
::
Vec2d
minmax
(
scalars
->
GetRange
());
mapper
->
SetScalarRange
(
minmax
.
val
);
mapper
->
SetScalarModeToUsePointData
();
// interpolation OFF, if data is a vtkPolyData that contains only vertices, ON for anything else.
vtkPolyData
*
polyData
=
vtkPolyData
::
SafeDownCast
(
data
);
bool
interpolation
=
(
polyData
&&
polyData
->
GetNumberOfCells
()
!=
polyData
->
GetNumberOfVerts
());
mapper
->
SetInterpolateScalarsBeforeMapping
(
interpolation
);
mapper
->
ScalarVisibilityOn
();
}
mapper
->
ImmediateModeRenderingOff
();
mapper
->
ImmediateModeRenderingOff
();
actor
->
SetNumberOfCloudPoints
(
int
(
std
::
max
<
vtkIdType
>
(
1
,
data
->
GetNumberOfPoints
()
/
10
))
);
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
(
);
actor
->
GetProperty
()
->
SetInterpolationToFlat
();
actor
->
GetProperty
()
->
SetInterpolationToFlat
();
actor
->
GetProperty
()
->
BackfaceCullingOn
();
actor
->
GetProperty
()
->
BackfaceCullingOn
();
actor
->
SetMapper
(
mapper
);
actor
->
SetMapper
(
mapper
);
Widget
widget
;
Widget
widget
;
widget
.
impl_
->
prop
=
actor
;
WidgetAccessor
::
setProp
(
widget
,
actor
)
;
return
widget
;
return
widget
;
}
}
...
@@ -133,37 +110,15 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
...
@@ -133,37 +110,15 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
switch
(
property
)
switch
(
property
)
{
{
case
POINT_SIZE
:
case
POINT_SIZE
:
actor
->
GetProperty
()
->
SetPointSize
(
float
(
value
));
break
;
{
case
OPACITY
:
actor
->
GetProperty
()
->
SetOpacity
(
value
);
break
;
actor
->
GetProperty
()
->
SetPointSize
(
float
(
value
));
case
LINE_WIDTH
:
actor
->
GetProperty
()
->
SetLineWidth
(
float
(
value
));
break
;
actor
->
Modified
();
case
IMMEDIATE_RENDERING
:
actor
->
GetMapper
()
->
SetImmediateModeRendering
(
int
(
value
));
break
;
break
;
}
case
OPACITY
:
{
actor
->
GetProperty
()
->
SetOpacity
(
value
);
actor
->
Modified
();
break
;
}
case
IMMEDIATE_RENDERING
:
{
actor
->
GetMapper
()
->
SetImmediateModeRendering
(
int
(
value
));
actor
->
Modified
();
break
;
}
case
LINE_WIDTH
:
{
actor
->
GetProperty
()
->
SetLineWidth
(
float
(
value
));
actor
->
Modified
();
break
;
}
case
FONT_SIZE
:
case
FONT_SIZE
:
{
{
vtkTextActor
*
text_actor
=
vtkTextActor
::
SafeDownCast
(
actor
);
vtkTextActor
*
text_actor
=
vtkTextActor
::
SafeDownCast
(
actor
);
CV_Assert
(
"Widget does not have text content."
&&
text_actor
);
CV_Assert
(
"Widget does not have text content."
&&
text_actor
);
vtkSmartPointer
<
vtkTextProperty
>
tprop
=
text_actor
->
GetTextProperty
();
text_actor
->
GetTextProperty
()
->
SetFontSize
(
int
(
value
));
tprop
->
SetFontSize
(
int
(
value
));
text_actor
->
Modified
();
break
;
break
;
}
}
case
REPRESENTATION
:
case
REPRESENTATION
:
...
@@ -174,7 +129,6 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
...
@@ -174,7 +129,6 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
case
REPRESENTATION_WIREFRAME
:
actor
->
GetProperty
()
->
SetRepresentationToWireframe
();
break
;
case
REPRESENTATION_WIREFRAME
:
actor
->
GetProperty
()
->
SetRepresentationToWireframe
();
break
;
case
REPRESENTATION_SURFACE
:
actor
->
GetProperty
()
->
SetRepresentationToSurface
();
break
;
case
REPRESENTATION_SURFACE
:
actor
->
GetProperty
()
->
SetRepresentationToSurface
();
break
;
}
}
actor
->
Modified
();
break
;
break
;
}
}
case
SHADING
:
case
SHADING
:
...
@@ -215,14 +169,12 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
...
@@ -215,14 +169,12 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
break
;
break
;
}
}
}
}
actor
->
Modified
();
break
;
break
;
}
}
default
:
default
:
CV_Assert
(
"setPointCloudRenderingProperties: Unknown property"
);
CV_Assert
(
"setPointCloudRenderingProperties: Unknown property"
);
}
}
actor
->
Modified
();
}
}
double
cv
::
viz
::
Widget
::
getRenderingProperty
(
int
property
)
const
double
cv
::
viz
::
Widget
::
getRenderingProperty
(
int
property
)
const
...
@@ -233,32 +185,16 @@ double cv::viz::Widget::getRenderingProperty(int property) const
...
@@ -233,32 +185,16 @@ double cv::viz::Widget::getRenderingProperty(int property) const
double
value
=
0.0
;
double
value
=
0.0
;
switch
(
property
)
switch
(
property
)
{
{
case
POINT_SIZE
:
case
POINT_SIZE
:
value
=
actor
->
GetProperty
()
->
GetPointSize
();
break
;
{
case
OPACITY
:
value
=
actor
->
GetProperty
()
->
GetOpacity
();
break
;
value
=
actor
->
GetProperty
()
->
GetPointSize
();
case
LINE_WIDTH
:
value
=
actor
->
GetProperty
()
->
GetLineWidth
();
break
;
break
;
case
IMMEDIATE_RENDERING
:
value
=
actor
->
GetMapper
()
->
GetImmediateModeRendering
();
break
;
}
case
OPACITY
:
{
value
=
actor
->
GetProperty
()
->
GetOpacity
();
break
;
}
case
IMMEDIATE_RENDERING
:
{
value
=
actor
->
GetMapper
()
->
GetImmediateModeRendering
();
break
;
}
case
LINE_WIDTH
:
{
value
=
actor
->
GetProperty
()
->
GetLineWidth
();
break
;
}
case
FONT_SIZE
:
case
FONT_SIZE
:
{
{
vtkTextActor
*
text_actor
=
vtkTextActor
::
SafeDownCast
(
actor
);
vtkTextActor
*
text_actor
=
vtkTextActor
::
SafeDownCast
(
actor
);
CV_Assert
(
"Widget does not have text content."
&&
text_actor
);
CV_Assert
(
"Widget does not have text content."
&&
text_actor
);
vtkSmartPointer
<
vtkTextProperty
>
tprop
=
text_actor
->
GetTextProperty
();
value
=
text_actor
->
GetTextProperty
()
->
GetFontSize
();;
value
=
tprop
->
GetFontSize
();
break
;
break
;
}
}
case
REPRESENTATION
:
case
REPRESENTATION
:
...
@@ -322,7 +258,7 @@ void cv::viz::Widget3D::updatePose(const Affine3f &pose)
...
@@ -322,7 +258,7 @@ void cv::viz::Widget3D::updatePose(const Affine3f &pose)
if
(
!
matrix
)
if
(
!
matrix
)
{
{
setPose
(
pose
);
setPose
(
pose
);
return
;
return
;
}
}
Affine3f
updated_pose
=
pose
*
Affine3f
(
convertToMatx
(
matrix
));
Affine3f
updated_pose
=
pose
*
Affine3f
(
convertToMatx
(
matrix
));
...
...
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