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
b64bb958
Commit
b64bb958
authored
Jul 13, 2011
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added ability to reset view point of depth generator to normal one (#1195)
parent
4d8a261d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
23 deletions
+50
-23
highgui_c.h
modules/highgui/include/opencv2/highgui/highgui_c.h
+4
-1
cap_openni.cpp
modules/highgui/src/cap_openni.cpp
+46
-22
No files found.
modules/highgui/include/opencv2/highgui/highgui_c.h
View file @
b64bb958
...
...
@@ -360,7 +360,10 @@ enum
CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH
=
101
,
// in mm
CV_CAP_PROP_OPENNI_BASELINE
=
102
,
// in mm
CV_CAP_PROP_OPENNI_FOCAL_LENGTH
=
103
,
// in pixels
CV_CAP_PROP_OPENNI_REGISTRATION_ON
=
104
,
// flag
CV_CAP_PROP_OPENNI_REGISTRATION_ON
=
104
,
// flag
CV_CAP_PROP_OPENNI_REGISTRATION
=
CV_CAP_PROP_OPENNI_REGISTRATION_ON
,
// flag that synchronizes the remapping depth map to image map
// by changing depth generator's view point (if the flag is "on") or
// sets this view point to its normal one (if the flag is "off").
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE
=
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_PROP_OPENNI_OUTPUT_MODE
,
CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE
=
CV_CAP_OPENNI_DEPTH_GENERATOR
+
CV_CAP_PROP_OPENNI_BASELINE
,
CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH
=
CV_CAP_OPENNI_DEPTH_GENERATOR
+
CV_CAP_PROP_OPENNI_FOCAL_LENGTH
,
...
...
modules/highgui/src/cap_openni.cpp
View file @
b64bb958
...
...
@@ -228,7 +228,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
(
imageGenerator
.
SetMapOutputMode
(
imageOutputMode
)
==
XN_STATUS_OK
);
CV_Assert
(
depthGenerator
.
GetAlternativeViewPointCap
().
SetViewPoint
(
imageGenerator
)
==
XN_STATUS_OK
);
CV_Assert
(
setProperty
(
CV_CAP_PROP_OPENNI_REGISTRATION
,
1.0
)
);
// Start generating data.
status
=
context
.
StartGeneratingAll
();
...
...
@@ -360,30 +360,48 @@ double CvCapture_OpenNI::getDepthGeneratorProperty( int propIdx )
bool
CvCapture_OpenNI
::
setDepthGeneratorProperty
(
int
propIdx
,
double
propValue
)
{
bool
res
=
false
;
CV_Assert
(
depthGenerator
.
IsValid
()
);
switch
(
propIdx
)
switch
(
propIdx
)
{
case
CV_CAP_PROP_OPENNI_REGISTRATION
_ON
:
case
CV_CAP_PROP_OPENNI_REGISTRATION
:
{
CV_Assert
(
imageGenerator
.
IsValid
()
);
if
(
!
depthGenerator
.
GetAlternativeViewPointCap
().
IsViewPointAs
(
imageGenerator
))
if
(
propValue
!=
0.0
)
// "on"
{
if
(
depthGenerator
.
GetAlternativeViewPointCap
().
IsViewPointSupported
(
imageGenerator
))
CV_Assert
(
imageGenerator
.
IsValid
()
);
if
(
!
depthGenerator
.
GetAlternativeViewPointCap
().
IsViewPointAs
(
imageGenerator
)
)
{
XnStatus
status
=
depthGenerator
.
GetAlternativeViewPointCap
().
SetViewPoint
(
imageGenerator
);
if
(
status
!=
XN_STATUS_OK
)
CV_Error
(
CV_StsError
,
std
::
string
(
"turning registration on failed. Reason: "
)
+
xnGetStatusString
(
status
));
if
(
depthGenerator
.
GetAlternativeViewPointCap
().
IsViewPointSupported
(
imageGenerator
)
)
{
XnStatus
status
=
depthGenerator
.
GetAlternativeViewPointCap
().
SetViewPoint
(
imageGenerator
);
if
(
status
!=
XN_STATUS_OK
)
std
::
cerr
<<
"CvCapture_OpenNI::setDepthGeneratorProperty : "
<<
xnGetStatusString
(
status
)
<<
std
::
endl
;
else
res
=
true
;
}
else
std
::
cerr
<<
"CvCapture_OpenNI::setDepthGeneratorProperty : Unsupported viewpoint."
<<
std
::
endl
;
}
else
CV_Error
(
CV_StsError
,
"turning registration on failed. Reason: unsupported viewpoint"
);
res
=
true
;
}
else
// "off"
{
XnStatus
status
=
depthGenerator
.
GetAlternativeViewPointCap
().
ResetViewPoint
();
if
(
status
!=
XN_STATUS_OK
)
std
::
cerr
<<
"CvCapture_OpenNI::setDepthGeneratorProperty : "
<<
xnGetStatusString
(
status
)
<<
std
::
endl
;
else
res
=
true
;
}
}
return
true
;
break
;
default
:
CV_Error
(
CV_StsBadArg
,
"
Depth generator does not support such parameter for setting
.
\n
"
);
CV_Error
(
CV_StsBadArg
,
"
Unsupported depth generator property
.
\n
"
);
}
return
false
;
return
res
;
}
double
CvCapture_OpenNI
::
getImageGeneratorProperty
(
int
propIdx
)
...
...
@@ -414,10 +432,13 @@ bool CvCapture_OpenNI::setImageGeneratorProperty( int propIdx, double propValue
bool
res
=
false
;
CV_Assert
(
imageGenerator
.
IsValid
()
);
XnMapOutputMode
newImageOutputMode
=
imageOutputMode
;
switch
(
propIdx
)
{
case
CV_CAP_PROP_OPENNI_OUTPUT_MODE
:
{
XnMapOutputMode
newImageOutputMode
=
imageOutputMode
;
switch
(
cvRound
(
propValue
)
)
{
case
CV_CAP_OPENNI_VGA_30HZ
:
...
...
@@ -433,16 +454,19 @@ bool CvCapture_OpenNI::setImageGeneratorProperty( int propIdx, double propValue
default
:
CV_Error
(
CV_StsBadArg
,
"Unsupported image generator output mode.
\n
"
);
}
break
;
default
:
CV_Error
(
CV_StsBadArg
,
"Image generator does not support such parameter for setting.
\n
"
);
XnStatus
status
=
imageGenerator
.
SetMapOutputMode
(
newImageOutputMode
);
if
(
status
!=
XN_STATUS_OK
)
std
::
cerr
<<
"CvCapture_OpenNI::setImageGeneratorProperty : "
<<
xnGetStatusString
(
status
)
<<
std
::
endl
;
else
{
imageOutputMode
=
newImageOutputMode
;
res
=
true
;
}
break
;
}
if
(
imageGenerator
.
SetMapOutputMode
(
newImageOutputMode
)
==
XN_STATUS_OK
)
{
imageOutputMode
=
newImageOutputMode
;
res
=
true
;
default
:
CV_Error
(
CV_StsBadArg
,
"Unsupported image generator property.
\n
"
);
}
return
res
;
...
...
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