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
4979f44c
Commit
4979f44c
authored
Dec 08, 2013
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor
parent
31d42ce1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
163 deletions
+37
-163
viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+0
-3
widget_accessor.hpp
modules/viz/include/opencv2/viz/widget_accessor.hpp
+0
-3
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+28
-25
precomp.cpp
modules/viz/src/precomp.cpp
+0
-3
precomp.hpp
modules/viz/src/precomp.hpp
+0
-3
viz.cpp
modules/viz/src/viz.cpp
+0
-3
viz3d_impl.hpp
modules/viz/src/viz3d_impl.hpp
+2
-2
test_precomp.hpp
modules/viz/test/test_precomp.hpp
+0
-3
test_viz3d.cpp
modules/viz/test/test_viz3d.cpp
+7
-118
No files found.
modules/viz/include/opencv2/viz/viz3d.hpp
View file @
4979f44c
...
...
@@ -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_HPP__
...
...
modules/viz/include/opencv2/viz/widget_accessor.hpp
View file @
4979f44c
...
...
@@ -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_WIDGET_ACCESSOR_HPP__
...
...
modules/viz/include/opencv2/viz/widgets.hpp
View file @
4979f44c
...
...
@@ -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_WIDGETS_HPP__
...
...
@@ -178,43 +175,28 @@ namespace cv
WCube
(
const
Point3f
&
pt_min
,
const
Point3f
&
pt_max
,
bool
wire_frame
=
true
,
const
Color
&
color
=
Color
::
white
());
};
/////////////////////////////////////////////////////////////////////////////
/// Compond widgets
class
CV_EXPORTS
WCoordinateSystem
:
public
Widget3D
{
public
:
WCoordinateSystem
(
float
scale
=
1.
f
);
};
class
CV_EXPORTS
WPolyLine
:
public
Widget3D
{
public
:
WPolyLine
(
InputArray
points
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WGrid
:
public
Widget3D
{
public
:
//! Creates grid at the origin
WGrid
(
const
Vec2i
&
dimensions
,
const
Vec2d
&
spacing
,
const
Color
&
color
=
Color
::
white
());
//! Creates grid based on the plane equation
WGrid
(
const
Vec4f
&
coeffs
,
const
Vec2i
&
dimensions
,
const
Vec2d
&
spacing
,
const
Color
&
color
=
Color
::
white
());
};
/////////////////////////////////////////////////////////////////////////////
/// Text and image widgets
class
CV_EXPORTS
WText
3D
:
public
Widget3
D
class
CV_EXPORTS
WText
:
public
Widget2
D
{
public
:
WText
3D
(
const
String
&
text
,
const
Point3f
&
position
,
float
text_scale
=
1.
f
,
bool
face_camera
=
true
,
const
Color
&
color
=
Color
::
white
());
WText
(
const
String
&
text
,
const
Point2i
&
pos
,
int
font_size
=
20
,
const
Color
&
color
=
Color
::
white
());
void
setText
(
const
String
&
text
);
String
getText
()
const
;
};
class
CV_EXPORTS
WText
:
public
Widget2
D
class
CV_EXPORTS
WText
3D
:
public
Widget3
D
{
public
:
WText
(
const
String
&
text
,
const
Point2i
&
pos
,
int
font_size
=
20
,
const
Color
&
color
=
Color
::
white
());
WText
3D
(
const
String
&
text
,
const
Point3f
&
position
,
float
text_scale
=
1.
f
,
bool
face_camera
=
true
,
const
Color
&
color
=
Color
::
white
());
void
setText
(
const
String
&
text
);
String
getText
()
const
;
...
...
@@ -239,6 +221,24 @@ namespace cv
void
setImage
(
const
Mat
&
image
);
};
/////////////////////////////////////////////////////////////////////////////
/// Compond widgets
class
CV_EXPORTS
WCoordinateSystem
:
public
Widget3D
{
public
:
WCoordinateSystem
(
float
scale
=
1.
f
);
};
class
CV_EXPORTS
WGrid
:
public
Widget3D
{
public
:
//! Creates grid at the origin
WGrid
(
const
Vec2i
&
dimensions
,
const
Vec2d
&
spacing
,
const
Color
&
color
=
Color
::
white
());
//! Creates grid based on the plane equation
WGrid
(
const
Vec4f
&
coeffs
,
const
Vec2i
&
dimensions
,
const
Vec2d
&
spacing
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WCameraPosition
:
public
Widget3D
{
public
:
...
...
@@ -254,6 +254,9 @@ namespace cv
explicit
WCameraPosition
(
const
Vec2f
&
fov
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
};
/////////////////////////////////////////////////////////////////////////////
/// Trajectories
class
CV_EXPORTS
WTrajectory
:
public
Widget3D
{
public
:
...
...
@@ -280,7 +283,7 @@ namespace cv
};
/////////////////////////////////////////////////////////////////////////////
/// Cloud
widget
s
/// Clouds
class
CV_EXPORTS
WCloud
:
public
Widget3D
{
...
...
modules/viz/src/precomp.cpp
View file @
4979f44c
...
...
@@ -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"
modules/viz/src/precomp.hpp
View file @
4979f44c
...
...
@@ -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_PRECOMP_HPP__
...
...
modules/viz/src/viz.cpp
View file @
4979f44c
...
...
@@ -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"
...
...
modules/viz/src/viz3d_impl.hpp
View file @
4979f44c
...
...
@@ -73,10 +73,10 @@ public:
double
getDesiredUpdateRate
();
/** \brief Returns true when the user tried to close the window */
bool
wasStopped
()
const
{
if
(
interactor_
!=
NULL
)
return
(
stopped_
);
else
return
true
;
}
bool
wasStopped
()
const
{
return
interactor_
?
stopped_
:
true
;
}
/** \brief Set the stopped flag back to false */
void
resetStoppedFlag
()
{
if
(
interactor_
!=
NULL
)
stopped_
=
false
;
}
void
resetStoppedFlag
()
{
if
(
interactor_
)
stopped_
=
false
;
}
/** \brief Stop the interaction and close the visualizaton window. */
void
close
()
...
...
modules/viz/test/test_precomp.hpp
View file @
4979f44c
...
...
@@ -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*/
#ifdef __GNUC__
...
...
modules/viz/test/test_viz3d.cpp
View file @
4979f44c
...
...
@@ -41,141 +41,30 @@
//M*/
#include "test_precomp.hpp"
using
namespace
cv
;
static
cv
::
Mat
cvcloud_load
()
{
cv
::
Mat
cloud
(
1
,
20000
,
CV_32FC3
);
std
::
ifstream
ifs
(
"
/Users/nerei
/cloud_dragon.ply"
);
std
::
ifstream
ifs
(
"
d:
/cloud_dragon.ply"
);
std
::
string
str
;
for
(
size_t
i
=
0
;
i
<
11
;
++
i
)
std
::
getline
(
ifs
,
str
);
cv
::
Point3f
*
data
=
cloud
.
ptr
<
cv
::
Point3f
>
();
for
(
size_t
i
=
0
;
i
<
20000
;
++
i
)
for
(
size_t
i
=
0
;
i
<
cloud
.
total
()
;
++
i
)
ifs
>>
data
[
i
].
x
>>
data
[
i
].
y
>>
data
[
i
].
z
;
return
cloud
;
}
bool
constant_cam
=
true
;
cv
::
viz
::
Widget
cam_1
,
cam_coordinates
;
void
keyboard_callback
(
const
viz
::
KeyboardEvent
&
event
,
void
*
cookie
)
{
if
(
event
.
keyDown
())
{
if
(
event
.
getKeySym
()
==
"space"
)
{
viz
::
Viz3d
&
viz
=
*
((
viz
::
Viz3d
*
)
cookie
);
constant_cam
=
!
constant_cam
;
if
(
constant_cam
)
{
viz
.
showWidget
(
"cam_1"
,
cam_1
);
viz
.
showWidget
(
"cam_coordinate"
,
cam_coordinates
);
viz
.
showWidget
(
"cam_text"
,
viz
::
WText
(
"Global View"
,
Point2i
(
5
,
5
),
28
));
viz
.
resetCamera
();
}
else
{
viz
.
showWidget
(
"cam_text"
,
viz
::
WText
(
"Cam View"
,
Point2i
(
5
,
5
),
28
));
viz
.
removeWidget
(
"cam_1"
);
viz
.
removeWidget
(
"cam_coordinate"
);
}
}
}
}
TEST
(
Viz_viz3d
,
develop
)
{
cv
::
Mat
cloud
=
cvcloud_load
();
cv
::
viz
::
Viz3d
viz
(
"abc"
);
cv
::
viz
::
Mesh3d
bunny_mesh
=
cv
::
viz
::
Mesh3d
::
loadMesh
(
"bunny.ply"
);
cv
::
viz
::
WMesh
bunny_widget
(
bunny_mesh
);
bunny_widget
.
setColor
(
cv
::
viz
::
Color
::
cyan
());
cam_1
=
cv
::
viz
::
WCameraPosition
(
cv
::
Vec2f
(
0.6
f
,
0.4
f
),
0.2
,
cv
::
viz
::
Color
::
green
());
cam_coordinates
=
cv
::
viz
::
WCameraPosition
(
0.2
);
viz
.
showWidget
(
"bunny"
,
bunny_widget
);
viz
.
showWidget
(
"cam_1"
,
cam_1
,
viz
::
makeCameraPose
(
Point3f
(
1.
f
,
0.
f
,
0.
f
),
Point3f
(
0.
f
,
0.
f
,
0.
f
),
Point3f
(
0.
f
,
1.
f
,
0.
f
)));
viz
.
showWidget
(
"cam_coordinate"
,
cam_coordinates
,
viz
::
makeCameraPose
(
Point3f
(
1.
f
,
0.
f
,
0.
f
),
Point3f
(
0.
f
,
0.
f
,
0.
f
),
Point3f
(
0.
f
,
1.
f
,
0.
f
)));
std
::
vector
<
Affine3f
>
cam_path
;
for
(
int
i
=
0
,
j
=
0
;
i
<=
360
;
++
i
,
j
+=
5
)
{
cam_path
.
push_back
(
viz
::
makeCameraPose
(
Vec3d
(
0.5
*
cos
(
i
*
CV_PI
/
180.0
),
0.5
*
sin
(
j
*
CV_PI
/
180.0
),
0.5
*
sin
(
i
*
CV_PI
/
180.0
)),
Vec3f
(
0.
f
,
0.
f
,
0.
f
),
Vec3f
(
0.
f
,
1.
f
,
0.
f
)));
}
int
path_counter
=
0
;
int
cam_path_size
=
cam_path
.
size
();
// OTHER WIDGETS
cv
::
Mat
img
=
imread
(
"opencv.png"
);
int
downSample
=
4
;
int
row_max
=
img
.
rows
/
downSample
;
int
col_max
=
img
.
cols
/
downSample
;
cv
::
Mat
*
clouds
=
new
cv
::
Mat
[
img
.
cols
/
downSample
];
cv
::
Mat
*
colors
=
new
cv
::
Mat
[
img
.
cols
/
downSample
];
for
(
int
col
=
0
;
col
<
col_max
;
++
col
)
{
clouds
[
col
]
=
Mat
::
zeros
(
img
.
rows
/
downSample
,
1
,
CV_32FC3
);
colors
[
col
]
=
Mat
::
zeros
(
img
.
rows
/
downSample
,
1
,
CV_8UC3
);
for
(
int
row
=
0
;
row
<
row_max
;
++
row
)
{
clouds
[
col
].
at
<
Vec3f
>
(
row
)
=
Vec3f
(
downSample
*
float
(
col
)
/
img
.
cols
,
1.
f
-
(
downSample
*
float
(
row
)
/
img
.
rows
),
0.
f
);
colors
[
col
].
at
<
Vec3b
>
(
row
)
=
img
.
at
<
Vec3b
>
(
row
*
downSample
,
col
*
downSample
);
}
}
for
(
int
col
=
0
;
col
<
col_max
;
++
col
)
{
std
::
stringstream
strstrm
;
strstrm
<<
"cloud_"
<<
col
;
viz
.
showWidget
(
strstrm
.
str
(),
viz
::
WCloud
(
clouds
[
col
],
colors
[
col
]));
viz
.
getWidget
(
strstrm
.
str
()).
setRenderingProperty
(
viz
::
POINT_SIZE
,
3.0
);
viz
.
getWidget
(
strstrm
.
str
()).
setRenderingProperty
(
viz
::
OPACITY
,
0.45
);
}
viz
.
showWidget
(
"trajectory"
,
viz
::
WTrajectory
(
cam_path
,
viz
::
WTrajectory
::
DISPLAY_PATH
,
viz
::
Color
::
yellow
()));
viz
.
showWidget
(
"cam_text"
,
viz
::
WText
(
"Global View"
,
Point2i
(
5
,
5
),
28
));
viz
.
registerKeyboardCallback
(
keyboard_callback
,
(
void
*
)
&
viz
);
int
angle
=
0
;
while
(
!
viz
.
wasStopped
())
{
if
(
path_counter
==
cam_path_size
)
{
path_counter
=
0
;
}
if
(
!
constant_cam
)
{
viz
.
setViewerPose
(
cam_path
[
path_counter
]);
}
if
(
angle
==
360
)
angle
=
0
;
cam_1
.
cast
<
viz
::
WCameraPosition
>
().
setPose
(
cam_path
[
path_counter
]);
cam_coordinates
.
cast
<
viz
::
WCameraPosition
>
().
setPose
(
cam_path
[
path_counter
++
]);
for
(
int
i
=
0
;
i
<
col_max
;
++
i
)
{
std
::
stringstream
strstrm
;
strstrm
<<
"cloud_"
<<
i
;
viz
.
setWidgetPose
(
strstrm
.
str
(),
Affine3f
().
translate
(
Vec3f
(
-
0.5
f
,
0.
f
,
(
float
)(
-
0.7
+
0.2
*
sin
((
angle
+
i
*
10
)
*
CV_PI
/
180.0
)))));
}
angle
+=
10
;
viz
.
spinOnce
(
42
,
true
);
}
volatile
void
*
a
=
(
void
*
)
&
cvcloud_load
;
(
void
)
a
;
//fixing warnings
cv
::
viz
::
WCloud
c
(
cloud
,
cv
::
Mat
(
cloud
.
size
(),
CV_8UC3
,
cv
::
Scalar
(
0
,
255
,
0
)));
//cv::viz::WCloud c(cloud, cv::viz::Color::bluberry());
viz
.
showWidget
(
"c"
,
c
);
viz
.
spin
();
}
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