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
91d108f3
Commit
91d108f3
authored
Mar 02, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1569 from paroj:ovisup
parents
7b4cdd5d
a62f9c42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
ovis_demo.py
modules/ovis/samples/ovis_demo.py
+3
-3
ovis.cpp
modules/ovis/src/ovis.cpp
+9
-7
No files found.
modules/ovis/samples/ovis_demo.py
View file @
91d108f3
...
...
@@ -7,19 +7,19 @@ cv.ovis.addResourceLocation("packs/Sinbad.zip")
# camera intrinsics
imsize
=
(
800
,
600
)
K
=
np
.
diag
([
800
,
800
,
1
])
K
[:
2
,
2
]
=
(
400
,
1
00
)
# offset pp
K
[:
2
,
2
]
=
(
400
,
5
00
)
# offset pp
# observer scene
owin
=
cv
.
ovis
.
createWindow
(
"VR"
,
imsize
)
cv
.
ovis
.
createGridMesh
(
"ground"
,
(
10
,
10
),
(
10
,
10
))
owin
.
createEntity
(
"ground"
,
"ground"
,
rot
=
(
1.57
,
0
,
0
))
owin
.
createCameraEntity
(
"cam"
,
K
,
imsize
,
5
)
owin
.
createEntity
(
"figure"
,
"Sinbad.mesh"
,
(
0
,
-
5
,
0
))
# externally defined mesh
owin
.
createEntity
(
"figure"
,
"Sinbad.mesh"
,
tvec
=
(
0
,
-
5
,
0
),
rot
=
(
np
.
pi
,
0
,
0
))
# externally defined mesh
owin
.
createLightEntity
(
"sun"
,
(
0
,
0
,
-
100
))
# interaction scene
iwin
=
cv
.
ovis
.
createWindow
(
"AR"
,
imsize
,
cv
.
ovis
.
SCENE_SEPERATE
|
cv
.
ovis
.
SCENE_INTERACTIVE
)
iwin
.
createEntity
(
"figure"
,
"Sinbad.mesh"
,
(
0
,
-
5
,
0
))
iwin
.
createEntity
(
"figure"
,
"Sinbad.mesh"
,
tvec
=
(
0
,
-
5
,
0
),
rot
=
(
np
.
pi
,
0
,
0
))
iwin
.
createLightEntity
(
"sun"
,
(
0
,
0
,
-
100
))
iwin
.
setCameraIntrinsics
(
K
,
imsize
)
...
...
modules/ovis/src/ovis.cpp
View file @
91d108f3
...
...
@@ -49,12 +49,14 @@ void _createTexture(const String& name, Mat image)
}
static
void
_convertRT
(
InputArray
rot
,
InputArray
tvec
,
Quaternion
&
q
,
Vector3
&
t
,
bool
invert
=
false
)
bool
invert
=
false
,
bool
init
=
false
)
{
CV_Assert
(
rot
.
empty
()
||
rot
.
rows
()
==
3
||
rot
.
size
()
==
Size
(
3
,
3
),
tvec
.
empty
()
||
tvec
.
rows
()
==
3
);
q
=
Quaternion
::
IDENTITY
;
// make sure the entity is oriented by the OpenCV coordinate conventions
// when initialised
q
=
init
?
Quaternion
(
toOGRE
)
:
Quaternion
::
IDENTITY
;
t
=
Vector3
::
ZERO
;
if
(
!
rot
.
empty
())
...
...
@@ -346,7 +348,7 @@ public:
Quaternion
q
;
Vector3
t
;
_convertRT
(
rot
,
tvec
,
q
,
t
);
_convertRT
(
rot
,
tvec
,
q
,
t
,
false
,
true
);
SceneNode
*
node
=
sceneMgr
->
getRootSceneNode
()
->
createChildSceneNode
(
t
,
q
);
node
->
attachObject
(
ent
);
}
...
...
@@ -377,7 +379,7 @@ public:
Quaternion
q
;
Vector3
t
;
_convertRT
(
rot
,
tvec
,
q
,
t
);
_convertRT
(
rot
,
tvec
,
q
,
t
,
false
,
true
);
SceneNode
*
node
=
sceneMgr
->
getRootSceneNode
()
->
createChildSceneNode
(
t
,
q
);
node
->
attachObject
(
cam
);
...
...
@@ -400,7 +402,7 @@ public:
Quaternion
q
;
Vector3
t
;
_convertRT
(
rot
,
tvec
,
q
,
t
);
_convertRT
(
rot
,
tvec
,
q
,
t
,
false
,
true
);
SceneNode
*
node
=
sceneMgr
->
getRootSceneNode
()
->
createChildSceneNode
(
t
,
q
);
node
->
attachObject
(
light
);
}
...
...
@@ -420,7 +422,7 @@ public:
SceneNode
&
node
=
_getSceneNode
(
sceneMgr
,
name
);
Quaternion
q
;
Vector3
t
;
_convertRT
(
rot
,
tvec
,
q
,
t
,
invert
);
_convertRT
(
rot
,
tvec
,
q
,
t
,
invert
,
true
);
node
.
setOrientation
(
q
);
node
.
setPosition
(
t
);
}
...
...
@@ -488,7 +490,7 @@ public:
SceneNode
*
node
=
cam
->
getParentSceneNode
();
Quaternion
q
;
Vector3
t
;
_convertRT
(
rot
,
tvec
,
q
,
t
,
invert
);
_convertRT
(
rot
,
tvec
,
q
,
t
,
invert
,
true
);
if
(
!
rot
.
empty
())
node
->
setOrientation
(
q
);
...
...
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