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
c1a6cb62
Commit
c1a6cb62
authored
Mar 21, 2012
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added oni-files reading
parent
82a2a50f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
25 deletions
+46
-25
cap_openni.cpp
modules/highgui/src/cap_openni.cpp
+0
-0
openni_capture.cpp
samples/cpp/openni_capture.cpp
+46
-25
No files found.
modules/highgui/src/cap_openni.cpp
View file @
c1a6cb62
This diff is collapsed.
Click to expand it.
samples/cpp/openni_capture.cpp
View file @
c1a6cb62
...
...
@@ -93,9 +93,11 @@ void printCommandLineParams()
cout
<<
"-m Mask to set which output images are need. It is a string of size 5. Each element of this is '0' or '1' and"
<<
endl
;
cout
<<
" determine: is depth map, disparity map, valid pixels mask, rgb image, gray image need or not (correspondently)?"
<<
endl
;
cout
<<
" By default -m 01010 i.e. disparity map and rgb image will be shown."
<<
endl
;
cout
<<
"-r Filename of .oni video file. The data will grabbed from it."
<<
endl
;
}
void
parseCommandLine
(
int
argc
,
char
*
argv
[],
bool
&
isColorizeDisp
,
bool
&
isFixedMaxDisp
,
int
&
imageMode
,
bool
retrievedImageFlags
[]
)
void
parseCommandLine
(
int
argc
,
char
*
argv
[],
bool
&
isColorizeDisp
,
bool
&
isFixedMaxDisp
,
int
&
imageMode
,
bool
retrievedImageFlags
[],
string
&
filename
,
bool
&
isFileReading
)
{
// set defaut values
isColorizeDisp
=
true
;
...
...
@@ -108,6 +110,9 @@ void parseCommandLine( int argc, char* argv[], bool& isColorizeDisp, bool& isFix
retrievedImageFlags
[
3
]
=
true
;
retrievedImageFlags
[
4
]
=
false
;
filename
.
clear
();
isFileReading
=
false
;
if
(
argc
==
1
)
{
help
();
...
...
@@ -154,6 +159,11 @@ void parseCommandLine( int argc, char* argv[], bool& isColorizeDisp, bool& isFix
exit
(
0
);
}
}
else
if
(
!
strcmp
(
argv
[
i
],
"-r"
)
)
{
filename
=
argv
[
++
i
];
isFileReading
=
true
;
}
else
{
cout
<<
"Unsupported command line argument: "
<<
argv
[
i
]
<<
"."
<<
endl
;
...
...
@@ -172,10 +182,17 @@ int main( int argc, char* argv[] )
bool
isColorizeDisp
,
isFixedMaxDisp
;
int
imageMode
;
bool
retrievedImageFlags
[
5
];
parseCommandLine
(
argc
,
argv
,
isColorizeDisp
,
isFixedMaxDisp
,
imageMode
,
retrievedImageFlags
);
string
filename
;
bool
isVideoReading
;
parseCommandLine
(
argc
,
argv
,
isColorizeDisp
,
isFixedMaxDisp
,
imageMode
,
retrievedImageFlags
,
filename
,
isVideoReading
);
cout
<<
"Device opening ..."
<<
endl
;
VideoCapture
capture
(
CV_CAP_OPENNI
);
VideoCapture
capture
;
if
(
isVideoReading
)
capture
.
open
(
filename
);
else
capture
.
open
(
CV_CAP_OPENNI
);
cout
<<
"done."
<<
endl
;
if
(
!
capture
.
isOpened
()
)
...
...
@@ -184,37 +201,41 @@ int main( int argc, char* argv[] )
return
-
1
;
}
bool
modeRes
=
false
;
switch
(
imageMode
)
if
(
!
isVideoReading
)
{
case
0
:
modeRes
=
capture
.
set
(
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE
,
CV_CAP_OPENNI_VGA_30HZ
);
break
;
case
1
:
modeRes
=
capture
.
set
(
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE
,
CV_CAP_OPENNI_SXGA_15HZ
);
break
;
case
2
:
modeRes
=
capture
.
set
(
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE
,
CV_CAP_OPENNI_SXGA_30HZ
);
break
;
default:
CV_Error
(
CV_StsBadArg
,
"Unsupported image mode property.
\n
"
);
bool
modeRes
=
false
;
switch
(
imageMode
)
{
case
0
:
modeRes
=
capture
.
set
(
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE
,
CV_CAP_OPENNI_VGA_30HZ
);
break
;
case
1
:
modeRes
=
capture
.
set
(
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE
,
CV_CAP_OPENNI_SXGA_15HZ
);
break
;
case
2
:
modeRes
=
capture
.
set
(
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE
,
CV_CAP_OPENNI_SXGA_30HZ
);
break
;
default:
CV_Error
(
CV_StsBadArg
,
"Unsupported image mode property.
\n
"
);
}
if
(
!
modeRes
)
cout
<<
"
\n
This image mode is not supported by the device, the default value (CV_CAP_OPENNI_SXGA_15HZ) will be used.
\n
"
<<
endl
;
}
if
(
!
modeRes
)
cout
<<
"
\n
This image mode is not supported by the device, the default value (CV_CAP_OPENNI_SXGA_15HZ) will be used.
\n
"
<<
endl
;
// Print some avalible device settings.
cout
<<
"
\n
Depth generator output mode:"
<<
endl
<<
"FRAME_WIDTH "
<<
capture
.
get
(
CV_CAP_PROP_FRAME_WIDTH
)
<<
endl
<<
"FRAME_HEIGHT "
<<
capture
.
get
(
CV_CAP_PROP_FRAME_HEIGHT
)
<<
endl
<<
"FRAME_MAX_DEPTH "
<<
capture
.
get
(
CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH
)
<<
" mm"
<<
endl
<<
"FPS "
<<
capture
.
get
(
CV_CAP_PROP_FPS
)
<<
endl
;
"FRAME_WIDTH "
<<
capture
.
get
(
CV_CAP_PROP_FRAME_WIDTH
)
<<
endl
<<
"FRAME_HEIGHT "
<<
capture
.
get
(
CV_CAP_PROP_FRAME_HEIGHT
)
<<
endl
<<
"FRAME_MAX_DEPTH "
<<
capture
.
get
(
CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH
)
<<
" mm"
<<
endl
<<
"FPS "
<<
capture
.
get
(
CV_CAP_PROP_FPS
)
<<
endl
<<
"REGISTRATION "
<<
capture
.
get
(
CV_CAP_PROP_OPENNI_REGISTRATION
)
<<
endl
;
if
(
capture
.
get
(
CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT
)
)
{
cout
<<
"
\n
Image generator output mode:"
<<
endl
<<
"FRAME_WIDTH
"
<<
capture
.
get
(
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_PROP_FRAME_WIDTH
)
<<
endl
<<
"FRAME_HEIGHT
"
<<
capture
.
get
(
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_PROP_FRAME_HEIGHT
)
<<
endl
<<
"FPS "
<<
capture
.
get
(
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_PROP_FPS
)
<<
endl
;
"FRAME_WIDTH "
<<
capture
.
get
(
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_PROP_FRAME_WIDTH
)
<<
endl
<<
"FRAME_HEIGHT "
<<
capture
.
get
(
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_PROP_FRAME_HEIGHT
)
<<
endl
<<
"FPS
"
<<
capture
.
get
(
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_PROP_FPS
)
<<
endl
;
}
else
{
...
...
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