Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
4c1802a7
Commit
4c1802a7
authored
Feb 05, 2018
by
Pavel Rojtberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ovis: add SCENE_RENDER_FLOAT for rendering float images
useful when uchar precision is not enough
parent
e52c4dbe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
ovis.hpp
modules/ovis/include/opencv2/ovis.hpp
+3
-1
ovis.cpp
modules/ovis/src/ovis.cpp
+23
-3
No files found.
modules/ovis/include/opencv2/ovis.hpp
View file @
4c1802a7
...
...
@@ -23,7 +23,9 @@ enum SceneSettings
/// allow the user to control the camera.
SCENE_INTERACTIVE
=
2
,
/// draw coordinate system crosses for debugging
SCENE_SHOW_CS_CROSS
=
4
SCENE_SHOW_CS_CROSS
=
4
,
/// @ref WindowScene::getScreenshot returns images as CV_32FC4 instead of CV_8UC3
SCENE_RENDER_FLOAT
=
8
,
};
enum
MaterialProperty
...
...
modules/ovis/src/ovis.cpp
View file @
4c1802a7
...
...
@@ -233,6 +233,8 @@ class WindowSceneImpl : public WindowScene
Ptr
<
OgreBites
::
CameraMan
>
camman
;
Ptr
<
Rectangle2D
>
bgplane
;
Ogre
::
RenderTarget
*
frameSrc
;
public
:
WindowSceneImpl
(
Ptr
<
Application
>
app
,
const
String
&
_title
,
const
Size
&
sz
,
int
flags
)
:
title
(
_title
),
root
(
app
->
getRoot
())
...
...
@@ -289,6 +291,18 @@ public:
}
rWin
->
addViewport
(
cam
);
frameSrc
=
rWin
;
if
(
flags
&
SCENE_RENDER_FLOAT
)
{
// also render into an offscreen texture
// currently this draws everything twice, but we spare the float->byte conversion for display
TexturePtr
tex
=
TextureManager
::
getSingleton
().
createManual
(
title
+
"_rt"
,
RESOURCEGROUP_NAME
,
TEX_TYPE_2D
,
sz
.
width
,
sz
.
height
,
0
,
PF_FLOAT32_RGBA
,
TU_RENDERTARGET
);
frameSrc
=
tex
->
getBuffer
()
->
getRenderTarget
();
frameSrc
->
addViewport
(
cam
);
}
}
void
setBackground
(
InputArray
image
)
...
...
@@ -421,11 +435,17 @@ public:
void
getScreenshot
(
OutputArray
frame
)
{
frame
.
create
(
rWin
->
getHeight
(),
rWin
->
getWidth
(),
CV_8UC3
);
PixelFormat
src_type
=
frameSrc
->
suggestPixelFormat
();
int
dst_type
=
src_type
==
PF_BYTE_RGB
?
CV_8UC3
:
CV_32FC4
;
frame
.
create
(
frameSrc
->
getHeight
(),
frameSrc
->
getWidth
(),
dst_type
);
Mat
out
=
frame
.
getMat
();
PixelBox
pb
(
rWin
->
getWidth
(),
rWin
->
getHeight
(),
1
,
PF_BYTE_BGR
,
out
.
ptr
());
rWin
->
copyContentsToMemory
(
pb
,
pb
);
PixelBox
pb
(
frameSrc
->
getWidth
(),
frameSrc
->
getHeight
(),
1
,
src_type
,
out
.
ptr
());
frameSrc
->
copyContentsToMemory
(
pb
,
pb
);
// convert to OpenCV channel order
cvtColor
(
out
,
out
,
dst_type
==
CV_8UC3
?
COLOR_RGB2BGR
:
COLOR_RGBA2BGRA
);
}
void
fixCameraYawAxis
(
bool
useFixed
,
InputArray
_up
)
...
...
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