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
f3193174
Commit
f3193174
authored
Feb 17, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1555 from paroj:ovisup
parents
2c0eb14f
0520753d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
15 deletions
+43
-15
CMakeLists.txt
modules/ovis/CMakeLists.txt
+8
-2
ovis.hpp
modules/ovis/include/opencv2/ovis.hpp
+6
-0
ovis.cpp
modules/ovis/src/ovis.cpp
+29
-13
No files found.
modules/ovis/CMakeLists.txt
View file @
f3193174
...
...
@@ -5,9 +5,15 @@ find_package(OGRE 1.10 QUIET)
if
(
NOT OGRE_FOUND
)
message
(
STATUS
"Module opencv_ovis disabled because OGRE3D was not found"
)
ocv_module_disable
(
ovis
)
elseif
(
OGRE_VERSION VERSION_LESS 1.10
)
message
(
STATUS
"Module opencv_ovis disabled because
OGRE3D version is less than 1.10
(
${
OGRE_VERSION
}
)"
)
elseif
(
OGRE_VERSION VERSION_LESS 1.10
OR OGRE_VERSION VERSION_GREATER 2.0
)
message
(
STATUS
"Module opencv_ovis disabled because
of incompatible OGRE3D version
(
${
OGRE_VERSION
}
)"
)
ocv_module_disable
(
ovis
)
elseif
(
OGRE_VERSION VERSION_GREATER 1.10
)
# we need C++11 for OGRE 1.11
if
(
MSVC
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/Qstd=c++11"
)
else
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++11"
)
endif
()
endif
()
include_directories
(
${
OGRE_INCLUDE_DIRS
}
}
)
...
...
modules/ovis/include/opencv2/ovis.hpp
View file @
f3193174
...
...
@@ -70,6 +70,12 @@ public:
CV_WRAP
virtual
void
createEntity
(
const
String
&
name
,
const
String
&
meshname
,
InputArray
tvec
=
noArray
(),
InputArray
rot
=
noArray
())
=
0
;
/**
* remove an entity from the scene
* @param name entity name
*/
CV_WRAP
virtual
void
removeEntity
(
const
String
&
name
)
=
0
;
/**
* convenience method to visualize a camera position
*
...
...
modules/ovis/src/ovis.cpp
View file @
f3193174
...
...
@@ -107,13 +107,13 @@ static void _setCameraIntrinsics(Camera* cam, InputArray _K, const Size& imsize)
cam
->
setFrustumOffset
(
toOGRE_SS
*
Vector2
(
pp_offset
.
val
));
}
static
SceneNode
*
_getSceneNode
(
SceneManager
*
sceneMgr
,
const
String
&
name
)
static
SceneNode
&
_getSceneNode
(
SceneManager
*
sceneMgr
,
const
String
&
name
)
{
MovableObject
*
mo
=
NULL
;
try
{
mo
=
sceneMgr
->
get
Camera
(
name
);
mo
=
sceneMgr
->
get
MovableObject
(
name
,
"Camera"
);
}
catch
(
ItemIdentityException
&
)
{
...
...
@@ -123,7 +123,7 @@ static SceneNode* _getSceneNode(SceneManager* sceneMgr, const String& name)
try
{
if
(
!
mo
)
mo
=
sceneMgr
->
get
Light
(
name
);
mo
=
sceneMgr
->
get
MovableObject
(
name
,
"Light"
);
}
catch
(
ItemIdentityException
&
)
{
...
...
@@ -131,9 +131,9 @@ static SceneNode* _getSceneNode(SceneManager* sceneMgr, const String& name)
}
if
(
!
mo
)
mo
=
sceneMgr
->
get
Entity
(
name
);
mo
=
sceneMgr
->
get
MovableObject
(
name
,
"Entity"
);
// throws if not found
return
mo
->
getParentSceneNode
();
return
*
mo
->
getParentSceneNode
();
}
struct
Application
:
public
OgreBites
::
ApplicationContext
,
public
OgreBites
::
InputListener
...
...
@@ -323,12 +323,21 @@ public:
Pass
*
rpass
=
bgplane
->
getMaterial
()
->
getBestTechnique
()
->
getPasses
()[
0
];
rpass
->
getTextureUnitStates
()[
0
]
->
setTextureName
(
name
);
// ensure bgplane is visible
bgplane
->
setVisible
(
true
);
}
void
setBackground
(
const
Scalar
&
color
)
{
Mat
img
(
1
,
1
,
CV_8UC3
,
color
);
setBackground
(
img
);
// hide background plane
bgplane
->
setVisible
(
false
);
// BGRA as uchar
ColourValue
_color
=
ColourValue
(
color
[
2
],
color
[
1
],
color
[
0
],
color
[
3
])
/
255
;
rWin
->
getViewport
(
0
)
->
setBackgroundColour
(
_color
);
if
(
frameSrc
!=
rWin
)
frameSrc
->
getViewport
(
0
)
->
setBackgroundColour
(
_color
);
}
void
createEntity
(
const
String
&
name
,
const
String
&
meshname
,
InputArray
tvec
,
InputArray
rot
)
...
...
@@ -342,6 +351,13 @@ public:
node
->
attachObject
(
ent
);
}
void
removeEntity
(
const
String
&
name
)
{
SceneNode
&
node
=
_getSceneNode
(
sceneMgr
,
name
);
node
.
getAttachedObject
(
name
)
->
detachFromParent
();
sceneMgr
->
destroyEntity
(
name
);
sceneMgr
->
destroySceneNode
(
&
node
);
}
Rect2d
createCameraEntity
(
const
String
&
name
,
InputArray
K
,
const
Size
&
imsize
,
float
zFar
,
InputArray
tvec
,
InputArray
rot
)
{
...
...
@@ -391,22 +407,22 @@ public:
void
updateEntityPose
(
const
String
&
name
,
InputArray
tvec
,
InputArray
rot
)
{
SceneNode
*
node
=
_getSceneNode
(
sceneMgr
,
name
);
SceneNode
&
node
=
_getSceneNode
(
sceneMgr
,
name
);
Quaternion
q
;
Vector3
t
;
_convertRT
(
rot
,
tvec
,
q
,
t
);
node
->
rotate
(
q
,
Ogre
::
Node
::
TS_LOCAL
);
node
->
translate
(
t
,
Ogre
::
Node
::
TS_LOCAL
);
node
.
rotate
(
q
,
Ogre
::
Node
::
TS_LOCAL
);
node
.
translate
(
t
,
Ogre
::
Node
::
TS_LOCAL
);
}
void
setEntityPose
(
const
String
&
name
,
InputArray
tvec
,
InputArray
rot
,
bool
invert
)
{
SceneNode
*
node
=
_getSceneNode
(
sceneMgr
,
name
);
SceneNode
&
node
=
_getSceneNode
(
sceneMgr
,
name
);
Quaternion
q
;
Vector3
t
;
_convertRT
(
rot
,
tvec
,
q
,
t
,
invert
);
node
->
setOrientation
(
q
);
node
->
setPosition
(
t
);
node
.
setOrientation
(
q
);
node
.
setPosition
(
t
);
}
void
_createBackground
()
...
...
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