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
30860958
Commit
30860958
authored
Jan 12, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved background gradient
parent
b0ca93b2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
26 deletions
+20
-26
viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+1
-0
viz3d.cpp
modules/viz/src/viz3d.cpp
+1
-0
vizimpl.cpp
modules/viz/src/vizimpl.cpp
+15
-24
vizimpl.hpp
modules/viz/src/vizimpl.hpp
+1
-1
test_viz3d.cpp
modules/viz/test/test_viz3d.cpp
+2
-1
No files found.
modules/viz/include/opencv2/viz/viz3d.hpp
View file @
30860958
...
...
@@ -100,6 +100,7 @@ namespace cv
void
setFullScreen
(
bool
mode
=
true
);
void
setBackgroundColor
(
const
Color
&
color
=
Color
::
black
());
void
setBackgroundTexture
(
InputArray
image
=
noArray
());
void
setBackgroundGradient
(
const
Color
&
up
,
const
Color
&
down
);
void
setBackgroundMeshLab
();
void
spin
();
...
...
modules/viz/src/viz3d.cpp
View file @
30860958
...
...
@@ -137,6 +137,7 @@ void cv::viz::Viz3d::saveScreenshot(const String &file) { impl_->saveScreenshot(
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
);
}
void
cv
::
viz
::
Viz3d
::
setBackgroundGradient
(
const
Color
&
up
,
const
Color
&
down
)
{
impl_
->
setBackgroundGradient
(
up
,
down
);
}
void
cv
::
viz
::
Viz3d
::
setBackgroundTexture
(
InputArray
image
)
{
impl_
->
setBackgroundTexture
(
image
);
}
void
cv
::
viz
::
Viz3d
::
setBackgroundMeshLab
()
{
impl_
->
setBackgroundMeshLab
();
}
...
...
modules/viz/src/vizimpl.cpp
View file @
30860958
...
...
@@ -302,6 +302,21 @@ void cv::viz::Viz3d::VizImpl::setBackgroundColor(const Color& color)
{
Color
c
=
vtkcolor
(
color
);
renderer_
->
SetBackground
(
c
.
val
);
renderer_
->
GradientBackgroundOff
();
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setBackgroundGradient
(
const
Color
&
up
,
const
Color
&
down
)
{
Color
vtkup
=
vtkcolor
(
up
),
vtkdown
=
vtkcolor
(
down
);
renderer_
->
SetBackground
(
vtkdown
.
val
);
renderer_
->
SetBackground2
(
vtkup
.
val
);
renderer_
->
GradientBackgroundOn
();
}
//////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setBackgroundMeshLab
()
{
setBackgroundGradient
(
Color
(
2
,
1
,
1
),
Color
(
240
,
120
,
120
));
}
//////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -329,30 +344,6 @@ void cv::viz::Viz3d::VizImpl::setBackgroundTexture(InputArray image)
renderer_
->
TexturedBackgroundOn
();
}
//////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setBackgroundMeshLab
()
{
static
Color
up
(
2
,
1
,
1
),
down
(
240
,
120
,
120
);
static
Mat
meshlab_texture
;
if
(
meshlab_texture
.
empty
())
{
meshlab_texture
.
create
(
2048
,
2048
,
CV_8UC4
);
for
(
int
y
=
0
;
y
<
meshlab_texture
.
rows
;
++
y
)
{
double
alpha
=
(
y
+
1
)
/
(
double
)
meshlab_texture
.
rows
;
Vec4b
color
=
up
*
(
1
-
alpha
)
+
down
*
alpha
;
Vec4b
*
row
=
meshlab_texture
.
ptr
<
Vec4b
>
(
y
);
for
(
int
x
=
0
;
x
<
meshlab_texture
.
cols
;
++
x
)
row
[
x
]
=
color
;
}
}
setBackgroundTexture
(
meshlab_texture
);
}
/////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setCamera
(
const
Camera
&
camera
)
{
...
...
modules/viz/src/vizimpl.hpp
View file @
30860958
...
...
@@ -110,7 +110,7 @@ public:
void
setFullScreen
(
bool
mode
);
String
getWindowName
()
const
;
void
setBackgroundColor
(
const
Color
&
color
);
void
setBackgroundGradient
(
const
Color
&
up
,
const
Color
&
down
);
void
setBackgroundTexture
(
InputArray
image
);
void
setBackgroundMeshLab
();
...
...
modules/viz/test/test_viz3d.cpp
View file @
30860958
...
...
@@ -51,8 +51,9 @@ TEST(Viz_viz3d, develop)
//theRNG().fill(mesh.colors, RNG::UNIFORM, 0, 255);
cv
::
viz
::
Viz3d
viz
(
"abc"
);
viz
.
setBackground
Color
(
cv
::
viz
::
Color
::
mlab
()
);
viz
.
setBackground
MeshLab
(
);
viz
.
showWidget
(
"coo"
,
cv
::
viz
::
WCoordinateSystem
(
1
));
viz
.
showWidget
(
"cloud"
,
cv
::
viz
::
WCloud
(
cloud
));
//viz.showWidget("h", cv::viz::Widget::fromPlyFile("d:/horse-red.ply"));
//viz.showWidget("a", cv::viz::WArrow(cv::Point3f(0,0,0), cv::Point3f(1,1,1)));
...
...
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