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
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
142 additions
and
261 deletions
+142
-261
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
+27
-31
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
+55
-55
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
Mat
polygons
;
//! Loads mesh from a given ply file
static
cv
::
viz
::
Mesh3d
loadMesh
(
const
String
&
file
);
private
:
struct
loadMeshImpl
;
static
Mesh3d
loadMesh
(
const
String
&
file
);
};
class
CV_EXPORTS
Camera
...
...
@@ -123,8 +120,8 @@ namespace cv
public
:
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
cv
::
Matx33f
&
K
,
const
Size
&
window_size
);
explicit
Camera
(
const
cv
::
Matx44f
&
proj
,
const
Size
&
window_size
);
explicit
Camera
(
const
Matx33f
&
K
,
const
Size
&
window_size
);
explicit
Camera
(
const
Matx44f
&
proj
,
const
Size
&
window_size
);
inline
const
Vec2d
&
getClip
()
const
{
return
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
void
setWindowSize
(
const
Size
&
window_size
);
String
getWindowName
()
const
;
void
saveScreenshot
(
const
String
&
file
);
void
setWindowPosition
(
int
x
,
int
y
);
void
setFullScreen
(
bool
mode
);
void
setWindowPosition
(
const
Point
&
window_position
);
void
setFullScreen
(
bool
mode
=
true
);
void
setBackgroundColor
(
const
Color
&
color
=
Color
::
black
());
void
spin
();
...
...
modules/viz/include/opencv2/viz/widgets.hpp
View file @
80ab6e88
...
...
@@ -245,13 +245,13 @@ namespace cv
//! Creates camera coordinate frame (axes) at the origin
WCameraPosition
(
float
scale
=
1.
f
);
//! 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
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
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
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
{
public
:
//! 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
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
...
...
modules/viz/src/clouds.cpp
View file @
80ab6e88
...
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp"
...
...
@@ -61,6 +58,8 @@ namespace cv
cv
::
viz
::
WCloud
::
WCloud
(
InputArray
_cloud
,
InputArray
_colors
)
{
CV_Assert
(
!
_cloud
.
empty
()
&&
!
_colors
.
empty
());
Mat
cloud
=
_cloud
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
...
...
@@ -74,7 +73,7 @@ cv::viz::WCloud::WCloud(InputArray _cloud, InputArray _colors)
cloud_source
->
SetCloud
(
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
->
SetScalarModeToUsePointData
();
mapper
->
ImmediateModeRenderingOff
();
...
...
@@ -96,7 +95,7 @@ cv::viz::WCloud::WCloud(InputArray _cloud, const Color &color)
vtkSmartPointer
<
vtkCloudMatSource
>
cloud_source
=
vtkSmartPointer
<
vtkCloudMatSource
>::
New
();
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
->
ImmediateModeRenderingOff
();
mapper
->
ScalarVisibilityOff
();
...
...
@@ -213,7 +212,7 @@ namespace cv { namespace viz { namespace
if
(
!
mapper
)
{
// 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
mapper_new
->
SetInputConnection
(
poly_data
->
GetProducerPort
());
#else
...
...
@@ -309,7 +308,6 @@ void cv::viz::WCloudCollection::addCloud(InputArray _cloud, InputArray _colors,
CV_Assert
(
"Incompatible widget type."
&&
actor
);
CloudCollectionUtils
::
createMapper
(
actor
,
transform_filter
->
GetOutput
());
}
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 @@
#include "precomp.hpp"
namespace
cv
{
namespace
viz
{
vtkStandardNewMacro
(
InteractorStyle
)
}}
//////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
InteractorStyle
::
Initialize
()
{
...
...
@@ -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
modifiers
=
KeyboardEvent
::
NONE
;
...
...
@@ -212,7 +215,7 @@ cv::viz::InteractorStyle::OnKeyDown()
if
(
win_size_
[
0
]
==
-
1
||
win_size_
[
1
]
==
-
1
)
win_size_
=
Vec2i
(
Interactor
->
GetRenderWindow
()
->
GetSize
());
bool
alt
=
getAltKey
()
;
bool
alt
=
Interactor
->
GetAltKey
()
!=
0
;
std
::
string
key
(
Interactor
->
GetKeySym
());
if
(
key
.
find
(
"XF86ZoomIn"
)
!=
std
::
string
::
npos
)
...
...
@@ -245,7 +248,7 @@ cv::viz::InteractorStyle::OnKeyDown()
" ALT + s, S : turn stereo mode on/off
\n
"
" ALT + f, F : switch between maximized window mode and original size
\n
"
"
\n
"
<<
std
::
endl
;
<<
std
::
endl
;
break
;
}
...
...
@@ -287,8 +290,8 @@ cv::viz::InteractorStyle::OnKeyDown()
double
angle
=
cam
->
GetViewAngle
()
/
180.0
*
CV_PI
;
String
data
=
cv
::
format
(
"clip(%f,%f) focal(%f,%f,%f) pos(%f,%f,%f) view(%f,%f,%f) angle(%f) winsz(%d,%d) winpos(%d,%d)"
,
clip
[
0
],
clip
[
1
],
focal
[
0
],
focal
[
1
],
focal
[
2
],
pos
[
0
],
pos
[
1
],
pos
[
2
],
view
[
0
],
view
[
1
],
view
[
2
],
angle
,
win_size
[
0
],
win_size
[
1
],
win_pos
[
0
],
win_pos
[
1
]);
clip
[
0
],
clip
[
1
],
focal
[
0
],
focal
[
1
],
focal
[
2
],
pos
[
0
],
pos
[
1
],
pos
[
2
],
view
[
0
],
view
[
1
],
view
[
2
],
angle
,
win_size
[
0
],
win_size
[
1
],
win_pos
[
0
],
win_pos
[
1
]);
std
::
cout
<<
data
.
c_str
()
<<
std
::
endl
;
...
...
@@ -416,7 +419,7 @@ cv::viz::InteractorStyle::OnKeyDown()
break
;
}
// Overwrite the camera reset
// Overwrite the camera reset
case
'r'
:
case
'R'
:
{
if
(
!
alt
)
...
...
@@ -425,8 +428,6 @@ cv::viz::InteractorStyle::OnKeyDown()
break
;
}
vtkSmartPointer
<
vtkCamera
>
cam
=
CurrentRenderer
->
GetActiveCamera
();
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.
bool
found_transformation
=
false
;
...
...
@@ -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
(
found_transformation
)
{
...
...
@@ -487,11 +490,10 @@ cv::viz::InteractorStyle::OnKeyDown()
}
}
KeyboardEvent
event
(
KeyboardEvent
::
KEY_DOWN
,
Interactor
->
GetKeySym
(),
Interactor
->
GetKeyCode
(),
getModifiers
());
// Check if there is a keyboard callback registered
if
(
keyboardCallback_
)
keyboardCallback_
(
event
,
keyboard_callback_cookie_
);
keyboardCallback_
(
event
,
keyboard_callback_cookie_
);
renderer_
->
Render
();
Interactor
->
Render
();
...
...
@@ -503,7 +505,7 @@ void cv::viz::InteractorStyle::OnKeyUp()
KeyboardEvent
event
(
KeyboardEvent
::
KEY_UP
,
Interactor
->
GetKeySym
(),
Interactor
->
GetKeyCode
(),
getModifiers
());
// Check if there is a keyboard callback registered
if
(
keyboardCallback_
)
keyboardCallback_
(
event
,
keyboard_callback_cookie_
);
keyboardCallback_
(
event
,
keyboard_callback_cookie_
);
Superclass
::
OnKeyUp
();
}
...
...
@@ -514,7 +516,7 @@ void cv::viz::InteractorStyle::OnMouseMove()
Vec2i
p
(
Interactor
->
GetEventPosition
());
MouseEvent
event
(
MouseEvent
::
MouseMove
,
MouseEvent
::
NoButton
,
p
,
getModifiers
());
if
(
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
Superclass
::
OnMouseMove
();
}
...
...
@@ -525,7 +527,7 @@ void cv::viz::InteractorStyle::OnLeftButtonDown()
MouseEvent
::
Type
type
=
(
Interactor
->
GetRepeatCount
()
==
0
)
?
MouseEvent
::
MouseButtonPress
:
MouseEvent
::
MouseDblClick
;
MouseEvent
event
(
type
,
MouseEvent
::
LeftButton
,
p
,
getModifiers
());
if
(
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
Superclass
::
OnLeftButtonDown
();
}
...
...
@@ -535,7 +537,7 @@ void cv::viz::InteractorStyle::OnLeftButtonUp()
Vec2i
p
(
Interactor
->
GetEventPosition
());
MouseEvent
event
(
MouseEvent
::
MouseButtonRelease
,
MouseEvent
::
LeftButton
,
p
,
getModifiers
());
if
(
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
Superclass
::
OnLeftButtonUp
();
}
...
...
@@ -547,7 +549,7 @@ void cv::viz::InteractorStyle::OnMiddleButtonDown()
MouseEvent
::
Type
type
=
(
Interactor
->
GetRepeatCount
()
==
0
)
?
MouseEvent
::
MouseButtonPress
:
MouseEvent
::
MouseDblClick
;
MouseEvent
event
(
type
,
MouseEvent
::
MiddleButton
,
p
,
getModifiers
());
if
(
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
Superclass
::
OnMiddleButtonDown
();
}
...
...
@@ -557,7 +559,7 @@ void cv::viz::InteractorStyle::OnMiddleButtonUp()
Vec2i
p
(
Interactor
->
GetEventPosition
());
MouseEvent
event
(
MouseEvent
::
MouseButtonRelease
,
MouseEvent
::
MiddleButton
,
p
,
getModifiers
());
if
(
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
Superclass
::
OnMiddleButtonUp
();
}
...
...
@@ -569,7 +571,7 @@ void cv::viz::InteractorStyle::OnRightButtonDown()
MouseEvent
::
Type
type
=
(
Interactor
->
GetRepeatCount
()
==
0
)
?
MouseEvent
::
MouseButtonPress
:
MouseEvent
::
MouseDblClick
;
MouseEvent
event
(
type
,
MouseEvent
::
RightButton
,
p
,
getModifiers
());
if
(
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
Superclass
::
OnRightButtonDown
();
}
...
...
@@ -579,7 +581,7 @@ void cv::viz::InteractorStyle::OnRightButtonUp()
Vec2i
p
(
Interactor
->
GetEventPosition
());
MouseEvent
event
(
MouseEvent
::
MouseButtonRelease
,
MouseEvent
::
RightButton
,
p
,
getModifiers
());
if
(
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
Superclass
::
OnRightButtonUp
();
}
...
...
@@ -590,9 +592,9 @@ void cv::viz::InteractorStyle::OnMouseWheelForward()
MouseEvent
event
(
MouseEvent
::
MouseScrollUp
,
MouseEvent
::
VScroll
,
p
,
getModifiers
());
// If a mouse callback registered, call it!
if
(
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
if
(
Interactor
->
GetRepeatCount
()
&&
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
if
(
Interactor
->
GetAltKey
())
{
...
...
@@ -622,10 +624,10 @@ void cv::viz::InteractorStyle::OnMouseWheelBackward()
MouseEvent
event
(
MouseEvent
::
MouseScrollDown
,
MouseEvent
::
VScroll
,
p
,
getModifiers
());
// If a mouse callback registered, call it!
if
(
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
if
(
Interactor
->
GetRepeatCount
()
&&
mouseCallback_
)
mouseCallback_
(
event
,
mouse_callback_cookie_
);
mouseCallback_
(
event
,
mouse_callback_cookie_
);
if
(
Interactor
->
GetAltKey
())
{
...
...
@@ -656,9 +658,3 @@ void cv::viz::InteractorStyle::OnTimer()
renderer_
->
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 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifndef __OPENCV_VIZ_INTERACTOR_STYLE_H__
...
...
@@ -121,9 +118,6 @@ namespace cv
void
(
*
mouseCallback_
)(
const
MouseEvent
&
,
void
*
);
void
*
mouse_callback_cookie_
;
bool
getAltKey
();
bool
getControlKey
();
bool
getShiftKey
();
int
getModifiers
();
};
}
...
...
modules/viz/src/shapes.cpp
View file @
80ab6e88
...
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp"
...
...
@@ -63,7 +60,6 @@ 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
);
line
->
SetPoint2
(
pt2
.
x
,
pt2
.
y
,
pt2
.
z
);
line
->
Update
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
mapper
->
SetInputConnection
(
line
->
GetOutputPort
());
...
...
@@ -165,7 +161,6 @@ cv::viz::WSphere::WSphere(const Point3f ¢er, float radius, int sphere_resolu
sphere
->
SetPhiResolution
(
sphere_resolution
);
sphere
->
SetThetaResolution
(
sphere_resolution
);
sphere
->
LatLongTessellationOff
();
sphere
->
Update
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
mapper
->
SetInputConnection
(
sphere
->
GetOutputPort
());
...
...
@@ -194,44 +189,27 @@ cv::viz::WArrow::WArrow(const Point3f& pt1, const Point3f& pt2, float thickness,
arrowSource
->
SetTipRadius
(
thickness
*
3.0
);
arrowSource
->
SetTipLength
(
thickness
*
10.0
);
float
startPoint
[
3
],
endPoint
[
3
];
startPoint
[
0
]
=
pt1
.
x
;
startPoint
[
1
]
=
pt1
.
y
;
startPoint
[
2
]
=
pt1
.
z
;
endPoint
[
0
]
=
pt2
.
x
;
endPoint
[
1
]
=
pt2
.
y
;
endPoint
[
2
]
=
pt2
.
z
;
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
();
Vec3f
startPoint
(
pt1
.
x
,
pt1
.
y
,
pt1
.
z
),
endPoint
(
pt2
.
x
,
pt2
.
y
,
pt2
.
z
);
Vec3f
arbitrary
(
theRNG
().
uniform
(
-
10.
f
,
10.
f
),
theRNG
().
uniform
(
-
10.
f
,
10.
f
),
theRNG
().
uniform
(
-
10.
f
,
10.
f
));
double
length
=
cv
::
norm
(
endPoint
-
startPoint
);
Vec3f
xvec
=
normalized
(
endPoint
-
startPoint
);
Vec3f
zvec
=
normalized
(
xvec
.
cross
(
arbitrary
));
Vec3f
yvec
=
zvec
.
cross
(
xvec
);
// Create the direction cosine matrix
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
vtkSmartPointer
<
vtkMatrix4x4
>::
New
();
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
,
1
,
normalizedY
[
i
]);
matrix
->
SetElement
(
i
,
2
,
normalizedZ
[
i
]);
matrix
->
SetElement
(
i
,
0
,
xvec
[
i
]);
matrix
->
SetElement
(
i
,
1
,
yvec
[
i
]);
matrix
->
SetElement
(
i
,
2
,
zvec
[
i
]);
}
// Apply the transforms
vtkSmartPointer
<
vtkTransform
>
transform
=
vtkSmartPointer
<
vtkTransform
>::
New
();
transform
->
Translate
(
startPoint
);
transform
->
Translate
(
startPoint
.
val
);
transform
->
Concatenate
(
matrix
);
transform
->
Scale
(
length
,
length
,
length
);
...
...
modules/viz/src/types.cpp
View file @
80ab6e88
...
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp"
...
...
@@ -60,77 +57,80 @@ cv::viz::MouseEvent::MouseEvent(const Type& _type, const MouseButton& _button, c
////////////////////////////////////////////////////////////////////
/// cv::viz::Mesh3d
struct
cv
::
viz
::
Mesh3d
::
loadMeshImpl
namespace
cv
{
namespace
viz
{
namespace
{
st
atic
cv
::
viz
::
Mesh3d
loadMesh
(
const
String
&
file
)
st
ruct
MeshUtils
{
Mesh3d
mesh
;
vtkSmartPointer
<
vtkPLYReader
>
reader
=
vtkSmartPointer
<
vtkPLYReader
>::
New
();
reader
->
SetFileName
(
file
.
c_str
());
reader
->
Update
();
static
Mesh3d
loadMesh
(
const
String
&
file
)
{
Mesh3d
mesh
;
vtkSmartPointer
<
vtkPolyData
>
poly_data
=
reader
->
GetOutput
();
CV_Assert
(
"File does not exist or file format is not supported."
&&
poly_data
);
vtkSmartPointer
<
vtkPLYReader
>
reader
=
vtkSmartPointer
<
vtkPLYReader
>::
New
();
reader
->
SetFileName
(
file
.
c_str
());
reader
->
Update
();
vtkSmartPointer
<
vtkPoints
>
mesh_points
=
poly_data
->
GetPoints
();
vtkIdType
nr_points
=
mesh_points
->
GetNumberOfPoints
(
);
vtkSmartPointer
<
vtkPolyData
>
poly_data
=
reader
->
GetOutput
();
CV_Assert
(
"File does not exist or file format is not supported."
&&
poly_data
);
mesh
.
cloud
.
create
(
1
,
nr_points
,
CV_32FC3
);
vtkSmartPointer
<
vtkPoints
>
mesh_points
=
poly_data
->
GetPoints
();
vtkIdType
nr_points
=
mesh_points
->
GetNumberOfPoints
();
Vec3f
*
mesh_cloud
=
mesh
.
cloud
.
ptr
<
Vec3f
>
();
for
(
vtkIdType
i
=
0
;
i
<
mesh_points
->
GetNumberOfPoints
();
i
++
)
{
Vec3d
point
;
mesh_points
->
GetPoint
(
i
,
point
.
val
);
mesh_cloud
[
i
]
=
point
;
}
mesh
.
cloud
.
create
(
1
,
nr_points
,
CV_32FC3
);
// Then the color information, if any
vtkUnsignedCharArray
*
poly_colors
=
0
;
if
(
poly_data
->
GetPointData
())
poly_colors
=
vtkUnsignedCharArray
::
SafeDownCast
(
poly_data
->
GetPointData
()
->
GetScalars
());
Vec3f
*
mesh_cloud
=
mesh
.
cloud
.
ptr
<
Vec3f
>
();
for
(
vtkIdType
i
=
0
;
i
<
mesh_points
->
GetNumberOfPoints
();
i
++
)
{
Vec3d
point
;
mesh_points
->
GetPoint
(
i
,
point
.
val
);
mesh_cloud
[
i
]
=
point
;
}
if
(
poly_colors
&&
(
poly_colors
->
GetNumberOfComponents
()
==
3
))
{
mesh
.
colors
.
create
(
1
,
nr_points
,
CV_8UC3
);
Vec3b
*
mesh_colors
=
mesh
.
colors
.
ptr
<
cv
::
Vec3b
>
(
);
// Then the color information, if any
vtkUnsignedCharArray
*
poly_colors
=
0
;
if
(
poly_data
->
GetPointData
())
poly_colors
=
vtkUnsignedCharArray
::
SafeDownCast
(
poly_data
->
GetPointData
()
->
GetScalars
()
);
for
(
vtkIdType
i
=
0
;
i
<
mesh_points
->
GetNumberOfPoints
();
i
++
)
if
(
poly_colors
&&
(
poly_colors
->
GetNumberOfComponents
()
==
3
)
)
{
Vec3b
point_color
;
poly_colors
->
GetTupleValue
(
i
,
point_color
.
val
);
mesh
.
colors
.
create
(
1
,
nr_points
,
CV_8UC3
);
Vec3b
*
mesh_colors
=
mesh
.
colors
.
ptr
<
cv
::
Vec3b
>
();
for
(
vtkIdType
i
=
0
;
i
<
mesh_points
->
GetNumberOfPoints
();
i
++
)
{
Vec3b
point_color
;
poly_colors
->
GetTupleValue
(
i
,
point_color
.
val
);
std
::
swap
(
point_color
[
0
],
point_color
[
2
]);
// RGB -> BGR
mesh_colors
[
i
]
=
point_color
;
std
::
swap
(
point_color
[
0
],
point_color
[
2
]);
// RGB -> BGR
mesh_colors
[
i
]
=
point_color
;
}
}
}
else
mesh
.
colors
.
release
();
else
mesh
.
colors
.
release
();
// Now handle the polygons
vtkIdType
*
cell_points
;
vtkIdType
nr_cell_points
;
vtkCellArray
*
mesh_polygons
=
poly_data
->
GetPolys
();
mesh_polygons
->
InitTraversal
();
// Now handle the polygons
vtkIdType
*
cell_points
;
vtkIdType
nr_cell_points
;
vtkCellArray
*
mesh_polygons
=
poly_data
->
GetPolys
();
mesh_polygons
->
InitTraversal
();
mesh
.
polygons
.
create
(
1
,
mesh_polygons
->
GetSize
(),
CV_32SC1
);
mesh
.
polygons
.
create
(
1
,
mesh_polygons
->
GetSize
(),
CV_32SC1
);
int
*
polygons
=
mesh
.
polygons
.
ptr
<
int
>
();
while
(
mesh_polygons
->
GetNextCell
(
nr_cell_points
,
cell_points
))
{
*
polygons
++
=
nr_cell_points
;
for
(
int
i
=
0
;
i
<
nr_cell_points
;
++
i
)
*
polygons
++
=
static_cast
<
int
>
(
cell_points
[
i
]);
}
int
*
polygons
=
mesh
.
polygons
.
ptr
<
int
>
();
while
(
mesh_polygons
->
GetNextCell
(
nr_cell_points
,
cell_points
))
{
*
polygons
++
=
nr_cell_points
;
for
(
int
i
=
0
;
i
<
nr_cell_points
;
++
i
)
*
polygons
++
=
static_cast
<
int
>
(
cell_points
[
i
]);
}
return
mesh
;
}
};
return
mesh
;
}
};
}}}
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 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp"
...
...
@@ -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
);
}
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
();
}
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
::
setBackgroundColor
(
const
Color
&
color
)
{
impl_
->
setBackgroundColor
(
color
);
}
...
...
modules/viz/src/vizimpl.cpp
View file @
80ab6e88
...
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp"
...
...
@@ -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
)
{
renderer_
=
vtkSmartPointer
<
vtkRenderer
>::
New
();
// Create a RendererWindow
window_
=
vtkSmartPointer
<
vtkRenderWindow
>::
New
();
// Set the window size as 1/2 of the screen size
cv
::
Vec2i
window_size
=
cv
::
Vec2i
(
window_
->
GetScreenSize
())
/
2
;
window_
->
SetSize
(
window_size
.
val
);
window_
->
AddRenderer
(
renderer_
);
// Create the interactor style
...
...
@@ -100,11 +94,6 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
interactor_
->
Initialize
();
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_
->
viz_
=
this
;
exit_main_loop_timer_callback_
->
right_timer_id
=
-
1
;
...
...
@@ -116,7 +105,6 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
resetStoppedFlag
();
//////////////////////////////
String
window_name
=
VizStorage
::
generateWindowName
(
name
);
window_
->
SetWindowName
(
window_name
.
c_str
());
...
...
@@ -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
::
setWindowSize
(
int
xw
,
int
yw
)
{
window_
->
SetSize
(
xw
,
yw
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setWindowPosition
(
const
Point
&
position
)
{
window_
->
SetPosition
(
position
.
x
,
position
.
y
);
}
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
]);
}
modules/viz/src/vizimpl.hpp
View file @
80ab6e88
...
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifndef __OPENCV_VIZ_VIZ3D_IMPL_HPP__
...
...
@@ -105,9 +102,9 @@ public:
void
converTo3DRay
(
const
Point3d
&
window_coord
,
Point3d
&
origin
,
Vec3d
&
direction
);
void
saveScreenshot
(
const
String
&
file
);
void
setWindowPosition
(
int
x
,
int
y
);
void
setWindowPosition
(
const
Point
&
position
);
Size
getWindowSize
()
const
;
void
setWindowSize
(
int
xw
,
int
yw
);
void
setWindowSize
(
const
Size
&
window_size
);
void
setFullScreen
(
bool
mode
);
String
getWindowName
()
const
;
void
setBackgroundColor
(
const
Color
&
color
);
...
...
modules/viz/src/widget.cpp
View file @
80ab6e88
...
...
@@ -41,9 +41,6 @@
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp"
...
...
@@ -55,7 +52,6 @@ class cv::viz::Widget::Impl
{
public
:
vtkSmartPointer
<
vtkProp
>
prop
;
Impl
()
:
prop
(
0
)
{}
};
...
...
@@ -63,13 +59,17 @@ cv::viz::Widget::Widget() : 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
)
{
if
(
!
impl_
)
impl_
=
new
Impl
();
if
(
other
.
impl_
)
impl_
->
prop
=
other
.
impl_
->
prop
;
if
(
!
impl_
)
impl_
=
new
Impl
();
if
(
other
.
impl_
)
impl_
->
prop
=
other
.
impl_
->
prop
;
return
*
this
;
}
...
...
@@ -84,45 +84,22 @@ cv::viz::Widget::~Widget()
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
();
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
();
#if VTK_MAJOR_VERSION <= 5
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
->
SetInputConnection
(
reader
->
GetOutputPort
()
);
mapper
->
ImmediateModeRenderingOff
();
actor
->
SetNumberOfCloudPoints
(
int
(
std
::
max
<
vtkIdType
>
(
1
,
data
->
GetNumberOfPoints
()
/
10
))
);
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
(
);
actor
->
GetProperty
()
->
SetInterpolationToFlat
();
actor
->
GetProperty
()
->
BackfaceCullingOn
();
actor
->
SetMapper
(
mapper
);
Widget
widget
;
widget
.
impl_
->
prop
=
actor
;
WidgetAccessor
::
setProp
(
widget
,
actor
)
;
return
widget
;
}
...
...
@@ -133,37 +110,15 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
switch
(
property
)
{
case
POINT_SIZE
:
{
actor
->
GetProperty
()
->
SetPointSize
(
float
(
value
));
actor
->
Modified
();
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
POINT_SIZE
:
actor
->
GetProperty
()
->
SetPointSize
(
float
(
value
));
break
;
case
OPACITY
:
actor
->
GetProperty
()
->
SetOpacity
(
value
);
break
;
case
LINE_WIDTH
:
actor
->
GetProperty
()
->
SetLineWidth
(
float
(
value
));
break
;
case
IMMEDIATE_RENDERING
:
actor
->
GetMapper
()
->
SetImmediateModeRendering
(
int
(
value
));
break
;
case
FONT_SIZE
:
{
vtkTextActor
*
text_actor
=
vtkTextActor
::
SafeDownCast
(
actor
);
CV_Assert
(
"Widget does not have text content."
&&
text_actor
);
vtkSmartPointer
<
vtkTextProperty
>
tprop
=
text_actor
->
GetTextProperty
();
tprop
->
SetFontSize
(
int
(
value
));
text_actor
->
Modified
();
text_actor
->
GetTextProperty
()
->
SetFontSize
(
int
(
value
));
break
;
}
case
REPRESENTATION
:
...
...
@@ -174,7 +129,6 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
case
REPRESENTATION_WIREFRAME
:
actor
->
GetProperty
()
->
SetRepresentationToWireframe
();
break
;
case
REPRESENTATION_SURFACE
:
actor
->
GetProperty
()
->
SetRepresentationToSurface
();
break
;
}
actor
->
Modified
();
break
;
}
case
SHADING
:
...
...
@@ -215,14 +169,12 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
break
;
}
}
actor
->
Modified
();
break
;
}
default
:
CV_Assert
(
"setPointCloudRenderingProperties: Unknown property"
);
}
actor
->
Modified
();
}
double
cv
::
viz
::
Widget
::
getRenderingProperty
(
int
property
)
const
...
...
@@ -233,32 +185,16 @@ double cv::viz::Widget::getRenderingProperty(int property) const
double
value
=
0.0
;
switch
(
property
)
{
case
POINT_SIZE
:
{
value
=
actor
->
GetProperty
()
->
GetPointSize
();
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
POINT_SIZE
:
value
=
actor
->
GetProperty
()
->
GetPointSize
();
break
;
case
OPACITY
:
value
=
actor
->
GetProperty
()
->
GetOpacity
();
break
;
case
LINE_WIDTH
:
value
=
actor
->
GetProperty
()
->
GetLineWidth
();
break
;
case
IMMEDIATE_RENDERING
:
value
=
actor
->
GetMapper
()
->
GetImmediateModeRendering
();
break
;
case
FONT_SIZE
:
{
vtkTextActor
*
text_actor
=
vtkTextActor
::
SafeDownCast
(
actor
);
CV_Assert
(
"Widget does not have text content."
&&
text_actor
);
vtkSmartPointer
<
vtkTextProperty
>
tprop
=
text_actor
->
GetTextProperty
();
value
=
tprop
->
GetFontSize
();
value
=
text_actor
->
GetTextProperty
()
->
GetFontSize
();;
break
;
}
case
REPRESENTATION
:
...
...
@@ -322,7 +258,7 @@ void cv::viz::Widget3D::updatePose(const Affine3f &pose)
if
(
!
matrix
)
{
setPose
(
pose
);
return
;
return
;
}
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