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
c13febc4
Commit
c13febc4
authored
Mar 15, 2012
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor refactoring CvCapture_OpenNI::CvCapture_OpenNI
parent
36b2ff3c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
18 deletions
+14
-18
cap_openni.cpp
modules/highgui/src/cap_openni.cpp
+14
-18
No files found.
modules/highgui/src/cap_openni.cpp
View file @
c13febc4
...
...
@@ -107,7 +107,7 @@ protected:
IplImage
iplHeader
;
};
static
const
int
outputTypesCount
=
7
;
static
const
int
output
Maps
TypesCount
=
7
;
IplImage
*
retrieveDepthMap
();
IplImage
*
retrievePointCloudMap
();
...
...
@@ -177,7 +177,6 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index )
depthOutputMode
.
nFPS
=
imageOutputMode
.
nFPS
=
30
;
m_isOpened
=
false
;
bool
isContextInitialized
=
false
;
// Initialize and configure the context.
if
(
context
.
Init
()
==
XN_STATUS_OK
)
...
...
@@ -215,26 +214,22 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index )
outfile
.
close
();
status
=
context
.
RunXmlScriptFromFile
(
xmlFilename
.
c_str
()
);
if
(
status
!=
XN_STATUS_OK
)
{
std
::
cerr
<<
"CvCapture_OpenNI::CvCapture_OpenNI : Failed to run xml script: "
<<
std
::
string
(
xnGetStatusString
(
status
))
<<
std
::
endl
;
return
;
}
// Remove temporary configuration file.
remove
(
xmlFilename
.
c_str
()
);
#else
status
=
context
.
RunXmlScript
(
XMLConfig
.
c_str
()
);
#endif
isContextInitialized
=
(
status
==
XN_STATUS_OK
);
}
if
(
status
!=
XN_STATUS_OK
)
{
std
::
cerr
<<
"CvCapture_OpenNI::CvCapture_OpenNI : Failed to run xml script: "
<<
std
::
string
(
xnGetStatusString
(
status
))
<<
std
::
endl
;
return
;
}
if
(
isContextInitialized
)
{
// Associate generators with context.
status
=
depthGenerator
.
Create
(
context
);
if
(
status
!=
XN_STATUS_OK
)
\
if
(
status
!=
XN_STATUS_OK
)
{
std
::
cerr
<<
"CvCapture_OpenNI::CvCapture_OpenNI : Failed to create depth generator: "
<<
std
::
string
(
xnGetStatusString
(
status
))
<<
std
::
endl
;
...
...
@@ -246,10 +241,11 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index )
status
=
context
.
EnumerateExistingNodes
(
Imagelist
,
XN_NODE_TYPE_IMAGE
);
if
(
status
!=
XN_STATUS_OK
)
{
std
::
cerr
<<
"CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate
Image G
enerators: "
std
::
cerr
<<
"CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate
image g
enerators: "
<<
std
::
string
(
xnGetStatusString
(
status
))
<<
std
::
endl
;
return
;
}
if
(
Imagelist
.
IsEmpty
())
{
m_isImageGeneratorPresent
=
FALSE
;
...
...
@@ -257,7 +253,7 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index )
else
{
m_isImageGeneratorPresent
=
TRUE
;
imageGenerator
.
Create
(
context
);
imageGenerator
.
Create
(
context
);
if
(
status
!=
XN_STATUS_OK
)
{
std
::
cerr
<<
"CvCapture_OpenNI::CvCapture_OpenNI : Failed to create image generator: "
...
...
@@ -268,7 +264,7 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index )
// Set map output mode.
CV_Assert
(
depthGenerator
.
SetMapOutputMode
(
depthOutputMode
)
==
XN_STATUS_OK
);
// xn::DepthGenerator supports VGA only! (Jan 2011)
CV_Assert
(
m_isImageGeneratorPresent
?
(
imageGenerator
.
SetMapOutputMode
(
imageOutputMode
)
==
XN_STATUS_OK
)
:
TRUE
);
CV_Assert
(
m_isImageGeneratorPresent
?
(
imageGenerator
.
SetMapOutputMode
(
imageOutputMode
)
==
XN_STATUS_OK
)
:
TRUE
);
// Start generating data.
status
=
context
.
StartGeneratingAll
();
...
...
@@ -285,7 +281,7 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index )
return
;
}
outputMaps
.
resize
(
outputTypesCount
);
outputMaps
.
resize
(
output
Maps
TypesCount
);
m_isOpened
=
true
;
}
...
...
@@ -756,7 +752,7 @@ IplImage* CvCapture_OpenNI::retrieveGrayImage()
IplImage
*
CvCapture_OpenNI
::
retrieveFrame
(
int
outputType
)
{
IplImage
*
image
=
0
;
CV_Assert
(
outputType
<
outputTypesCount
&&
outputType
>=
0
);
CV_Assert
(
outputType
<
output
Maps
TypesCount
&&
outputType
>=
0
);
if
(
outputType
==
CV_CAP_OPENNI_DEPTH_MAP
)
{
...
...
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