Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
6b511751
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6b511751
编写于
6月 28, 2016
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6619 from Slonegg:openni2_ir_stream
上级
86b54a52
f9e67418
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
393 addition
and
174 deletion
+393
-174
modules/videoio/include/opencv2/videoio.hpp
modules/videoio/include/opencv2/videoio.hpp
+10
-4
modules/videoio/include/opencv2/videoio/videoio_c.h
modules/videoio/include/opencv2/videoio/videoio_c.h
+8
-2
modules/videoio/src/cap_openni2.cpp
modules/videoio/src/cap_openni2.cpp
+315
-151
samples/cpp/openni_capture.cpp
samples/cpp/openni_capture.cpp
+60
-17
未找到文件。
modules/videoio/include/opencv2/videoio.hpp
浏览文件 @
6b511751
...
...
@@ -162,7 +162,8 @@ enum { CAP_PROP_DC1394_OFF = -4, //turn the feature off (not cont
// OpenNI map generators
enum
{
CAP_OPENNI_DEPTH_GENERATOR
=
1
<<
31
,
CAP_OPENNI_IMAGE_GENERATOR
=
1
<<
30
,
CAP_OPENNI_GENERATORS_MASK
=
CAP_OPENNI_DEPTH_GENERATOR
+
CAP_OPENNI_IMAGE_GENERATOR
CAP_OPENNI_IR_GENERATOR
=
1
<<
29
,
CAP_OPENNI_GENERATORS_MASK
=
CAP_OPENNI_DEPTH_GENERATOR
+
CAP_OPENNI_IMAGE_GENERATOR
+
CAP_OPENNI_IR_GENERATOR
};
// Properties of cameras available through OpenNI interfaces
...
...
@@ -183,13 +184,15 @@ enum { CAP_PROP_OPENNI_OUTPUT_MODE = 100,
CAP_PROP_OPENNI2_MIRROR
=
111
};
// OpenNI shortc
a
ts
// OpenNI shortc
u
ts
enum
{
CAP_OPENNI_IMAGE_GENERATOR_PRESENT
=
CAP_OPENNI_IMAGE_GENERATOR
+
CAP_PROP_OPENNI_GENERATOR_PRESENT
,
CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE
=
CAP_OPENNI_IMAGE_GENERATOR
+
CAP_PROP_OPENNI_OUTPUT_MODE
,
CAP_OPENNI_DEPTH_GENERATOR_PRESENT
=
CAP_OPENNI_DEPTH_GENERATOR
+
CAP_PROP_OPENNI_GENERATOR_PRESENT
,
CAP_OPENNI_DEPTH_GENERATOR_BASELINE
=
CAP_OPENNI_DEPTH_GENERATOR
+
CAP_PROP_OPENNI_BASELINE
,
CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH
=
CAP_OPENNI_DEPTH_GENERATOR
+
CAP_PROP_OPENNI_FOCAL_LENGTH
,
CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
=
CAP_OPENNI_DEPTH_GENERATOR
+
CAP_PROP_OPENNI_REGISTRATION
,
CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON
=
CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON
=
CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
,
CAP_OPENNI_IR_GENERATOR_PRESENT
=
CAP_OPENNI_IR_GENERATOR
+
CAP_PROP_OPENNI_GENERATOR_PRESENT
,
};
// OpenNI data given from depth generator
...
...
@@ -201,7 +204,10 @@ enum { CAP_OPENNI_DEPTH_MAP = 0, // Depth values in mm (CV_16UC1)
// Data given from RGB image generator
CAP_OPENNI_BGR_IMAGE
=
5
,
CAP_OPENNI_GRAY_IMAGE
=
6
CAP_OPENNI_GRAY_IMAGE
=
6
,
// Data given from IR image generator
CAP_OPENNI_IR_IMAGE
=
7
};
// Supported output modes of OpenNI image generator
...
...
modules/videoio/include/opencv2/videoio/videoio_c.h
浏览文件 @
6b511751
...
...
@@ -200,7 +200,8 @@ enum
// OpenNI map generators
CV_CAP_OPENNI_DEPTH_GENERATOR
=
1
<<
31
,
CV_CAP_OPENNI_IMAGE_GENERATOR
=
1
<<
30
,
CV_CAP_OPENNI_GENERATORS_MASK
=
CV_CAP_OPENNI_DEPTH_GENERATOR
+
CV_CAP_OPENNI_IMAGE_GENERATOR
,
CV_CAP_OPENNI_IR_GENERATOR
=
1
<<
29
,
CV_CAP_OPENNI_GENERATORS_MASK
=
CV_CAP_OPENNI_DEPTH_GENERATOR
+
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_OPENNI_IR_GENERATOR
,
// Properties of cameras available through OpenNI interfaces
CV_CAP_PROP_OPENNI_OUTPUT_MODE
=
100
,
...
...
@@ -222,10 +223,12 @@ enum
CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT
=
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_PROP_OPENNI_GENERATOR_PRESENT
,
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE
=
CV_CAP_OPENNI_IMAGE_GENERATOR
+
CV_CAP_PROP_OPENNI_OUTPUT_MODE
,
CV_CAP_OPENNI_DEPTH_GENERATOR_PRESENT
=
CV_CAP_OPENNI_DEPTH_GENERATOR
+
CV_CAP_PROP_OPENNI_GENERATOR_PRESENT
,
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
,
CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
=
CV_CAP_OPENNI_DEPTH_GENERATOR
+
CV_CAP_PROP_OPENNI_REGISTRATION
,
CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON
=
CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
,
CV_CAP_OPENNI_IR_GENERATOR_PRESENT
=
CV_CAP_OPENNI_IR_GENERATOR
+
CV_CAP_PROP_OPENNI_GENERATOR_PRESENT
,
// Properties of cameras available through GStreamer interface
CV_CAP_GSTREAMER_QUEUE_LENGTH
=
200
,
// default is 1
...
...
@@ -454,7 +457,10 @@ enum
// Data given from RGB image generator.
CV_CAP_OPENNI_BGR_IMAGE
=
5
,
CV_CAP_OPENNI_GRAY_IMAGE
=
6
CV_CAP_OPENNI_GRAY_IMAGE
=
6
,
// Data given from IR image generator.
CV_CAP_OPENNI_IR_IMAGE
=
7
};
// Supported output modes of OpenNI image generator
...
...
modules/videoio/src/cap_openni2.cpp
浏览文件 @
6b511751
此差异已折叠。
点击以展开。
samples/cpp/openni_capture.cpp
浏览文件 @
6b511751
...
...
@@ -21,6 +21,8 @@ static void help()
"2.) Data given from RGB image generator
\n
"
" CAP_OPENNI_BGR_IMAGE - color image (CV_8UC3)
\n
"
" CAP_OPENNI_GRAY_IMAGE - gray image (CV_8UC1)
\n
"
"2.) Data given from IR image generator
\n
"
" CAP_OPENNI_IR_IMAGE - gray image (CV_16UC1)
\n
"
<<
endl
;
}
...
...
@@ -92,8 +94,8 @@ static void printCommandLineParams()
cout
<<
"-mode= image mode: resolution and fps, supported three values: 0 - CAP_OPENNI_VGA_30HZ, 1 - CAP_OPENNI_SXGA_15HZ,"
<<
endl
;
cout
<<
" 2 - CAP_OPENNI_SXGA_30HZ (0 by default). Ignored if rgb image or gray image are not selected to show."
<<
endl
;
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
<<
" determine: is depth map, disparity map, valid pixels mask, rgb image, gray image need or not (correspondently)
, ir image
"
<<
endl
;
cout
<<
" By default -m=01010
0
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
;
}
...
...
@@ -101,7 +103,7 @@ static void parseCommandLine( int argc, char* argv[], bool& isColorizeDisp, bool
string
&
filename
,
bool
&
isFileReading
)
{
filename
.
clear
();
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{h help||}{cd|1|}{fmd|0|}{mode|
0|}{m|0101
0|}{r||}"
);
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{h help||}{cd|1|}{fmd|0|}{mode|
-1|}{m|01010
0|}{r||}"
);
if
(
parser
.
has
(
"h"
))
{
help
();
...
...
@@ -121,14 +123,14 @@ static void parseCommandLine( int argc, char* argv[], bool& isColorizeDisp, bool
help
();
exit
(
-
1
);
}
if
(
flags
%
100000
==
0
)
if
(
flags
%
100000
0
==
0
)
{
cout
<<
"No one output image is selected."
<<
endl
;
exit
(
0
);
}
for
(
int
i
=
0
;
i
<
5
;
i
++
)
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
retrievedImageFlags
[
4
-
i
]
=
(
flags
%
10
!=
0
);
retrievedImageFlags
[
5
-
i
]
=
(
flags
%
10
!=
0
);
flags
/=
10
;
}
}
...
...
@@ -141,7 +143,7 @@ int main( int argc, char* argv[] )
{
bool
isColorizeDisp
,
isFixedMaxDisp
;
int
imageMode
;
bool
retrievedImageFlags
[
5
];
bool
retrievedImageFlags
[
6
];
string
filename
;
bool
isVideoReading
;
parseCommandLine
(
argc
,
argv
,
isColorizeDisp
,
isFixedMaxDisp
,
imageMode
,
retrievedImageFlags
,
filename
,
isVideoReading
);
...
...
@@ -165,7 +167,7 @@ int main( int argc, char* argv[] )
return
-
1
;
}
if
(
!
isVideoReading
)
if
(
!
isVideoReading
&&
imageMode
>=
0
)
{
bool
modeRes
=
false
;
switch
(
imageMode
)
...
...
@@ -193,13 +195,35 @@ int main( int argc, char* argv[] )
cout
<<
"
\n
This image mode is not supported by the device, the default value (CV_CAP_OPENNI_SXGA_15HZ) will be used.
\n
"
<<
endl
;
}
// turn on depth, color and IR if needed
if
(
retrievedImageFlags
[
0
]
||
retrievedImageFlags
[
1
]
||
retrievedImageFlags
[
2
])
capture
.
set
(
CAP_OPENNI_DEPTH_GENERATOR_PRESENT
,
true
);
else
capture
.
set
(
CAP_OPENNI_DEPTH_GENERATOR_PRESENT
,
false
);
if
(
retrievedImageFlags
[
3
]
||
retrievedImageFlags
[
4
])
capture
.
set
(
CAP_OPENNI_IMAGE_GENERATOR_PRESENT
,
true
);
else
capture
.
set
(
CAP_OPENNI_IMAGE_GENERATOR_PRESENT
,
false
);
if
(
retrievedImageFlags
[
5
])
capture
.
set
(
CAP_OPENNI_IR_GENERATOR_PRESENT
,
true
);
else
capture
.
set
(
CAP_OPENNI_IR_GENERATOR_PRESENT
,
false
);
// Print some avalible device settings.
cout
<<
"
\n
Depth generator output mode:"
<<
endl
<<
"FRAME_WIDTH "
<<
capture
.
get
(
CAP_PROP_FRAME_WIDTH
)
<<
endl
<<
"FRAME_HEIGHT "
<<
capture
.
get
(
CAP_PROP_FRAME_HEIGHT
)
<<
endl
<<
"FRAME_MAX_DEPTH "
<<
capture
.
get
(
CAP_PROP_OPENNI_FRAME_MAX_DEPTH
)
<<
" mm"
<<
endl
<<
"FPS "
<<
capture
.
get
(
CAP_PROP_FPS
)
<<
endl
<<
"REGISTRATION "
<<
capture
.
get
(
CAP_PROP_OPENNI_REGISTRATION
)
<<
endl
;
if
(
capture
.
get
(
CAP_OPENNI_DEPTH_GENERATOR_PRESENT
))
{
cout
<<
"
\n
Depth generator output mode:"
<<
endl
<<
"FRAME_WIDTH "
<<
capture
.
get
(
CAP_PROP_FRAME_WIDTH
)
<<
endl
<<
"FRAME_HEIGHT "
<<
capture
.
get
(
CAP_PROP_FRAME_HEIGHT
)
<<
endl
<<
"FRAME_MAX_DEPTH "
<<
capture
.
get
(
CAP_PROP_OPENNI_FRAME_MAX_DEPTH
)
<<
" mm"
<<
endl
<<
"FPS "
<<
capture
.
get
(
CAP_PROP_FPS
)
<<
endl
<<
"REGISTRATION "
<<
capture
.
get
(
CAP_PROP_OPENNI_REGISTRATION
)
<<
endl
;
}
else
{
cout
<<
"
\n
Device doesn't contain depth generator or it is not selected."
<<
endl
;
}
if
(
capture
.
get
(
CAP_OPENNI_IMAGE_GENERATOR_PRESENT
)
)
{
cout
<<
...
...
@@ -210,9 +234,20 @@ int main( int argc, char* argv[] )
}
else
{
cout
<<
"
\n
Device doesn't contain image generator."
<<
endl
;
if
(
!
retrievedImageFlags
[
0
]
&&
!
retrievedImageFlags
[
1
]
&&
!
retrievedImageFlags
[
2
])
return
0
;
cout
<<
"
\n
Device doesn't contain image generator or it is not selected."
<<
endl
;
}
if
(
capture
.
get
(
CAP_OPENNI_IR_GENERATOR_PRESENT
)
)
{
cout
<<
"
\n
IR generator output mode:"
<<
endl
<<
"FRAME_WIDTH "
<<
capture
.
get
(
CAP_OPENNI_IR_GENERATOR
+
CAP_PROP_FRAME_WIDTH
)
<<
endl
<<
"FRAME_HEIGHT "
<<
capture
.
get
(
CAP_OPENNI_IR_GENERATOR
+
CAP_PROP_FRAME_HEIGHT
)
<<
endl
<<
"FPS "
<<
capture
.
get
(
CAP_OPENNI_IR_GENERATOR
+
CAP_PROP_FPS
)
<<
endl
;
}
else
{
cout
<<
"
\n
Device doesn't contain IR generator or it is not selected."
<<
endl
;
}
for
(;;)
...
...
@@ -222,6 +257,7 @@ int main( int argc, char* argv[] )
Mat
disparityMap
;
Mat
bgrImage
;
Mat
grayImage
;
Mat
irImage
;
if
(
!
capture
.
grab
()
)
{
...
...
@@ -261,6 +297,13 @@ int main( int argc, char* argv[] )
if
(
retrievedImageFlags
[
4
]
&&
capture
.
retrieve
(
grayImage
,
CAP_OPENNI_GRAY_IMAGE
)
)
imshow
(
"gray image"
,
grayImage
);
if
(
retrievedImageFlags
[
5
]
&&
capture
.
retrieve
(
irImage
,
CAP_OPENNI_IR_IMAGE
)
)
{
Mat
ir8
;
irImage
.
convertTo
(
ir8
,
CV_8U
,
256.0
/
3500
,
0.0
);
imshow
(
"IR image"
,
ir8
);
}
}
if
(
waitKey
(
30
)
>=
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录