Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
be9bb8f1
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
be9bb8f1
编写于
5月 08, 2013
作者:
V
Vladislav Vinogradov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactored StereoConstantSpaceBP
上级
d0e89337
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
274 addition
and
206 deletion
+274
-206
modules/gpustereo/include/opencv2/gpustereo.hpp
modules/gpustereo/include/opencv2/gpustereo.hpp
+15
-48
modules/gpustereo/perf/perf_stereo.cpp
modules/gpustereo/perf/perf_stereo.cpp
+2
-2
modules/gpustereo/src/precomp.hpp
modules/gpustereo/src/precomp.hpp
+1
-0
modules/gpustereo/src/stereocsbp.cpp
modules/gpustereo/src/stereocsbp.cpp
+239
-139
modules/gpustereo/test/test_stereo.cpp
modules/gpustereo/test/test_stereo.cpp
+2
-2
samples/gpu/stereo_match.cpp
samples/gpu/stereo_match.cpp
+15
-15
未找到文件。
modules/gpustereo/include/opencv2/gpustereo.hpp
浏览文件 @
be9bb8f1
...
...
@@ -112,63 +112,30 @@ public:
CV_EXPORTS
Ptr
<
gpu
::
StereoBeliefPropagation
>
createStereoBeliefPropagation
(
int
ndisp
=
64
,
int
iters
=
5
,
int
levels
=
5
,
int
msg_type
=
CV_32F
);
/////////////////////////////////////////
// StereoConstantSpaceBP
// "A Constant-Space Belief Propagation Algorithm for Stereo Matching"
// Qingxiong Yang, Liang Wang, Narendra Ahuja
// http://vision.ai.uiuc.edu/~qyang6/
class
CV_EXPORTS
StereoConstantSpaceBP
//! "A Constant-Space Belief Propagation Algorithm for Stereo Matching"
//! Qingxiong Yang, Liang Wang, Narendra Ahuja
//! http://vision.ai.uiuc.edu/~qyang6/
class
CV_EXPORTS
StereoConstantSpaceBP
:
public
gpu
::
StereoBeliefPropagation
{
public:
enum
{
DEFAULT_NDISP
=
128
};
enum
{
DEFAULT_ITERS
=
8
};
enum
{
DEFAULT_LEVELS
=
4
};
enum
{
DEFAULT_NR_PLANE
=
4
};
static
void
estimateRecommendedParams
(
int
width
,
int
height
,
int
&
ndisp
,
int
&
iters
,
int
&
levels
,
int
&
nr_plane
);
//! the default constructor
explicit
StereoConstantSpaceBP
(
int
ndisp
=
DEFAULT_NDISP
,
int
iters
=
DEFAULT_ITERS
,
int
levels
=
DEFAULT_LEVELS
,
int
nr_plane
=
DEFAULT_NR_PLANE
,
int
msg_type
=
CV_32F
);
//! the full constructor taking the number of disparities, number of BP iterations on each level,
//! number of levels, number of active disparity on the first level, truncation of data cost, data weight,
//! truncation of discontinuity cost, discontinuity single jump and minimum disparity threshold
StereoConstantSpaceBP
(
int
ndisp
,
int
iters
,
int
levels
,
int
nr_plane
,
float
max_data_term
,
float
data_weight
,
float
max_disc_term
,
float
disc_single_jump
,
int
min_disp_th
=
0
,
int
msg_type
=
CV_32F
);
//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,
//! if disparity is empty output type will be CV_16S else output type will be disparity.type().
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
Stream
&
stream
=
Stream
::
Null
());
//! number of active disparity on the first level
virtual
int
getNrPlane
()
const
=
0
;
virtual
void
setNrPlane
(
int
nr_plane
)
=
0
;
int
ndisp
;
int
iters
;
int
levels
;
int
nr_plane
;
virtual
bool
getUseLocalInitDataCost
()
const
=
0
;
virtual
void
setUseLocalInitDataCost
(
bool
use_local_init_data_cost
)
=
0
;
float
max_data_term
;
float
data_weight
;
float
max_disc_term
;
float
disc_single_jump
;
static
void
estimateRecommendedParams
(
int
width
,
int
height
,
int
&
ndisp
,
int
&
iters
,
int
&
levels
,
int
&
nr_plane
);
};
int
min_disp_th
;
CV_EXPORTS
Ptr
<
gpu
::
StereoConstantSpaceBP
>
createStereoConstantSpaceBP
(
int
ndisp
=
128
,
int
iters
=
8
,
int
levels
=
4
,
int
nr_plane
=
4
,
int
msg_type
=
CV_32F
);
int
msg_type
;
bool
use_local_init_data_cost
;
private:
GpuMat
messages_buffers
;
GpuMat
temp
;
GpuMat
out
;
};
// Disparity map refinement using joint bilateral filtering given a single color image.
// Qingxiong Yang, Liang Wang, Narendra Ahuja
...
...
modules/gpustereo/perf/perf_stereo.cpp
浏览文件 @
be9bb8f1
...
...
@@ -141,13 +141,13 @@ PERF_TEST_P(ImagePair, StereoConstantSpaceBP,
if
(
PERF_RUN_GPU
())
{
cv
::
gpu
::
StereoConstantSpaceBP
d_csbp
(
ndisp
);
cv
::
Ptr
<
cv
::
gpu
::
StereoConstantSpaceBP
>
d_csbp
=
cv
::
gpu
::
createStereoConstantSpaceBP
(
ndisp
);
const
cv
::
gpu
::
GpuMat
d_imgLeft
(
imgLeft
);
const
cv
::
gpu
::
GpuMat
d_imgRight
(
imgRight
);
cv
::
gpu
::
GpuMat
dst
;
TEST_CYCLE
()
d_csbp
(
d_imgLeft
,
d_imgRight
,
dst
);
TEST_CYCLE
()
d_csbp
->
compute
(
d_imgLeft
,
d_imgRight
,
dst
);
GPU_SANITY_CHECK
(
dst
);
}
...
...
modules/gpustereo/src/precomp.hpp
浏览文件 @
be9bb8f1
...
...
@@ -48,5 +48,6 @@
#include "opencv2/gpustereo.hpp"
#include "opencv2/core/private.gpu.hpp"
#include "opencv2/core/utility.hpp"
#endif
/* __OPENCV_PRECOMP_H__ */
modules/gpustereo/src/stereocsbp.cpp
浏览文件 @
be9bb8f1
此差异已折叠。
点击以展开。
modules/gpustereo/test/test_stereo.cpp
浏览文件 @
be9bb8f1
...
...
@@ -155,10 +155,10 @@ GPU_TEST_P(StereoConstantSpaceBP, Regression)
ASSERT_FALSE
(
right_image
.
empty
());
ASSERT_FALSE
(
disp_gold
.
empty
());
cv
::
gpu
::
StereoConstantSpaceBP
csbp
(
128
,
16
,
4
,
4
);
cv
::
Ptr
<
cv
::
gpu
::
StereoConstantSpaceBP
>
csbp
=
cv
::
gpu
::
createStereoConstantSpaceBP
(
128
,
16
,
4
,
4
);
cv
::
gpu
::
GpuMat
disp
;
csbp
(
loadMat
(
left_image
),
loadMat
(
right_image
),
disp
);
csbp
->
compute
(
loadMat
(
left_image
),
loadMat
(
right_image
),
disp
);
cv
::
Mat
h_disp
(
disp
);
h_disp
.
convertTo
(
h_disp
,
disp_gold
.
depth
());
...
...
samples/gpu/stereo_match.cpp
浏览文件 @
be9bb8f1
...
...
@@ -67,7 +67,7 @@ private:
Ptr
<
gpu
::
StereoBM
>
bm
;
Ptr
<
gpu
::
StereoBeliefPropagation
>
bp
;
gpu
::
StereoConstantSpaceBP
csbp
;
Ptr
<
gpu
::
StereoConstantSpaceBP
>
csbp
;
int64
work_begin
;
double
work_fps
;
...
...
@@ -174,7 +174,7 @@ void App::run()
// Set common parameters
bm
=
gpu
::
createStereoBM
(
p
.
ndisp
);
bp
=
gpu
::
createStereoBeliefPropagation
(
p
.
ndisp
);
csbp
.
ndisp
=
p
.
ndisp
;
csbp
=
cv
::
gpu
::
createStereoConstantSpaceBP
(
p
.
ndisp
)
;
// Prepare disparity map of specified type
Mat
disp
(
left
.
size
(),
CV_8U
);
...
...
@@ -204,7 +204,7 @@ void App::run()
bm
->
compute
(
d_left
,
d_right
,
d_disp
);
break
;
case
Params
::
BP
:
bp
->
compute
(
d_left
,
d_right
,
d_disp
);
break
;
case
Params
::
CSBP
:
csbp
(
d_left
,
d_right
,
d_disp
);
break
;
case
Params
::
CSBP
:
csbp
->
compute
(
d_left
,
d_right
,
d_disp
);
break
;
}
workEnd
();
...
...
@@ -236,8 +236,8 @@ void App::printParams() const
cout
<<
"level_count: "
<<
bp
->
getNumLevels
()
<<
endl
;
break
;
case
Params
::
CSBP
:
cout
<<
"iter_count: "
<<
csbp
.
iters
<<
endl
;
cout
<<
"level_count: "
<<
csbp
.
levels
<<
endl
;
cout
<<
"iter_count: "
<<
csbp
->
getNumIters
()
<<
endl
;
cout
<<
"level_count: "
<<
csbp
->
getNumLevels
()
<<
endl
;
break
;
}
cout
<<
endl
;
...
...
@@ -306,14 +306,14 @@ void App::handleKey(char key)
cout
<<
"ndisp: "
<<
p
.
ndisp
<<
endl
;
bm
->
setNumDisparities
(
p
.
ndisp
);
bp
->
setNumDisparities
(
p
.
ndisp
);
csbp
.
ndisp
=
p
.
ndisp
;
csbp
->
setNumDisparities
(
p
.
ndisp
)
;
break
;
case
'q'
:
case
'Q'
:
p
.
ndisp
=
max
(
p
.
ndisp
-
8
,
1
);
cout
<<
"ndisp: "
<<
p
.
ndisp
<<
endl
;
bm
->
setNumDisparities
(
p
.
ndisp
);
bp
->
setNumDisparities
(
p
.
ndisp
);
csbp
.
ndisp
=
p
.
ndisp
;
csbp
->
setNumDisparities
(
p
.
ndisp
)
;
break
;
case
'2'
:
if
(
p
.
method
==
Params
::
BM
)
...
...
@@ -337,8 +337,8 @@ void App::handleKey(char key)
}
else
if
(
p
.
method
==
Params
::
CSBP
)
{
csbp
.
iters
+=
1
;
cout
<<
"iter_count: "
<<
csbp
.
iters
<<
endl
;
csbp
->
setNumIters
(
csbp
->
getNumIters
()
+
1
)
;
cout
<<
"iter_count: "
<<
csbp
->
getNumIters
()
<<
endl
;
}
break
;
case
'e'
:
case
'E'
:
...
...
@@ -349,8 +349,8 @@ void App::handleKey(char key)
}
else
if
(
p
.
method
==
Params
::
CSBP
)
{
csbp
.
iters
=
max
(
csbp
.
iters
-
1
,
1
);
cout
<<
"iter_count: "
<<
csbp
.
iters
<<
endl
;
csbp
->
setNumIters
(
max
(
csbp
->
getNumIters
()
-
1
,
1
)
);
cout
<<
"iter_count: "
<<
csbp
->
getNumIters
()
<<
endl
;
}
break
;
case
'4'
:
...
...
@@ -361,8 +361,8 @@ void App::handleKey(char key)
}
else
if
(
p
.
method
==
Params
::
CSBP
)
{
csbp
.
levels
+=
1
;
cout
<<
"level_count: "
<<
csbp
.
levels
<<
endl
;
csbp
->
setNumLevels
(
csbp
->
getNumLevels
()
+
1
)
;
cout
<<
"level_count: "
<<
csbp
->
getNumLevels
()
<<
endl
;
}
break
;
case
'r'
:
case
'R'
:
...
...
@@ -373,8 +373,8 @@ void App::handleKey(char key)
}
else
if
(
p
.
method
==
Params
::
CSBP
)
{
csbp
.
levels
=
max
(
csbp
.
levels
-
1
,
1
);
cout
<<
"level_count: "
<<
csbp
.
levels
<<
endl
;
csbp
->
setNumLevels
(
max
(
csbp
->
getNumLevels
()
-
1
,
1
)
);
cout
<<
"level_count: "
<<
csbp
->
getNumLevels
()
<<
endl
;
}
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录